diff --git a/README.md b/README.md index 939182d3..40f5fb09 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,6 @@ Embrace the new generation of Box SDKs and unlock the full potential of the Box pip install box-sdk-gen ``` -Use your GitHub account login and GitHub Personal access token as a password when prompt. -Guide how to obtain GitHub Personal access token can be found [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-fine-grained-personal-access-token). - This is autogenerated Box SDK Beta version. The engine used for generating this SDK can be found [here](https://github.com/box/box-codegen). Supported Python versions are Python 3.8 and above. diff --git a/box_sdk_gen/auth.py b/box_sdk_gen/auth.py index 89f13486..60926b19 100644 --- a/box_sdk_gen/auth.py +++ b/box_sdk_gen/auth.py @@ -2,13 +2,18 @@ from typing import Optional from .network import NetworkSession +from .schemas import AccessToken class Authentication: @abstractmethod - def retrieve_token(self, network_session: Optional[NetworkSession] = None) -> str: + def retrieve_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: pass @abstractmethod - def refresh(self, network_session: Optional[NetworkSession] = None) -> str: + def refresh_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: pass diff --git a/box_sdk_gen/auth_schemas.py b/box_sdk_gen/auth_schemas.py index a9290222..eed09965 100644 --- a/box_sdk_gen/auth_schemas.py +++ b/box_sdk_gen/auth_schemas.py @@ -8,8 +8,12 @@ class TokenRequestGrantType(str, Enum): AUTHORIZATION_CODE = 'authorization_code' REFRESH_TOKEN = 'refresh_token' CLIENT_CREDENTIALS = 'client_credentials' - URN_IETF_PARAMS_OAUTH_GRANT_TYPE_JWT_BEARER = 'urn:ietf:params:oauth:grant-type:jwt-bearer' - URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE = 'urn:ietf:params:oauth:grant-type:token-exchange' + URN_IETF_PARAMS_OAUTH_GRANT_TYPE_JWT_BEARER = ( + 'urn:ietf:params:oauth:grant-type:jwt-bearer' + ) + URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE = ( + 'urn:ietf:params:oauth:grant-type:token-exchange' + ) class TokenRequestBoxSubjectType(str, Enum): @@ -18,7 +22,25 @@ class TokenRequestBoxSubjectType(str, Enum): class TokenRequest(BaseObject): - def __init__(self, grant_type: TokenRequestGrantType, client_id: Union[None, str] = None, client_secret: Union[None, str] = None, code: Union[None, str] = None, refresh_token: Union[None, str] = None, assertion: Union[None, str] = None, subject_token: Union[None, str] = None, subject_token_type: Union[None, str] = None, actor_token: Union[None, str] = None, actor_token_type: Union[None, str] = None, scope: Union[None, str] = None, resource: Union[None, str] = None, box_subject_type: Union[None, TokenRequestBoxSubjectType] = None, box_subject_id: Union[None, str] = None, box_shared_link: Union[None, str] = None, **kwargs): + def __init__( + self, + grant_type: TokenRequestGrantType, + client_id: Union[None, str] = None, + client_secret: Union[None, str] = None, + code: Union[None, str] = None, + refresh_token: Union[None, str] = None, + assertion: Union[None, str] = None, + subject_token: Union[None, str] = None, + subject_token_type: Union[None, str] = None, + actor_token: Union[None, str] = None, + actor_token_type: Union[None, str] = None, + scope: Union[None, str] = None, + resource: Union[None, str] = None, + box_subject_type: Union[None, TokenRequestBoxSubjectType] = None, + box_subject_id: Union[None, str] = None, + box_shared_link: Union[None, str] = None, + **kwargs + ): super().__init__(**kwargs) self.grant_type = grant_type self.client_id = client_id @@ -50,14 +72,3 @@ class FileScope(str, Enum): ITEM_PREVIEW = 'item_preview' ITEM_RENAME = 'item_rename' ITEM_SHARE = 'item_share' - - -class AccessToken(BaseObject): - def __init__(self, access_token: Union[None, str] = None, expires_in: Union[None, int] = None, token_type: Union[None, str] = None, restricted_to: Union[None, List[FileScope]] = None, refresh_token: Union[None, str] = None, issued_token_type: Union[None, str] = None, **kwargs): - super().__init__(**kwargs) - self.access_token = access_token - self.expires_in = expires_in - self.token_type = token_type - self.restricted_to = restricted_to - self.refresh_token = refresh_token - self.issued_token_type = issued_token_type \ No newline at end of file diff --git a/box_sdk_gen/base_object.py b/box_sdk_gen/base_object.py index f695a881..f6eb41ff 100644 --- a/box_sdk_gen/base_object.py +++ b/box_sdk_gen/base_object.py @@ -15,7 +15,9 @@ def from_dict(cls, data: dict): for key, value in data.items(): mapping_field_name = cls._json_to_fields_mapping.get(key, key) annotation = cls.__init__.__annotations__.get(mapping_field_name, None) - unpacked_attributes[mapping_field_name] = cls.__deserialize(key, value, annotation) + unpacked_attributes[mapping_field_name] = cls.__deserialize( + key, value, annotation + ) return cls(**unpacked_attributes) def to_dict(self) -> dict: @@ -24,7 +26,10 @@ def to_dict(self) -> dict: if v is None: continue if type(v) is list: - value = [item.to_dict() if isinstance(item, BaseObject) else item for item in v] + value = [ + item.to_dict() if isinstance(item, BaseObject) else item + for item in v + ] elif isinstance(v, BaseObject): value = v.to_dict() elif isinstance(v, Enum): @@ -42,7 +47,9 @@ def __deserialize(cls, key, value, annotation=None): if get_origin(annotation) == Optional: return cls.__deserialize(key, value, get_args(annotation)) if get_origin(annotation) == Union: - union_without_none_type = [arg for arg in get_args(annotation) if arg is not type(None)] + union_without_none_type = [ + arg for arg in get_args(annotation) if arg is not type(None) + ] if len(union_without_none_type) == 1: return cls.__deserialize(key, value, union_without_none_type[0]) @@ -59,7 +66,9 @@ def __deserialize(cls, key, value, annotation=None): def __deserialize_list(cls, key, value, annotation: list): list_type = get_args(annotation)[0] try: - return [cls.__deserialize(key, list_entry, list_type) for list_entry in value] + return [ + cls.__deserialize(key, list_entry, list_type) for list_entry in value + ] except Exception: return value @@ -70,7 +79,7 @@ def __deserialize_union(cls, key, value, annotation): type = None for i, possible_type in enumerate(possible_types): - #remove special characters + # remove special characters if type_field_value.replace("_", "") in possible_types[i].__name__.lower(): type = possible_types[i] break diff --git a/box_sdk_gen/box_response.py b/box_sdk_gen/box_response.py index 1f46c25f..309a160f 100644 --- a/box_sdk_gen/box_response.py +++ b/box_sdk_gen/box_response.py @@ -3,7 +3,9 @@ class APIResponse: - def __init__(self, network_response: Response, reauthentication_needed, raised_exception): + def __init__( + self, network_response: Response, reauthentication_needed, raised_exception + ): self.network_response = network_response self.reauthentication_needed = reauthentication_needed self.raised_exception = raised_exception @@ -24,7 +26,9 @@ def content(self) -> bytes: def text(self) -> str: return self.network_response.text - def get_header(self, header_name: str, default_value: Optional[str] = None) -> Optional[str]: + def get_header( + self, header_name: str, default_value: Optional[str] = None + ) -> Optional[str]: try: return self.network_response.headers[header_name] except (ValueError, KeyError): diff --git a/box_sdk_gen/ccg_auth.py b/box_sdk_gen/ccg_auth.py index 21f4a49f..03f5e75a 100644 --- a/box_sdk_gen/ccg_auth.py +++ b/box_sdk_gen/ccg_auth.py @@ -3,18 +3,23 @@ from typing import Union, Optional from .auth import Authentication -from .auth_schemas import TokenRequestBoxSubjectType, TokenRequest, TokenRequestGrantType, AccessToken +from .auth_schemas import ( + TokenRequestBoxSubjectType, + TokenRequest, + TokenRequestGrantType, +) from .fetch import fetch, FetchResponse, FetchOptions from .network import NetworkSession +from .schemas import AccessToken class CCGConfig: def __init__( - self, - client_id: str, - client_secret: str, - enterprise_id: Union[None, str] = None, - user_id: Union[None, str] = None + self, + client_id: str, + client_secret: str, + enterprise_id: Union[None, str] = None, + user_id: Union[None, str] = None, ): """ :param client_id: @@ -51,13 +56,13 @@ def __init__( class CCGAuth(Authentication): - def __init__(self, config: CCGConfig): + def __init__(self, config: CCGConfig): """ :param config: Configuration object of Client Credentials Grant auth. """ self.config = config - self.token: Union[None, str] = None + self.token: Union[None, AccessToken] = None if config.user_id: self.subject_id = self.config.user_id @@ -66,17 +71,21 @@ def __init__(self, config: CCGConfig): self.subject_type = TokenRequestBoxSubjectType.ENTERPRISE self.subject_id = self.config.enterprise_id - def retrieve_token(self, network_session: Optional[NetworkSession] = None) -> str: + def retrieve_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: """ Return a current token or get a new one when not available. :return: Access token """ if self.token is None: - return self.refresh(network_session=network_session) + self.refresh_token(network_session=network_session) return self.token - def refresh(self, network_session: Optional[NetworkSession] = None) -> str: + def refresh_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: """ Fetch a new access token :return: @@ -87,7 +96,7 @@ def refresh(self, network_session: Optional[NetworkSession] = None) -> str: client_id=self.config.client_id, client_secret=self.config.client_secret, box_subject_id=self.subject_id, - box_subject_type=self.subject_type + box_subject_type=self.subject_type, ) response: FetchResponse = fetch( @@ -96,13 +105,13 @@ def refresh(self, network_session: Optional[NetworkSession] = None) -> str: method='POST', body=urlencode(request_body.to_dict()), headers={'content-type': 'application/x-www-form-urlencoded'}, - network_session=network_session - ) + network_session=network_session, + ), ) token_response = AccessToken.from_dict(json.loads(response.text)) - self.token = token_response.access_token - return self.token + self.token = token_response + return token_response def as_user(self, user_id: str): """ diff --git a/box_sdk_gen/client.py b/box_sdk_gen/client.py index 9fccee1f..2720108f 100644 --- a/box_sdk_gen/client.py +++ b/box_sdk_gen/client.py @@ -48,7 +48,9 @@ from box_sdk_gen.managers.classifications import ClassificationsManager -from box_sdk_gen.managers.metadata_cascade_policies import MetadataCascadePoliciesManager +from box_sdk_gen.managers.metadata_cascade_policies import ( + MetadataCascadePoliciesManager, +) from box_sdk_gen.managers.search import SearchManager @@ -92,39 +94,61 @@ from box_sdk_gen.managers.retention_policies import RetentionPoliciesManager -from box_sdk_gen.managers.retention_policy_assignments import RetentionPolicyAssignmentsManager +from box_sdk_gen.managers.retention_policy_assignments import ( + RetentionPolicyAssignmentsManager, +) from box_sdk_gen.managers.legal_hold_policies import LegalHoldPoliciesManager -from box_sdk_gen.managers.legal_hold_policy_assignments import LegalHoldPolicyAssignmentsManager +from box_sdk_gen.managers.legal_hold_policy_assignments import ( + LegalHoldPolicyAssignmentsManager, +) from box_sdk_gen.managers.file_version_retentions import FileVersionRetentionsManager from box_sdk_gen.managers.file_version_legal_holds import FileVersionLegalHoldsManager -from box_sdk_gen.managers.shield_information_barriers import ShieldInformationBarriersManager +from box_sdk_gen.managers.shield_information_barriers import ( + ShieldInformationBarriersManager, +) -from box_sdk_gen.managers.shield_information_barrier_reports import ShieldInformationBarrierReportsManager +from box_sdk_gen.managers.shield_information_barrier_reports import ( + ShieldInformationBarrierReportsManager, +) -from box_sdk_gen.managers.shield_information_barrier_segments import ShieldInformationBarrierSegmentsManager +from box_sdk_gen.managers.shield_information_barrier_segments import ( + ShieldInformationBarrierSegmentsManager, +) -from box_sdk_gen.managers.shield_information_barrier_segment_members import ShieldInformationBarrierSegmentMembersManager +from box_sdk_gen.managers.shield_information_barrier_segment_members import ( + ShieldInformationBarrierSegmentMembersManager, +) -from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import ShieldInformationBarrierSegmentRestrictionsManager +from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import ( + ShieldInformationBarrierSegmentRestrictionsManager, +) from box_sdk_gen.managers.device_pinners import DevicePinnersManager from box_sdk_gen.managers.terms_of_services import TermsOfServicesManager -from box_sdk_gen.managers.terms_of_service_user_statuses import TermsOfServiceUserStatusesManager +from box_sdk_gen.managers.terms_of_service_user_statuses import ( + TermsOfServiceUserStatusesManager, +) -from box_sdk_gen.managers.collaboration_allowlist_entries import CollaborationAllowlistEntriesManager +from box_sdk_gen.managers.collaboration_allowlist_entries import ( + CollaborationAllowlistEntriesManager, +) -from box_sdk_gen.managers.collaboration_allowlist_exempt_targets import CollaborationAllowlistExemptTargetsManager +from box_sdk_gen.managers.collaboration_allowlist_exempt_targets import ( + CollaborationAllowlistExemptTargetsManager, +) from box_sdk_gen.managers.storage_policies import StoragePoliciesManager -from box_sdk_gen.managers.storage_policy_assignments import StoragePolicyAssignmentsManager +from box_sdk_gen.managers.storage_policy_assignments import ( + StoragePolicyAssignmentsManager, +) from box_sdk_gen.managers.zip_downloads import ZipDownloadsManager @@ -140,77 +164,220 @@ from box_sdk_gen.network import NetworkSession + class Client: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, auth: Authentication, network_session: Optional[NetworkSession] = None + ): if network_session is None: network_session = NetworkSession() self.auth = auth self.network_session = network_session - self.authorization = AuthorizationManager(auth=self.auth, network_session=self.network_session) + self.authorization = AuthorizationManager( + auth=self.auth, network_session=self.network_session + ) self.files = FilesManager(auth=self.auth, network_session=self.network_session) - self.trashed_files = TrashedFilesManager(auth=self.auth, network_session=self.network_session) - self.downloads = DownloadsManager(auth=self.auth, network_session=self.network_session) - self.uploads = UploadsManager(auth=self.auth, network_session=self.network_session) - self.chunked_uploads = ChunkedUploadsManager(auth=self.auth, network_session=self.network_session) - self.list_collaborations = ListCollaborationsManager(auth=self.auth, network_session=self.network_session) - self.comments = CommentsManager(auth=self.auth, network_session=self.network_session) + self.trashed_files = TrashedFilesManager( + auth=self.auth, network_session=self.network_session + ) + self.downloads = DownloadsManager( + auth=self.auth, network_session=self.network_session + ) + self.uploads = UploadsManager( + auth=self.auth, network_session=self.network_session + ) + self.chunked_uploads = ChunkedUploadsManager( + auth=self.auth, network_session=self.network_session + ) + self.list_collaborations = ListCollaborationsManager( + auth=self.auth, network_session=self.network_session + ) + self.comments = CommentsManager( + auth=self.auth, network_session=self.network_session + ) self.tasks = TasksManager(auth=self.auth, network_session=self.network_session) - self.file_versions = FileVersionsManager(auth=self.auth, network_session=self.network_session) - self.file_metadata = FileMetadataManager(auth=self.auth, network_session=self.network_session) - self.file_classifications = FileClassificationsManager(auth=self.auth, network_session=self.network_session) - self.skills = SkillsManager(auth=self.auth, network_session=self.network_session) - self.file_watermarks = FileWatermarksManager(auth=self.auth, network_session=self.network_session) - self.file_requests = FileRequestsManager(auth=self.auth, network_session=self.network_session) - self.folders = FoldersManager(auth=self.auth, network_session=self.network_session) - self.trashed_folders = TrashedFoldersManager(auth=self.auth, network_session=self.network_session) - self.folder_metadata = FolderMetadataManager(auth=self.auth, network_session=self.network_session) - self.folder_classifications = FolderClassificationsManager(auth=self.auth, network_session=self.network_session) - self.trashed_items = TrashedItemsManager(auth=self.auth, network_session=self.network_session) - self.folder_watermarks = FolderWatermarksManager(auth=self.auth, network_session=self.network_session) - self.folder_locks = FolderLocksManager(auth=self.auth, network_session=self.network_session) - self.metadata_templates = MetadataTemplatesManager(auth=self.auth, network_session=self.network_session) - self.classifications = ClassificationsManager(auth=self.auth, network_session=self.network_session) - self.metadata_cascade_policies = MetadataCascadePoliciesManager(auth=self.auth, network_session=self.network_session) - self.search = SearchManager(auth=self.auth, network_session=self.network_session) - self.user_collaborations = UserCollaborationsManager(auth=self.auth, network_session=self.network_session) - self.task_assignments = TaskAssignmentsManager(auth=self.auth, network_session=self.network_session) - self.shared_links_files = SharedLinksFilesManager(auth=self.auth, network_session=self.network_session) - self.shared_links_folders = SharedLinksFoldersManager(auth=self.auth, network_session=self.network_session) - self.web_links = WebLinksManager(auth=self.auth, network_session=self.network_session) - self.trashed_web_links = TrashedWebLinksManager(auth=self.auth, network_session=self.network_session) - self.shared_links_web_links = SharedLinksWebLinksManager(auth=self.auth, network_session=self.network_session) + self.file_versions = FileVersionsManager( + auth=self.auth, network_session=self.network_session + ) + self.file_metadata = FileMetadataManager( + auth=self.auth, network_session=self.network_session + ) + self.file_classifications = FileClassificationsManager( + auth=self.auth, network_session=self.network_session + ) + self.skills = SkillsManager( + auth=self.auth, network_session=self.network_session + ) + self.file_watermarks = FileWatermarksManager( + auth=self.auth, network_session=self.network_session + ) + self.file_requests = FileRequestsManager( + auth=self.auth, network_session=self.network_session + ) + self.folders = FoldersManager( + auth=self.auth, network_session=self.network_session + ) + self.trashed_folders = TrashedFoldersManager( + auth=self.auth, network_session=self.network_session + ) + self.folder_metadata = FolderMetadataManager( + auth=self.auth, network_session=self.network_session + ) + self.folder_classifications = FolderClassificationsManager( + auth=self.auth, network_session=self.network_session + ) + self.trashed_items = TrashedItemsManager( + auth=self.auth, network_session=self.network_session + ) + self.folder_watermarks = FolderWatermarksManager( + auth=self.auth, network_session=self.network_session + ) + self.folder_locks = FolderLocksManager( + auth=self.auth, network_session=self.network_session + ) + self.metadata_templates = MetadataTemplatesManager( + auth=self.auth, network_session=self.network_session + ) + self.classifications = ClassificationsManager( + auth=self.auth, network_session=self.network_session + ) + self.metadata_cascade_policies = MetadataCascadePoliciesManager( + auth=self.auth, network_session=self.network_session + ) + self.search = SearchManager( + auth=self.auth, network_session=self.network_session + ) + self.user_collaborations = UserCollaborationsManager( + auth=self.auth, network_session=self.network_session + ) + self.task_assignments = TaskAssignmentsManager( + auth=self.auth, network_session=self.network_session + ) + self.shared_links_files = SharedLinksFilesManager( + auth=self.auth, network_session=self.network_session + ) + self.shared_links_folders = SharedLinksFoldersManager( + auth=self.auth, network_session=self.network_session + ) + self.web_links = WebLinksManager( + auth=self.auth, network_session=self.network_session + ) + self.trashed_web_links = TrashedWebLinksManager( + auth=self.auth, network_session=self.network_session + ) + self.shared_links_web_links = SharedLinksWebLinksManager( + auth=self.auth, network_session=self.network_session + ) self.users = UsersManager(auth=self.auth, network_session=self.network_session) - self.session_termination = SessionTerminationManager(auth=self.auth, network_session=self.network_session) - self.avatars = AvatarsManager(auth=self.auth, network_session=self.network_session) - self.transfer = TransferManager(auth=self.auth, network_session=self.network_session) - self.email_aliases = EmailAliasesManager(auth=self.auth, network_session=self.network_session) - self.memberships = MembershipsManager(auth=self.auth, network_session=self.network_session) - self.invites = InvitesManager(auth=self.auth, network_session=self.network_session) - self.groups = GroupsManager(auth=self.auth, network_session=self.network_session) - self.webhooks = WebhooksManager(auth=self.auth, network_session=self.network_session) - self.events = EventsManager(auth=self.auth, network_session=self.network_session) - self.collections = CollectionsManager(auth=self.auth, network_session=self.network_session) - self.recent_items = RecentItemsManager(auth=self.auth, network_session=self.network_session) - self.retention_policies = RetentionPoliciesManager(auth=self.auth, network_session=self.network_session) - self.retention_policy_assignments = RetentionPolicyAssignmentsManager(auth=self.auth, network_session=self.network_session) - self.legal_hold_policies = LegalHoldPoliciesManager(auth=self.auth, network_session=self.network_session) - self.legal_hold_policy_assignments = LegalHoldPolicyAssignmentsManager(auth=self.auth, network_session=self.network_session) - self.file_version_retentions = FileVersionRetentionsManager(auth=self.auth, network_session=self.network_session) - self.file_version_legal_holds = FileVersionLegalHoldsManager(auth=self.auth, network_session=self.network_session) - self.shield_information_barriers = ShieldInformationBarriersManager(auth=self.auth, network_session=self.network_session) - self.shield_information_barrier_reports = ShieldInformationBarrierReportsManager(auth=self.auth, network_session=self.network_session) - self.shield_information_barrier_segments = ShieldInformationBarrierSegmentsManager(auth=self.auth, network_session=self.network_session) - self.shield_information_barrier_segment_members = ShieldInformationBarrierSegmentMembersManager(auth=self.auth, network_session=self.network_session) - self.shield_information_barrier_segment_restrictions = ShieldInformationBarrierSegmentRestrictionsManager(auth=self.auth, network_session=self.network_session) - self.device_pinners = DevicePinnersManager(auth=self.auth, network_session=self.network_session) - self.terms_of_services = TermsOfServicesManager(auth=self.auth, network_session=self.network_session) - self.terms_of_service_user_statuses = TermsOfServiceUserStatusesManager(auth=self.auth, network_session=self.network_session) - self.collaboration_allowlist_entries = CollaborationAllowlistEntriesManager(auth=self.auth, network_session=self.network_session) - self.collaboration_allowlist_exempt_targets = CollaborationAllowlistExemptTargetsManager(auth=self.auth, network_session=self.network_session) - self.storage_policies = StoragePoliciesManager(auth=self.auth, network_session=self.network_session) - self.storage_policy_assignments = StoragePolicyAssignmentsManager(auth=self.auth, network_session=self.network_session) - self.zip_downloads = ZipDownloadsManager(auth=self.auth, network_session=self.network_session) - self.sign_requests = SignRequestsManager(auth=self.auth, network_session=self.network_session) - self.workflows = WorkflowsManager(auth=self.auth, network_session=self.network_session) - self.sign_templates = SignTemplatesManager(auth=self.auth, network_session=self.network_session) - self.integration_mappings = IntegrationMappingsManager(auth=self.auth, network_session=self.network_session) \ No newline at end of file + self.session_termination = SessionTerminationManager( + auth=self.auth, network_session=self.network_session + ) + self.avatars = AvatarsManager( + auth=self.auth, network_session=self.network_session + ) + self.transfer = TransferManager( + auth=self.auth, network_session=self.network_session + ) + self.email_aliases = EmailAliasesManager( + auth=self.auth, network_session=self.network_session + ) + self.memberships = MembershipsManager( + auth=self.auth, network_session=self.network_session + ) + self.invites = InvitesManager( + auth=self.auth, network_session=self.network_session + ) + self.groups = GroupsManager( + auth=self.auth, network_session=self.network_session + ) + self.webhooks = WebhooksManager( + auth=self.auth, network_session=self.network_session + ) + self.events = EventsManager( + auth=self.auth, network_session=self.network_session + ) + self.collections = CollectionsManager( + auth=self.auth, network_session=self.network_session + ) + self.recent_items = RecentItemsManager( + auth=self.auth, network_session=self.network_session + ) + self.retention_policies = RetentionPoliciesManager( + auth=self.auth, network_session=self.network_session + ) + self.retention_policy_assignments = RetentionPolicyAssignmentsManager( + auth=self.auth, network_session=self.network_session + ) + self.legal_hold_policies = LegalHoldPoliciesManager( + auth=self.auth, network_session=self.network_session + ) + self.legal_hold_policy_assignments = LegalHoldPolicyAssignmentsManager( + auth=self.auth, network_session=self.network_session + ) + self.file_version_retentions = FileVersionRetentionsManager( + auth=self.auth, network_session=self.network_session + ) + self.file_version_legal_holds = FileVersionLegalHoldsManager( + auth=self.auth, network_session=self.network_session + ) + self.shield_information_barriers = ShieldInformationBarriersManager( + auth=self.auth, network_session=self.network_session + ) + self.shield_information_barrier_reports = ( + ShieldInformationBarrierReportsManager( + auth=self.auth, network_session=self.network_session + ) + ) + self.shield_information_barrier_segments = ( + ShieldInformationBarrierSegmentsManager( + auth=self.auth, network_session=self.network_session + ) + ) + self.shield_information_barrier_segment_members = ( + ShieldInformationBarrierSegmentMembersManager( + auth=self.auth, network_session=self.network_session + ) + ) + self.shield_information_barrier_segment_restrictions = ( + ShieldInformationBarrierSegmentRestrictionsManager( + auth=self.auth, network_session=self.network_session + ) + ) + self.device_pinners = DevicePinnersManager( + auth=self.auth, network_session=self.network_session + ) + self.terms_of_services = TermsOfServicesManager( + auth=self.auth, network_session=self.network_session + ) + self.terms_of_service_user_statuses = TermsOfServiceUserStatusesManager( + auth=self.auth, network_session=self.network_session + ) + self.collaboration_allowlist_entries = CollaborationAllowlistEntriesManager( + auth=self.auth, network_session=self.network_session + ) + self.collaboration_allowlist_exempt_targets = ( + CollaborationAllowlistExemptTargetsManager( + auth=self.auth, network_session=self.network_session + ) + ) + self.storage_policies = StoragePoliciesManager( + auth=self.auth, network_session=self.network_session + ) + self.storage_policy_assignments = StoragePolicyAssignmentsManager( + auth=self.auth, network_session=self.network_session + ) + self.zip_downloads = ZipDownloadsManager( + auth=self.auth, network_session=self.network_session + ) + self.sign_requests = SignRequestsManager( + auth=self.auth, network_session=self.network_session + ) + self.workflows = WorkflowsManager( + auth=self.auth, network_session=self.network_session + ) + self.sign_templates = SignTemplatesManager( + auth=self.auth, network_session=self.network_session + ) + self.integration_mappings = IntegrationMappingsManager( + auth=self.auth, network_session=self.network_session + ) diff --git a/box_sdk_gen/developer_token_auth.py b/box_sdk_gen/developer_token_auth.py index c1fb4e8d..9ed8506a 100644 --- a/box_sdk_gen/developer_token_auth.py +++ b/box_sdk_gen/developer_token_auth.py @@ -2,14 +2,19 @@ from .auth import Authentication from .network import NetworkSession +from .schemas import AccessToken class DeveloperTokenAuth(Authentication): def __init__(self, token: str): - self.token: str = token + self.token: AccessToken = AccessToken(access_token=token) - def retrieve_token(self, network_session: Optional[NetworkSession] = None) -> str: + def retrieve_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: return self.token - def refresh(self, network_session: Optional[NetworkSession] = None) -> str: - raise Exception("Developer token has expired. Please provide a new one.") \ No newline at end of file + def refresh_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: + raise Exception("Developer token has expired. Please provide a new one.") diff --git a/box_sdk_gen/fetch.py b/box_sdk_gen/fetch.py index b195140e..ea6176fd 100644 --- a/box_sdk_gen/fetch.py +++ b/box_sdk_gen/fetch.py @@ -21,8 +21,10 @@ _RETRY_BASE_INTERVAL = 1 SDK_VERSION = '0.1.0' USER_AGENT_HEADER = f'box-python-generated-sdk-{SDK_VERSION}' -X_BOX_UA_HEADER = f'agent=box-python-generated-sdk/{SDK_VERSION}; ' \ - f'env=python/{py_version.major}.{py_version.minor}.{py_version.micro}' +X_BOX_UA_HEADER = ( + f'agent=box-python-generated-sdk/{SDK_VERSION}; ' + f'env=python/{py_version.major}.{py_version.minor}.{py_version.micro}' +) @dataclass @@ -67,22 +69,24 @@ class APIException(Exception): network_response: Optional[Response] = None def __str__(self): - return '\n'.join(( - f'Message: {self.message}', - f'Status: {self.status}', - f'Code: {self.code}', - f'Request ID: {self.request_id}', - f'Headers: {self.headers}', - f'URL: {self.url}', - f'Method: {self.method}', - f'Context Info: {self.context_info}', - )) + return '\n'.join( + ( + f'Message: {self.message}', + f'Status: {self.status}', + f'Code: {self.code}', + f'Request ID: {self.request_id}', + f'Headers: {self.headers}', + f'URL: {self.url}', + f'Method: {self.method}', + f'Context Info: {self.context_info}', + ) + ) def fetch(url: str, options: FetchOptions) -> FetchResponse: if options.network_session: max_attempts = options.network_session.MAX_ATTEMPTS - requests_session= options.network_session.requests_session + requests_session = options.network_session.requests_session else: max_attempts = DEFAULT_MAX_ATTEMPTS requests_session = requests.Session() @@ -100,7 +104,7 @@ def fetch(url: str, options: FetchOptions) -> FetchResponse: content_type=options.content_type, params=params, multipart_data=options.multipart_data, - attempt_nr=attempt_nr + attempt_nr=attempt_nr, ) while attempt_nr < max_attempts: @@ -108,24 +112,32 @@ def fetch(url: str, options: FetchOptions) -> FetchResponse: if options.response_format == 'binary': return FetchResponse( status=response.status_code, - content=ResponseByteStream(response.network_response.iter_content(chunk_size=1024)) + content=ResponseByteStream( + response.network_response.iter_content(chunk_size=1024) + ), ) else: return FetchResponse( status=response.status_code, text=response.text, - content=io.BytesIO(response.content) + content=io.BytesIO(response.content), ) if response.reauthentication_needed: - options.auth.refresh(options.network_session) + options.auth.refresh_token(options.network_session) elif response.status_code != 429 and response.status_code < 500: - __raise_on_unsuccessful_request(network_response=response.network_response, url=url, method=options.method) - - time.sleep(__get_retry_after_time( - attempt_number=attempt_nr, - retry_after_header=response.get_header('Retry-After', None) - )) + __raise_on_unsuccessful_request( + network_response=response.network_response, + url=url, + method=options.method, + ) + + time.sleep( + __get_retry_after_time( + attempt_number=attempt_nr, + retry_after_header=response.get_header('Retry-After', None), + ) + ) response: APIResponse = __make_request( session=requests_session, @@ -136,24 +148,39 @@ def fetch(url: str, options: FetchOptions) -> FetchResponse: content_type=options.content_type, params=params, multipart_data=options.multipart_data, - attempt_nr=attempt_nr + attempt_nr=attempt_nr, ) attempt_nr += 1 - __raise_on_unsuccessful_request(network_response=response.network_response, url=url, method=options.method) + __raise_on_unsuccessful_request( + network_response=response.network_response, url=url, method=options.method + ) def __compose_headers_for_request(options: FetchOptions) -> Dict[str, str]: headers = options.headers or {} if options.auth: - headers['Authorization'] = f'Bearer {options.auth.retrieve_token(options.network_session)}' + headers['Authorization'] = ( + 'Bearer' + f' {options.auth.retrieve_token(options.network_session).access_token}' + ) headers['User-Agent'] = USER_AGENT_HEADER headers['X-Box-UA'] = X_BOX_UA_HEADER return headers -def __make_request(session, method, url, headers, body, content_type, params, multipart_data, attempt_nr) -> APIResponse: +def __make_request( + session, + method, + url, + headers, + body, + content_type, + params, + multipart_data, + attempt_nr, +) -> APIResponse: if content_type == 'multipart/form-data': fields = OrderedDict() for part in multipart_data: @@ -163,7 +190,11 @@ def __make_request(session, method, url, headers, body, content_type, params, mu file_stream = part.file_stream file_stream_position = file_stream.tell() file_stream.seek(file_stream_position) - fields[part.part_name] = (part.file_name or '', file_stream, part.content_type) + fields[part.part_name] = ( + part.file_name or '', + file_stream, + part.content_type, + ) multipart_stream = MultipartEncoder(fields) body = multipart_stream @@ -177,7 +208,7 @@ def __make_request(session, method, url, headers, body, content_type, params, mu headers=headers, data=body, params=params, - stream=True + stream=True, ) reauthentication_needed = network_response.status_code == 401 except RequestException as request_exc: @@ -188,9 +219,10 @@ def __make_request(session, method, url, headers, body, content_type, params, mu if 'EOF occurred in violation of protocol' in str(request_exc): reauthentication_needed = True - elif any(text in str(request_exc) for text in [ - 'Connection aborted', 'Connection broken', 'Connection reset' - ]): + elif any( + text in str(request_exc) + for text in ['Connection aborted', 'Connection broken', 'Connection reset'] + ): reauthentication_needed = False else: raise @@ -198,7 +230,7 @@ def __make_request(session, method, url, headers, body, content_type, params, mu return APIResponse( network_response=network_response, reauthentication_needed=reauthentication_needed, - raised_exception=raised_exception + raised_exception=raised_exception, ) @@ -212,16 +244,19 @@ def __raise_on_unsuccessful_request(network_response, url, method) -> None: status=network_response.status_code, headers=network_response.headers, code=response_json.get('code', None) or response_json.get('error', None), - message=response_json.get('message', None) or response_json.get('error_description', None), + message=response_json.get('message', None) + or response_json.get('error_description', None), request_id=response_json.get('request_id', None), url=url, method=method, context_info=response_json.get('context_info', None), - network_response=network_response + network_response=network_response, ) -def __get_retry_after_time(attempt_number: int, retry_after_header: Optional[str] = None) -> float: +def __get_retry_after_time( + attempt_number: int, retry_after_header: Optional[str] = None +) -> float: if retry_after_header is not None: try: return int(retry_after_header) @@ -229,6 +264,8 @@ def __get_retry_after_time(attempt_number: int, retry_after_header: Optional[str pass min_randomization = 1 - _RETRY_RANDOMIZATION_FACTOR max_randomization = 1 + _RETRY_RANDOMIZATION_FACTOR - randomization = (random.uniform(0, 1) * (max_randomization - min_randomization)) + min_randomization + randomization = ( + random.uniform(0, 1) * (max_randomization - min_randomization) + ) + min_randomization exponential = math.pow(2, attempt_number) return exponential * _RETRY_BASE_INTERVAL * randomization diff --git a/box_sdk_gen/jwt_auth.py b/box_sdk_gen/jwt_auth.py index e5e95f32..1cc04622 100644 --- a/box_sdk_gen/jwt_auth.py +++ b/box_sdk_gen/jwt_auth.py @@ -14,23 +14,28 @@ jwt, default_backend, serialization = None, None, None from .auth import Authentication -from .auth_schemas import TokenRequestBoxSubjectType, TokenRequest, TokenRequestGrantType, AccessToken +from .auth_schemas import ( + TokenRequestBoxSubjectType, + TokenRequest, + TokenRequestGrantType, +) from .fetch import fetch, FetchResponse, FetchOptions from .network import NetworkSession +from .schemas import AccessToken class JWTConfig: def __init__( - self, - client_id: str, - client_secret: str, - jwt_key_id: str, - private_key: str, - private_key_passphrase: str, - enterprise_id: Optional[str] = None, - user_id: Optional[str] = None, - jwt_algorithm: str = 'RS256', - **_kwargs + self, + client_id: str, + client_secret: str, + jwt_key_id: str, + private_key: str, + private_key_passphrase: str, + enterprise_id: Optional[str] = None, + user_id: Optional[str] = None, + jwt_algorithm: str = 'RS256', + **_kwargs ): """ :param client_id: @@ -78,7 +83,9 @@ def __init__( self.jwt_algorithm = jwt_algorithm @classmethod - def from_config_json_string(cls, config_json_string: str, **kwargs: Any) -> 'JWTConfig': + def from_config_json_string( + cls, config_json_string: str, **kwargs: Any + ) -> 'JWTConfig': """ Create an auth instance as defined by a string content of JSON file downloaded from the Box Developer Console. See https://developer.box.com/en/guides/authentication/jwt/ for more information. @@ -96,11 +103,14 @@ def from_config_json_string(cls, config_json_string: str, **kwargs: Any) -> 'JWT client_secret=config_dict['boxAppSettings']['clientSecret'], enterprise_id=config_dict.get('enterpriseID', None), jwt_key_id=config_dict['boxAppSettings']['appAuth'].get( - 'publicKeyID', None), + 'publicKeyID', None + ), private_key=config_dict['boxAppSettings']['appAuth'].get( - 'privateKey', None), + 'privateKey', None + ), private_key_passphrase=config_dict['boxAppSettings']['appAuth'].get( - 'passphrase', None), + 'passphrase', None + ), **kwargs ) @@ -127,12 +137,12 @@ def __init__(self, config: JWTConfig): """ if None in (default_backend, serialization, jwt): raise Exception( - 'Missing dependencies required for JWTAuth. To install them use command: ' - '`pip install box-sdk-gen[jwt]`' + 'Missing dependencies required for JWTAuth. To install them use' + ' command: `pip install box-sdk-gen[jwt]`' ) self.config = config - self.token = None + self.token: Union[None, AccessToken] = None if config.enterprise_id: self.subject_type = TokenRequestBoxSubjectType.ENTERPRISE @@ -142,19 +152,24 @@ def __init__(self, config: JWTConfig): self.subject_type = TokenRequestBoxSubjectType.USER self._rsa_private_key = self._get_rsa_private_key( - config.private_key, config.private_key_passphrase) + config.private_key, config.private_key_passphrase + ) - def retrieve_token(self, network_session: Optional[NetworkSession] = None) -> str: + def retrieve_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: """ Return a current token or get a new one when not available. :return: Access token """ if self.token is None: - return self.refresh(network_session=network_session) + self.refresh_token(network_session=network_session) return self.token - def refresh(self, network_session: Optional[NetworkSession] = None) -> str: + def refresh_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: """ Fetch a new access token :return: @@ -164,8 +179,10 @@ def refresh(self, network_session: Optional[NetworkSession] = None) -> str: jti_length = system_random.randint(16, 128) ascii_alphabet = string.ascii_letters + string.digits ascii_len = len(ascii_alphabet) - jti = ''.join(ascii_alphabet[int( - system_random.random() * ascii_len)] for _ in range(jti_length)) + jti = ''.join( + ascii_alphabet[int(system_random.random() * ascii_len)] + for _ in range(jti_length) + ) now_time = datetime.utcnow() now_plus_30 = now_time + timedelta(seconds=30) assertion = jwt.encode( @@ -197,12 +214,12 @@ def refresh(self, network_session: Optional[NetworkSession] = None) -> str: method='POST', body=urlencode(request_body.to_dict()), headers={'content-type': 'application/x-www-form-urlencoded'}, - network_session=network_session - ) + network_session=network_session, + ), ) token_response = AccessToken.from_dict(json.loads(response.text)) - self.token = token_response.access_token + self.token = token_response return self.token def as_user(self, user_id: str): @@ -236,9 +253,9 @@ def as_enterprise(self, enterprise_id: str): @classmethod def _get_rsa_private_key( - cls, - private_key: str, - passphrase: str, + cls, + private_key: str, + passphrase: str, ) -> Any: encoded_private_key = cls._encode_str_ascii_or_raise(private_key) encoded_passphrase = cls._encode_str_ascii_or_raise(passphrase) @@ -255,5 +272,6 @@ def _encode_str_ascii_or_raise(passphrase: str) -> bytes: return passphrase.encode('ascii') except UnicodeError as unicode_error: raise TypeError( - "private_key and private_key_passphrase must contain binary data (bytes/str), not a text/unicode string" + "private_key and private_key_passphrase must contain binary data" + " (bytes/str), not a text/unicode string" ) from unicode_error diff --git a/box_sdk_gen/managers/authorization.py b/box_sdk_gen/managers/authorization.py index 8b8b2495..e71ff585 100644 --- a/box_sdk_gen/managers/authorization.py +++ b/box_sdk_gen/managers/authorization.py @@ -24,29 +24,44 @@ from box_sdk_gen.fetch import FetchResponse + class GetAuthorizeResponseTypeArg(str, Enum): CODE = 'code' + class AuthorizationManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_authorize(self, response_type: GetAuthorizeResponseTypeArg, client_id: str, redirect_uri: Optional[str] = None, state: Optional[str] = None, scope: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def get_authorize( + self, + response_type: GetAuthorizeResponseTypeArg, + client_id: str, + redirect_uri: Optional[str] = None, + state: Optional[str] = None, + scope: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Authorize a user by sending them through the [Box](https://box.com) - + website and request their permission to act on their behalf. - + This is the first step when authenticating a user using - + OAuth 2.0. To request a user's authorization to use the Box APIs - + on their behalf you will need to send a user to the URL with this - + format. :param response_type: The type of response we'd like to receive. @@ -82,7 +97,25 @@ def get_authorize(self, response_type: GetAuthorizeResponseTypeArg, client_id: s """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'response_type': to_string(response_type), 'client_id': to_string(client_id), 'redirect_uri': to_string(redirect_uri), 'state': to_string(state), 'scope': to_string(scope)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'response_type': to_string(response_type), + 'client_id': to_string(client_id), + 'redirect_uri': to_string(redirect_uri), + 'state': to_string(state), + 'scope': to_string(scope), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://account.box.com/api/oauth2/authorize']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://account.box.com/api/oauth2/authorize']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/avatars.py b/box_sdk_gen/managers/avatars.py index 42b34f4e..1772836b 100644 --- a/box_sdk_gen/managers/avatars.py +++ b/box_sdk_gen/managers/avatars.py @@ -28,11 +28,19 @@ from box_sdk_gen.fetch import MultipartItem + class AvatarsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_user_avatar(self, user_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ByteStream: + + def get_user_avatar( + self, user_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> ByteStream: """ Retrieves an image of a the user's avatar. :param user_id: The ID of the user. @@ -44,9 +52,26 @@ def get_user_avatar(self, user_id: str, extra_headers: Optional[Dict[str, Option if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/avatar']), FetchOptions(method='GET', headers=headers_map, response_format='binary', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id, '/avatar']), + FetchOptions( + method='GET', + headers=headers_map, + response_format='binary', + auth=self.auth, + network_session=self.network_session, + ), + ) return response.content - def create_user_avatar(self, user_id: str, pic: ByteStream, pic_file_name: Optional[str] = None, pic_content_type: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UserAvatar: + + def create_user_avatar( + self, + user_id: str, + pic: ByteStream, + pic_file_name: Optional[str] = None, + pic_content_type: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UserAvatar: """ Adds or updates a user avatar. :param user_id: The ID of the user. @@ -61,14 +86,37 @@ def create_user_avatar(self, user_id: str, pic: ByteStream, pic_file_name: Optio """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(pic=pic, pic_file_name=pic_file_name, pic_content_type=pic_content_type) + request_body = BaseObject( + pic=pic, pic_file_name=pic_file_name, pic_content_type=pic_content_type + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/avatar']), FetchOptions(method='POST', headers=headers_map, multipart_data=[MultipartItem(part_name='pic', file_stream=request_body.pic, file_name=request_body.pic_file_name, content_type=request_body.pic_content_type)], content_type='multipart/form-data', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id, '/avatar']), + FetchOptions( + method='POST', + headers=headers_map, + multipart_data=[ + MultipartItem( + part_name='pic', + file_stream=request_body.pic, + file_name=request_body.pic_file_name, + content_type=request_body.pic_content_type, + ) + ], + content_type='multipart/form-data', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UserAvatar.from_dict(json.loads(response.text)) - def delete_user_avatar(self, user_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_user_avatar( + self, user_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Removes an existing user avatar. - + You cannot reverse this operation. :param user_id: The ID of the user. @@ -80,5 +128,14 @@ def delete_user_avatar(self, user_id: str, extra_headers: Optional[Dict[str, Opt if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/avatar']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id, '/avatar']), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/chunked_uploads.py b/box_sdk_gen/managers/chunked_uploads.py index 2f91e9b2..db766d19 100644 --- a/box_sdk_gen/managers/chunked_uploads.py +++ b/box_sdk_gen/managers/chunked_uploads.py @@ -36,11 +36,23 @@ from box_sdk_gen.fetch import FetchResponse + class ChunkedUploadsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def create_file_upload_session(self, folder_id: str, file_size: int, file_name: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UploadSession: + + def create_file_upload_session( + self, + folder_id: str, + file_size: int, + file_name: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UploadSession: """ Creates an upload session for a new file. :param folder_id: The ID of the folder to upload the new file to. @@ -54,11 +66,31 @@ def create_file_upload_session(self, folder_id: str, file_size: int, file_name: """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(folder_id=folder_id, file_size=file_size, file_name=file_name) + request_body = BaseObject( + folder_id=folder_id, file_size=file_size, file_name=file_name + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/upload_sessions']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://upload.box.com/api/2.0/files/upload_sessions']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UploadSession.from_dict(json.loads(response.text)) - def create_file_upload_session_for_existing_file(self, file_id: str, file_size: int, file_name: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UploadSession: + + def create_file_upload_session_for_existing_file( + self, + file_id: str, + file_size: int, + file_name: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UploadSession: """ Creates an upload session for an existing file. :param file_id: The unique identifier that represents a file. @@ -78,11 +110,29 @@ def create_file_upload_session_for_existing_file(self, file_id: str, file_size: """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(file_size=file_size, file_name=file_name) + request_body = BaseObject(file_size=file_size, file_name=file_name) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/', file_id, '/upload_sessions']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://upload.box.com/api/2.0/files/', file_id, '/upload_sessions'] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UploadSession.from_dict(json.loads(response.text)) - def get_file_upload_session_by_id(self, upload_session_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UploadSession: + + def get_file_upload_session_by_id( + self, + upload_session_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UploadSession: """ Return information about an upload session. :param upload_session_id: The ID of the upload session. @@ -94,9 +144,31 @@ def get_file_upload_session_by_id(self, upload_session_id: str, extra_headers: O if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/upload_sessions/', upload_session_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://upload.box.com/api/2.0/files/upload_sessions/', + upload_session_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UploadSession.from_dict(json.loads(response.text)) - def upload_file_part(self, upload_session_id: str, request_body: ByteStream, digest: str, content_range: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UploadedPart: + + def upload_file_part( + self, + upload_session_id: str, + request_body: ByteStream, + digest: str, + content_range: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UploadedPart: """ Updates a chunk of an upload session for a file. :param upload_session_id: The ID of the upload session. @@ -129,13 +201,40 @@ def upload_file_part(self, upload_session_id: str, request_body: ByteStream, dig """ if extra_headers is None: extra_headers = {} - headers_map: Dict[str, str] = prepare_params({'digest': to_string(digest), 'content-range': to_string(content_range), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/upload_sessions/', upload_session_id]), FetchOptions(method='PUT', headers=headers_map, body=request_body, content_type='application/octet-stream', response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + { + 'digest': to_string(digest), + 'content-range': to_string(content_range), + **extra_headers, + } + ) + response: FetchResponse = fetch( + ''.join( + [ + 'https://upload.box.com/api/2.0/files/upload_sessions/', + upload_session_id, + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=request_body, + content_type='application/octet-stream', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UploadedPart.from_dict(json.loads(response.text)) - def delete_file_upload_session_by_id(self, upload_session_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_upload_session_by_id( + self, + upload_session_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Abort an upload session and discard all data uploaded. - + This cannot be reversed. :param upload_session_id: The ID of the upload session. @@ -147,12 +246,33 @@ def delete_file_upload_session_by_id(self, upload_session_id: str, extra_headers if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/upload_sessions/', upload_session_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://upload.box.com/api/2.0/files/upload_sessions/', + upload_session_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_file_upload_session_parts(self, upload_session_id: str, offset: Optional[int] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UploadParts: + + def get_file_upload_session_parts( + self, + upload_session_id: str, + offset: Optional[int] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UploadParts: """ Return a list of the chunks uploaded to the upload - + session so far. :param upload_session_id: The ID of the upload session. @@ -170,14 +290,41 @@ def get_file_upload_session_parts(self, upload_session_id: str, offset: Optional """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'offset': to_string(offset), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'offset': to_string(offset), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/upload_sessions/', upload_session_id, '/parts']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://upload.box.com/api/2.0/files/upload_sessions/', + upload_session_id, + '/parts', + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UploadParts.from_dict(json.loads(response.text)) - def create_file_upload_session_commit(self, upload_session_id: str, parts: List[UploadPart], digest: str, if_match: Optional[str] = None, if_none_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Files: + + def create_file_upload_session_commit( + self, + upload_session_id: str, + parts: List[UploadPart], + digest: str, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Files: """ Close an upload session and create a file from the - + uploaded chunks. :param upload_session_id: The ID of the upload session. @@ -209,7 +356,31 @@ def create_file_upload_session_commit(self, upload_session_id: str, parts: List[ """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(parts=parts) - headers_map: Dict[str, str] = prepare_params({'digest': to_string(digest), 'if-match': to_string(if_match), 'if-none-match': to_string(if_none_match), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/upload_sessions/', upload_session_id, '/commit']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return Files.from_dict(json.loads(response.text)) \ No newline at end of file + request_body = BaseObject(parts=parts) + headers_map: Dict[str, str] = prepare_params( + { + 'digest': to_string(digest), + 'if-match': to_string(if_match), + 'if-none-match': to_string(if_none_match), + **extra_headers, + } + ) + response: FetchResponse = fetch( + ''.join( + [ + 'https://upload.box.com/api/2.0/files/upload_sessions/', + upload_session_id, + '/commit', + ] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return Files.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/classifications.py b/box_sdk_gen/managers/classifications.py index bad500fb..7f3fa6e3 100644 --- a/box_sdk_gen/managers/classifications.py +++ b/box_sdk_gen/managers/classifications.py @@ -32,10 +32,27 @@ from box_sdk_gen.fetch import FetchResponse -class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArgDataFieldClassificationField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'classification_definition': 'classificationDefinition', 'color_id': 'colorID', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'classificationDefinition': 'classification_definition', 'colorID': 'color_id', **BaseObject._json_to_fields_mapping} - def __init__(self, classification_definition: Optional[str] = None, color_id: Optional[int] = None, **kwargs): + +class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArgDataFieldClassificationField( + BaseObject +): + _fields_to_json_mapping: Dict[str, str] = { + 'classification_definition': 'classificationDefinition', + 'color_id': 'colorID', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'classificationDefinition': 'classification_definition', + 'colorID': 'color_id', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + classification_definition: Optional[str] = None, + color_id: Optional[int] = None, + **kwargs + ): """ :param classification_definition: A longer description of the classification. :type classification_definition: Optional[str], optional @@ -58,8 +75,18 @@ def __init__(self, classification_definition: Optional[str] = None, color_id: Op self.classification_definition = classification_definition self.color_id = color_id -class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArgDataField(BaseObject): - def __init__(self, key: str, classification: Optional[UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArgDataFieldClassificationField] = None, **kwargs): + +class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArgDataField( + BaseObject +): + def __init__( + self, + key: str, + classification: Optional[ + UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArgDataFieldClassificationField + ] = None, + **kwargs + ): """ :param key: The label of the classification as shown in the web and mobile interfaces. This is the only field required to @@ -72,10 +99,26 @@ def __init__(self, key: str, classification: Optional[UpdateMetadataTemplateEnte self.key = key self.classification = classification -class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArg(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'field_key': 'fieldKey', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'fieldKey': 'field_key', **BaseObject._json_to_fields_mapping} - def __init__(self, op: str, field_key: str, data: UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArgDataField, **kwargs): + +class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArg( + BaseObject +): + _fields_to_json_mapping: Dict[str, str] = { + 'field_key': 'fieldKey', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'fieldKey': 'field_key', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + op: str, + field_key: str, + data: UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArgDataField, + **kwargs + ): """ :param op: `addEnumOption` :type op: str @@ -89,10 +132,27 @@ def __init__(self, op: str, field_key: str, data: UpdateMetadataTemplateEnterpri self.field_key = field_key self.data = data -class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArgDataFieldClassificationField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'classification_definition': 'classificationDefinition', 'color_id': 'colorID', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'classificationDefinition': 'classification_definition', 'colorID': 'color_id', **BaseObject._json_to_fields_mapping} - def __init__(self, classification_definition: Optional[str] = None, color_id: Optional[int] = None, **kwargs): + +class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArgDataFieldClassificationField( + BaseObject +): + _fields_to_json_mapping: Dict[str, str] = { + 'classification_definition': 'classificationDefinition', + 'color_id': 'colorID', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'classificationDefinition': 'classification_definition', + 'colorID': 'color_id', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + classification_definition: Optional[str] = None, + color_id: Optional[int] = None, + **kwargs + ): """ :param classification_definition: A longer description of the classification. :type classification_definition: Optional[str], optional @@ -115,8 +175,18 @@ def __init__(self, classification_definition: Optional[str] = None, color_id: Op self.classification_definition = classification_definition self.color_id = color_id -class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArgDataField(BaseObject): - def __init__(self, key: str, classification: Optional[UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArgDataFieldClassificationField] = None, **kwargs): + +class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArgDataField( + BaseObject +): + def __init__( + self, + key: str, + classification: Optional[ + UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArgDataFieldClassificationField + ] = None, + **kwargs + ): """ :param key: A new label for the classification, as it will be shown in the web and mobile interfaces. @@ -128,10 +198,29 @@ def __init__(self, key: str, classification: Optional[UpdateMetadataTemplateEnte self.key = key self.classification = classification -class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArg(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'field_key': 'fieldKey', 'enum_option_key': 'enumOptionKey', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'fieldKey': 'field_key', 'enumOptionKey': 'enum_option_key', **BaseObject._json_to_fields_mapping} - def __init__(self, op: str, field_key: str, enum_option_key: str, data: UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArgDataField, **kwargs): + +class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArg( + BaseObject +): + _fields_to_json_mapping: Dict[str, str] = { + 'field_key': 'fieldKey', + 'enum_option_key': 'enumOptionKey', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'fieldKey': 'field_key', + 'enumOptionKey': 'enum_option_key', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + op: str, + field_key: str, + enum_option_key: str, + data: UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArgDataField, + **kwargs + ): """ :param op: `editEnumOption` :type op: str @@ -148,9 +237,21 @@ def __init__(self, op: str, field_key: str, enum_option_key: str, data: UpdateMe self.enum_option_key = enum_option_key self.data = data -class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaDeleteRequestBodyArg(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'field_key': 'fieldKey', 'enum_option_key': 'enumOptionKey', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'fieldKey': 'field_key', 'enumOptionKey': 'enum_option_key', **BaseObject._json_to_fields_mapping} + +class UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaDeleteRequestBodyArg( + BaseObject +): + _fields_to_json_mapping: Dict[str, str] = { + 'field_key': 'fieldKey', + 'enum_option_key': 'enumOptionKey', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'fieldKey': 'field_key', + 'enumOptionKey': 'enum_option_key', + **BaseObject._json_to_fields_mapping, + } + def __init__(self, op: str, field_key: str, enum_option_key: str, **kwargs): """ :param op: `removeEnumOption` @@ -165,28 +266,51 @@ def __init__(self, op: str, field_key: str, enum_option_key: str, **kwargs): self.field_key = field_key self.enum_option_key = enum_option_key + class CreateMetadataTemplateSchemaClassificationScopeArg(str, Enum): ENTERPRISE = 'enterprise' + class CreateMetadataTemplateSchemaClassificationTemplateKeyArg(str, Enum): SECURITYCLASSIFICATION_6VMVOCHWUWO = 'securityClassification-6VMVochwUWo' + class CreateMetadataTemplateSchemaClassificationDisplayNameArg(str, Enum): CLASSIFICATION = 'Classification' + class CreateMetadataTemplateSchemaClassificationFieldsArgTypeField(str, Enum): ENUM = 'enum' + class CreateMetadataTemplateSchemaClassificationFieldsArgKeyField(str, Enum): BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key' + class CreateMetadataTemplateSchemaClassificationFieldsArgDisplayNameField(str, Enum): CLASSIFICATION = 'Classification' -class CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigFieldClassificationField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'classification_definition': 'classificationDefinition', 'color_id': 'colorID', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'classificationDefinition': 'classification_definition', 'colorID': 'color_id', **BaseObject._json_to_fields_mapping} - def __init__(self, classification_definition: Optional[str] = None, color_id: Optional[int] = None, **kwargs): + +class CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigFieldClassificationField( + BaseObject +): + _fields_to_json_mapping: Dict[str, str] = { + 'classification_definition': 'classificationDefinition', + 'color_id': 'colorID', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'classificationDefinition': 'classification_definition', + 'colorID': 'color_id', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + classification_definition: Optional[str] = None, + color_id: Optional[int] = None, + **kwargs + ): """ :param classification_definition: A longer description of the classification. :type classification_definition: Optional[str], optional @@ -209,8 +333,17 @@ def __init__(self, classification_definition: Optional[str] = None, color_id: Op self.classification_definition = classification_definition self.color_id = color_id -class CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigField(BaseObject): - def __init__(self, classification: Optional[CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigFieldClassificationField] = None, **kwargs): + +class CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigField( + BaseObject +): + def __init__( + self, + classification: Optional[ + CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigFieldClassificationField + ] = None, + **kwargs + ): """ :param classification: Additional information about the classification. :type classification: Optional[CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigFieldClassificationField], optional @@ -218,10 +351,25 @@ def __init__(self, classification: Optional[CreateMetadataTemplateSchemaClassifi super().__init__(**kwargs) self.classification = classification + class CreateMetadataTemplateSchemaClassificationFieldsArgOptionsField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'static_config': 'staticConfig', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'staticConfig': 'static_config', **BaseObject._json_to_fields_mapping} - def __init__(self, key: Optional[str] = None, static_config: Optional[CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigField] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'static_config': 'staticConfig', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'staticConfig': 'static_config', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + key: Optional[str] = None, + static_config: Optional[ + CreateMetadataTemplateSchemaClassificationFieldsArgOptionsFieldStaticConfigField + ] = None, + **kwargs + ): """ :param key: The display name and key this classification. This will be show in the Box UI. @@ -233,10 +381,34 @@ def __init__(self, key: Optional[str] = None, static_config: Optional[CreateMeta self.key = key self.static_config = static_config + class CreateMetadataTemplateSchemaClassificationFieldsArg(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'display_name': 'displayName', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'displayName': 'display_name', **BaseObject._json_to_fields_mapping} - def __init__(self, type: Optional[CreateMetadataTemplateSchemaClassificationFieldsArgTypeField] = None, key: Optional[CreateMetadataTemplateSchemaClassificationFieldsArgKeyField] = None, display_name: Optional[CreateMetadataTemplateSchemaClassificationFieldsArgDisplayNameField] = None, hidden: Optional[bool] = None, options: Optional[List[CreateMetadataTemplateSchemaClassificationFieldsArgOptionsField]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'display_name': 'displayName', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'displayName': 'display_name', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + type: Optional[ + CreateMetadataTemplateSchemaClassificationFieldsArgTypeField + ] = None, + key: Optional[ + CreateMetadataTemplateSchemaClassificationFieldsArgKeyField + ] = None, + display_name: Optional[ + CreateMetadataTemplateSchemaClassificationFieldsArgDisplayNameField + ] = None, + hidden: Optional[bool] = None, + options: Optional[ + List[CreateMetadataTemplateSchemaClassificationFieldsArgOptionsField] + ] = None, + **kwargs + ): """ :param type: `enum` :type type: Optional[CreateMetadataTemplateSchemaClassificationFieldsArgTypeField], optional @@ -257,23 +429,31 @@ def __init__(self, type: Optional[CreateMetadataTemplateSchemaClassificationFiel self.hidden = hidden self.options = options + class ClassificationsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_metadata_template_enterprise_security_classification_schema(self, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ClassificationTemplate: + + def get_metadata_template_enterprise_security_classification_schema( + self, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> ClassificationTemplate: """ Retrieves the classification metadata template and lists all the - + classifications available to this enterprise. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`. :param extra_headers: Extra headers that will be included in the HTTP request. @@ -282,12 +462,28 @@ def get_metadata_template_enterprise_security_classification_schema(self, extra_ if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema' + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ClassificationTemplate.from_dict(json.loads(response.text)) - def delete_metadata_template_enterprise_security_classification_schema(self, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_metadata_template_enterprise_security_classification_schema( + self, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Delete all classifications by deleting the classification - + metadata template. :param extra_headers: Extra headers that will be included in the HTTP request. @@ -296,21 +492,41 @@ def delete_metadata_template_enterprise_security_classification_schema(self, ext if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema' + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def update_metadata_template_enterprise_security_classification_schema_add(self, request_body: List[UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ClassificationTemplate: + + def update_metadata_template_enterprise_security_classification_schema_add( + self, + request_body: List[ + UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaAddRequestBodyArg + ], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ClassificationTemplate: """ Adds one or more new classifications to the list of classifications - + available to the enterprise. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`. :param request_body: Request body of updateMetadataTemplateEnterpriseSecurityClassificationSchemaAdd method @@ -321,21 +537,43 @@ def update_metadata_template_enterprise_security_classification_schema_add(self, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#add']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#add' + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ClassificationTemplate.from_dict(json.loads(response.text)) - def update_metadata_template_enterprise_security_classification_schema_update(self, request_body: List[UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ClassificationTemplate: + + def update_metadata_template_enterprise_security_classification_schema_update( + self, + request_body: List[ + UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdateRequestBodyArg + ], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ClassificationTemplate: """ Updates the labels and descriptions of one or more classifications - + available to the enterprise. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`. :param request_body: Request body of updateMetadataTemplateEnterpriseSecurityClassificationSchemaUpdate method @@ -346,21 +584,43 @@ def update_metadata_template_enterprise_security_classification_schema_update(se if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#update']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#update' + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ClassificationTemplate.from_dict(json.loads(response.text)) - def update_metadata_template_enterprise_security_classification_schema_delete(self, request_body: List[UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaDeleteRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ClassificationTemplate: + + def update_metadata_template_enterprise_security_classification_schema_delete( + self, + request_body: List[ + UpdateMetadataTemplateEnterpriseSecurityClassificationSchemaDeleteRequestBodyArg + ], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ClassificationTemplate: """ Removes a classification from the list of classifications - + available to the enterprise. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`. :param request_body: Request body of updateMetadataTemplateEnterpriseSecurityClassificationSchemaDelete method @@ -371,24 +631,53 @@ def update_metadata_template_enterprise_security_classification_schema_delete(se if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#delete']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#delete' + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ClassificationTemplate.from_dict(json.loads(response.text)) - def create_metadata_template_schema_classification(self, scope: CreateMetadataTemplateSchemaClassificationScopeArg, display_name: CreateMetadataTemplateSchemaClassificationDisplayNameArg, template_key: Optional[CreateMetadataTemplateSchemaClassificationTemplateKeyArg] = None, hidden: Optional[bool] = None, copy_instance_on_item_copy: Optional[bool] = None, fields: Optional[List[CreateMetadataTemplateSchemaClassificationFieldsArg]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ClassificationTemplate: + + def create_metadata_template_schema_classification( + self, + scope: CreateMetadataTemplateSchemaClassificationScopeArg, + display_name: CreateMetadataTemplateSchemaClassificationDisplayNameArg, + template_key: Optional[ + CreateMetadataTemplateSchemaClassificationTemplateKeyArg + ] = None, + hidden: Optional[bool] = None, + copy_instance_on_item_copy: Optional[bool] = None, + fields: Optional[ + List[CreateMetadataTemplateSchemaClassificationFieldsArg] + ] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ClassificationTemplate: """ When an enterprise does not yet have any classifications, this API call - + initializes the classification template with an initial set of - + classifications. - + If an enterprise already has a classification, the template will already - + exist and instead an API call should be made to add additional - + classifications. :param scope: The scope in which to create the classifications. This should @@ -411,7 +700,27 @@ def create_metadata_template_schema_classification(self, scope: CreateMetadataTe """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(scope=scope, templateKey=template_key, displayName=display_name, hidden=hidden, copyInstanceOnItemCopy=copy_instance_on_item_copy, fields=fields) + request_body = BaseObject( + scope=scope, + templateKey=template_key, + displayName=display_name, + hidden=hidden, + copyInstanceOnItemCopy=copy_instance_on_item_copy, + fields=fields, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/schema#classifications']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return ClassificationTemplate.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/metadata_templates/schema#classifications'] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ClassificationTemplate.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/collaboration_allowlist_entries.py b/box_sdk_gen/managers/collaboration_allowlist_entries.py index 984386cc..57151a32 100644 --- a/box_sdk_gen/managers/collaboration_allowlist_entries.py +++ b/box_sdk_gen/managers/collaboration_allowlist_entries.py @@ -30,19 +30,31 @@ from box_sdk_gen.fetch import FetchResponse + class CreateCollaborationWhitelistEntryDirectionArg(str, Enum): INBOUND = 'inbound' OUTBOUND = 'outbound' BOTH = 'both' + class CollaborationAllowlistEntriesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_collaboration_whitelist_entries(self, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> CollaborationAllowlistEntries: + + def get_collaboration_whitelist_entries( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> CollaborationAllowlistEntries: """ Returns the list domains that have been deemed safe to create collaborations - + for within the current enterprise. :param marker: Defines the position marker at which to begin returning results. This is @@ -56,14 +68,32 @@ def get_collaboration_whitelist_entries(self, marker: Optional[str] = None, limi """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaboration_whitelist_entries']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaboration_whitelist_entries']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return CollaborationAllowlistEntries.from_dict(json.loads(response.text)) - def create_collaboration_whitelist_entry(self, domain: str, direction: CreateCollaborationWhitelistEntryDirectionArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> CollaborationAllowlistEntry: + + def create_collaboration_whitelist_entry( + self, + domain: str, + direction: CreateCollaborationWhitelistEntryDirectionArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> CollaborationAllowlistEntry: """ Creates a new entry in the list of allowed domains to allow - + collaboration for. :param domain: The domain to add to the list of allowed domains. @@ -75,14 +105,30 @@ def create_collaboration_whitelist_entry(self, domain: str, direction: CreateCol """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(domain=domain, direction=direction) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaboration_whitelist_entries']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return CollaborationAllowlistEntry.from_dict(json.loads(response.text)) - def get_collaboration_whitelist_entry_by_id(self, collaboration_whitelist_entry_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> CollaborationAllowlistEntry: + + def get_collaboration_whitelist_entry_by_id( + self, + collaboration_whitelist_entry_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> CollaborationAllowlistEntry: """ Returns a domain that has been deemed safe to create collaborations - + for within the current enterprise. :param collaboration_whitelist_entry_id: The ID of the entry in the list. @@ -94,12 +140,31 @@ def get_collaboration_whitelist_entry_by_id(self, collaboration_whitelist_entry_ if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaboration_whitelist_entries/', collaboration_whitelist_entry_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/collaboration_whitelist_entries/', + collaboration_whitelist_entry_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return CollaborationAllowlistEntry.from_dict(json.loads(response.text)) - def delete_collaboration_whitelist_entry_by_id(self, collaboration_whitelist_entry_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_collaboration_whitelist_entry_by_id( + self, + collaboration_whitelist_entry_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Removes a domain from the list of domains that have been deemed safe to create - + collaborations for within the current enterprise. :param collaboration_whitelist_entry_id: The ID of the entry in the list. @@ -111,5 +176,19 @@ def delete_collaboration_whitelist_entry_by_id(self, collaboration_whitelist_ent if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaboration_whitelist_entries/', collaboration_whitelist_entry_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/collaboration_whitelist_entries/', + collaboration_whitelist_entry_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py b/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py index 58ebe568..1ec96413 100644 --- a/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py +++ b/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py @@ -30,6 +30,7 @@ from box_sdk_gen.fetch import FetchResponse + class CreateCollaborationWhitelistExemptTargetUserArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -39,14 +40,25 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class CollaborationAllowlistExemptTargetsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_collaboration_whitelist_exempt_targets(self, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> CollaborationAllowlistExemptTargets: + + def get_collaboration_whitelist_exempt_targets( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> CollaborationAllowlistExemptTargets: """ Returns a list of users who have been exempt from the collaboration - + domain restrictions. :param marker: Defines the position marker at which to begin returning results. This is @@ -60,14 +72,31 @@ def get_collaboration_whitelist_exempt_targets(self, marker: Optional[str] = Non """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaboration_whitelist_exempt_targets']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaboration_whitelist_exempt_targets']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return CollaborationAllowlistExemptTargets.from_dict(json.loads(response.text)) - def create_collaboration_whitelist_exempt_target(self, user: CreateCollaborationWhitelistExemptTargetUserArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> CollaborationAllowlistExemptTarget: + + def create_collaboration_whitelist_exempt_target( + self, + user: CreateCollaborationWhitelistExemptTargetUserArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> CollaborationAllowlistExemptTarget: """ Exempts a user from the restrictions set out by the allowed list of domains - + for collaborations. :param user: The user to exempt. @@ -77,14 +106,30 @@ def create_collaboration_whitelist_exempt_target(self, user: CreateCollaboration """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(user=user) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaboration_whitelist_exempt_targets']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return CollaborationAllowlistExemptTarget.from_dict(json.loads(response.text)) - def get_collaboration_whitelist_exempt_target_by_id(self, collaboration_whitelist_exempt_target_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> CollaborationAllowlistExemptTarget: + + def get_collaboration_whitelist_exempt_target_by_id( + self, + collaboration_whitelist_exempt_target_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> CollaborationAllowlistExemptTarget: """ Returns a users who has been exempt from the collaboration - + domain restrictions. :param collaboration_whitelist_exempt_target_id: The ID of the exemption to the list. @@ -96,12 +141,31 @@ def get_collaboration_whitelist_exempt_target_by_id(self, collaboration_whitelis if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaboration_whitelist_exempt_targets/', collaboration_whitelist_exempt_target_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/collaboration_whitelist_exempt_targets/', + collaboration_whitelist_exempt_target_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return CollaborationAllowlistExemptTarget.from_dict(json.loads(response.text)) - def delete_collaboration_whitelist_exempt_target_by_id(self, collaboration_whitelist_exempt_target_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_collaboration_whitelist_exempt_target_by_id( + self, + collaboration_whitelist_exempt_target_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Removes a user's exemption from the restrictions set out by the allowed list - + of domains for collaborations. :param collaboration_whitelist_exempt_target_id: The ID of the exemption to the list. @@ -113,5 +177,19 @@ def delete_collaboration_whitelist_exempt_target_by_id(self, collaboration_white if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaboration_whitelist_exempt_targets/', collaboration_whitelist_exempt_target_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/collaboration_whitelist_exempt_targets/', + collaboration_whitelist_exempt_target_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/collections.py b/box_sdk_gen/managers/collections.py index 62a1f5e4..f212aafc 100644 --- a/box_sdk_gen/managers/collections.py +++ b/box_sdk_gen/managers/collections.py @@ -26,17 +26,29 @@ from box_sdk_gen.fetch import FetchResponse + class CollectionsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_collections(self, fields: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Collections: + + def get_collections( + self, + fields: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Collections: """ Retrieves all collections for a given user. - + Currently, only the `favorites` collection - + is supported. :param fields: A comma-separated list of attributes to include in the @@ -60,14 +72,38 @@ def get_collections(self, fields: Optional[str] = None, offset: Optional[int] = """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'offset': to_string(offset), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'offset': to_string(offset), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collections']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collections']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Collections.from_dict(json.loads(response.text)) - def get_collection_items(self, collection_id: str, fields: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Items: + + def get_collection_items( + self, + collection_id: str, + fields: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Items: """ Retrieves the files and/or folders contained within - + this collection. :param collection_id: The ID of the collection. @@ -94,7 +130,23 @@ def get_collection_items(self, collection_id: str, fields: Optional[str] = None, """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'offset': to_string(offset), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'offset': to_string(offset), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collections/', collection_id, '/items']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return Items.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collections/', collection_id, '/items']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return Items.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/comments.py b/box_sdk_gen/managers/comments.py index eba452b1..ee722549 100644 --- a/box_sdk_gen/managers/comments.py +++ b/box_sdk_gen/managers/comments.py @@ -34,10 +34,12 @@ from box_sdk_gen.fetch import FetchResponse + class CreateCommentItemArgTypeField(str, Enum): FILE = 'file' COMMENT = 'comment' + class CreateCommentItemArg(BaseObject): def __init__(self, id: str, type: CreateCommentItemArgTypeField, **kwargs): """ @@ -50,11 +52,24 @@ def __init__(self, id: str, type: CreateCommentItemArgTypeField, **kwargs): self.id = id self.type = type + class CommentsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_comments(self, file_id: str, fields: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Comments: + + def get_file_comments( + self, + file_id: str, + fields: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Comments: """ Retrieves a list of comments for a file. :param file_id: The unique identifier that represents a file. @@ -86,14 +101,36 @@ def get_file_comments(self, file_id: str, fields: Optional[str] = None, limit: O """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'limit': to_string(limit), 'offset': to_string(offset)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'limit': to_string(limit), + 'offset': to_string(offset), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/comments']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/comments']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Comments.from_dict(json.loads(response.text)) - def get_comment_by_id(self, comment_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> CommentFull: + + def get_comment_by_id( + self, + comment_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> CommentFull: """ Retrieves the message and metadata for a specific comment, as well - + as information on the user who created the comment. :param comment_id: The ID of the comment. @@ -115,9 +152,26 @@ def get_comment_by_id(self, comment_id: str, fields: Optional[str] = None, extra extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/comments/', comment_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/comments/', comment_id]), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return CommentFull.from_dict(json.loads(response.text)) - def update_comment_by_id(self, comment_id: str, message: Optional[str] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> CommentFull: + + def update_comment_by_id( + self, + comment_id: str, + message: Optional[str] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> CommentFull: """ Update the message of a comment. :param comment_id: The ID of the comment. @@ -139,12 +193,27 @@ def update_comment_by_id(self, comment_id: str, message: Optional[str] = None, f """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(message=message) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/comments/', comment_id]), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/comments/', comment_id]), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return CommentFull.from_dict(json.loads(response.text)) - def delete_comment_by_id(self, comment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_comment_by_id( + self, comment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Permanently deletes a comment. :param comment_id: The ID of the comment. @@ -156,12 +225,29 @@ def delete_comment_by_id(self, comment_id: str, extra_headers: Optional[Dict[str if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/comments/', comment_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/comments/', comment_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_comment(self, message: str, item: CreateCommentItemArg, tagged_message: Optional[str] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Comment: + + def create_comment( + self, + message: str, + item: CreateCommentItemArg, + tagged_message: Optional[str] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Comment: """ Adds a comment by the user to a specific file, or - + as a reply to an other comment. :param message: The text of the comment. @@ -194,8 +280,22 @@ def create_comment(self, message: str, item: CreateCommentItemArg, tagged_messag """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(message=message, tagged_message=tagged_message, item=item) + request_body = BaseObject( + message=message, tagged_message=tagged_message, item=item + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/comments']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return Comment.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/comments']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return Comment.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/device_pinners.py b/box_sdk_gen/managers/device_pinners.py index f3161f06..96837493 100644 --- a/box_sdk_gen/managers/device_pinners.py +++ b/box_sdk_gen/managers/device_pinners.py @@ -28,15 +28,26 @@ from box_sdk_gen.fetch import FetchResponse + class GetEnterpriseDevicePinnersDirectionArg(str, Enum): ASC = 'ASC' DESC = 'DESC' + class DevicePinnersManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_device_pinner_by_id(self, device_pinner_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> DevicePinner: + + def get_device_pinner_by_id( + self, + device_pinner_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> DevicePinner: """ Retrieves information about an individual device pin. :param device_pinner_id: The ID of the device pin @@ -48,9 +59,23 @@ def get_device_pinner_by_id(self, device_pinner_id: str, extra_headers: Optional if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/device_pinners/', device_pinner_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/device_pinners/', device_pinner_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return DevicePinner.from_dict(json.loads(response.text)) - def delete_device_pinner_by_id(self, device_pinner_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_device_pinner_by_id( + self, + device_pinner_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes an individual device pin. :param device_pinner_id: The ID of the device pin @@ -62,15 +87,32 @@ def delete_device_pinner_by_id(self, device_pinner_id: str, extra_headers: Optio if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/device_pinners/', device_pinner_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/device_pinners/', device_pinner_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_enterprise_device_pinners(self, enterprise_id: str, marker: Optional[str] = None, limit: Optional[int] = None, direction: Optional[GetEnterpriseDevicePinnersDirectionArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> DevicePinners: + + def get_enterprise_device_pinners( + self, + enterprise_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + direction: Optional[GetEnterpriseDevicePinnersDirectionArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> DevicePinners: """ Retrieves all the device pins within an enterprise. - + The user must have admin privileges, and the application - + needs the "manage enterprise" scope to make this call. :param enterprise_id: The ID of the enterprise @@ -90,7 +132,29 @@ def get_enterprise_device_pinners(self, enterprise_id: str, marker: Optional[str """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit), 'direction': to_string(direction)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'marker': to_string(marker), + 'limit': to_string(limit), + 'direction': to_string(direction), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/enterprises/', enterprise_id, '/device_pinners']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return DevicePinners.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/enterprises/', + enterprise_id, + '/device_pinners', + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return DevicePinners.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/downloads.py b/box_sdk_gen/managers/downloads.py index a8b9c934..4990d187 100644 --- a/box_sdk_gen/managers/downloads.py +++ b/box_sdk_gen/managers/downloads.py @@ -20,11 +20,25 @@ from box_sdk_gen.fetch import FetchResponse + class DownloadsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def download_file(self, file_id: str, version: Optional[str] = None, access_token: Optional[str] = None, range: Optional[str] = None, boxapi: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ByteStream: + + def download_file( + self, + file_id: str, + version: Optional[str] = None, + access_token: Optional[str] = None, + range: Optional[str] = None, + boxapi: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ByteStream: """ Returns the contents of a file in binary format. :param file_id: The unique identifier that represents a file. @@ -57,7 +71,21 @@ def download_file(self, file_id: str, version: Optional[str] = None, access_toke """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'version': to_string(version), 'access_token': to_string(access_token)}) - headers_map: Dict[str, str] = prepare_params({'range': to_string(range), 'boxapi': to_string(boxapi), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/content']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='binary', auth=self.auth, network_session=self.network_session)) - return response.content \ No newline at end of file + query_params_map: Dict[str, str] = prepare_params( + {'version': to_string(version), 'access_token': to_string(access_token)} + ) + headers_map: Dict[str, str] = prepare_params( + {'range': to_string(range), 'boxapi': to_string(boxapi), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/content']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='binary', + auth=self.auth, + network_session=self.network_session, + ), + ) + return response.content diff --git a/box_sdk_gen/managers/email_aliases.py b/box_sdk_gen/managers/email_aliases.py index 5a40e8d8..23d523f2 100644 --- a/box_sdk_gen/managers/email_aliases.py +++ b/box_sdk_gen/managers/email_aliases.py @@ -28,14 +28,22 @@ from box_sdk_gen.fetch import FetchResponse + class EmailAliasesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_user_email_aliases(self, user_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> EmailAliases: + + def get_user_email_aliases( + self, user_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> EmailAliases: """ Retrieves all email aliases for a user. The collection - + does not include the primary login for the user. :param user_id: The ID of the user. @@ -47,9 +55,24 @@ def get_user_email_aliases(self, user_id: str, extra_headers: Optional[Dict[str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/email_aliases']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id, '/email_aliases']), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return EmailAliases.from_dict(json.loads(response.text)) - def create_user_email_alias(self, user_id: str, email: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> EmailAlias: + + def create_user_email_alias( + self, + user_id: str, + email: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> EmailAlias: """ Adds a new email alias to a user account.. :param user_id: The ID of the user. @@ -67,11 +90,28 @@ def create_user_email_alias(self, user_id: str, email: str, extra_headers: Optio """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(email=email) + request_body = BaseObject(email=email) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/email_aliases']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id, '/email_aliases']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return EmailAlias.from_dict(json.loads(response.text)) - def delete_user_email_alias_by_id(self, user_id: str, email_alias_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_user_email_alias_by_id( + self, + user_id: str, + email_alias_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Removes an email alias from a user. :param user_id: The ID of the user. @@ -86,5 +126,21 @@ def delete_user_email_alias_by_id(self, user_id: str, email_alias_id: str, extra if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/email_aliases/', email_alias_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/users/', + user_id, + '/email_aliases/', + email_alias_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/events.py b/box_sdk_gen/managers/events.py index c4e1b3d1..165b2b8d 100644 --- a/box_sdk_gen/managers/events.py +++ b/box_sdk_gen/managers/events.py @@ -28,6 +28,7 @@ from box_sdk_gen.fetch import FetchResponse + class GetEventsStreamTypeArg(str, Enum): ALL = 'all' CHANGES = 'changes' @@ -35,32 +36,47 @@ class GetEventsStreamTypeArg(str, Enum): ADMIN_LOGS = 'admin_logs' ADMIN_LOGS_STREAMING = 'admin_logs_streaming' + class EventsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_events(self, stream_type: Optional[GetEventsStreamTypeArg] = None, stream_position: Optional[str] = None, limit: Optional[int] = None, event_type: Optional[str] = None, created_after: Optional[str] = None, created_before: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Events: + + def get_events( + self, + stream_type: Optional[GetEventsStreamTypeArg] = None, + stream_position: Optional[str] = None, + limit: Optional[int] = None, + event_type: Optional[str] = None, + created_after: Optional[str] = None, + created_before: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Events: """ Returns up to a year of past events for a given user - + or for the entire enterprise. - + By default this returns events for the authenticated user. To retrieve events - + for the entire enterprise, set the `stream_type` to `admin_logs_streaming` - + for live monitoring of new events, or `admin_logs` for querying across - + historical events. The user making the API call will - + need to have admin privileges, and the application will need to have the - + scope `manage enterprise properties` checked. :param stream_type: Defines the type of events that are returned @@ -112,83 +128,105 @@ def get_events(self, stream_type: Optional[GetEventsStreamTypeArg] = None, strea """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'stream_type': to_string(stream_type), 'stream_position': to_string(stream_position), 'limit': to_string(limit), 'event_type': to_string(event_type), 'created_after': to_string(created_after), 'created_before': to_string(created_before)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'stream_type': to_string(stream_type), + 'stream_position': to_string(stream_position), + 'limit': to_string(limit), + 'event_type': to_string(event_type), + 'created_after': to_string(created_after), + 'created_before': to_string(created_before), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/events']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/events']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Events.from_dict(json.loads(response.text)) - def get_events_with_long_polling(self, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RealtimeServers: + + def get_events_with_long_polling( + self, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> RealtimeServers: """ Returns a list of real-time servers that can be used for long-polling updates - + to the [event stream](#get-events). - + Long polling is the concept where a HTTP request is kept open until the - + server sends a response, then repeating the process over and over to receive - + updated responses. - + Long polling the event stream can only be used for user events, not for - + enterprise events. - + To use long polling, first use this endpoint to retrieve a list of long poll - + URLs. Next, make a long poll request to any of the provided URLs. - + When an event occurs in monitored account a response with the value - + `new_change` will be sent. The response contains no other details as - + it only serves as a prompt to take further action such as sending a - + request to the [events endpoint](#get-events) with the last known - + `stream_position`. - + After the server sends this response it closes the connection. You must now - + repeat the long poll process to begin listening for events again. - + If no events occur for a while and the connection times out you will - + receive a response with the value `reconnect`. When you receive this response - + you’ll make another call to this endpoint to restart the process. - + If you receive no events in `retry_timeout` seconds then you will need to - + make another request to the real-time server (one of the URLs in the response - + for this endpoint). This might be necessary due to network errors. - + Finally, if you receive a `max_retries` error when making a request to the - + real-time server, you should start over by making a call to this endpoint - + first. :param extra_headers: Extra headers that will be included in the HTTP request. @@ -197,5 +235,14 @@ def get_events_with_long_polling(self, extra_headers: Optional[Dict[str, Optiona if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/events']), FetchOptions(method='OPTIONS', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return RealtimeServers.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/events']), + FetchOptions( + method='OPTIONS', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return RealtimeServers.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/file_classifications.py b/box_sdk_gen/managers/file_classifications.py index 210397e0..a74878ef 100644 --- a/box_sdk_gen/managers/file_classifications.py +++ b/box_sdk_gen/managers/file_classifications.py @@ -32,14 +32,31 @@ from box_sdk_gen.fetch import FetchResponse -class UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgOpField(str, Enum): + +class UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgOpField( + str, Enum +): REPLACE = 'replace' -class UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgPathField(str, Enum): + +class UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgPathField( + str, Enum +): _BOX__SECURITY__CLASSIFICATION__KEY = '/Box__Security__Classification__Key' + class UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArg(BaseObject): - def __init__(self, op: Optional[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgOpField] = None, path: Optional[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgPathField] = None, value: Optional[str] = None, **kwargs): + def __init__( + self, + op: Optional[ + UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgOpField + ] = None, + path: Optional[ + UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgPathField + ] = None, + value: Optional[str] = None, + **kwargs + ): """ :param op: `replace` :type op: Optional[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgOpField], optional @@ -57,23 +74,31 @@ def __init__(self, op: Optional[UpdateFileMetadataEnterpriseSecurityClassificati self.path = path self.value = value + class FileClassificationsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Classification: + + def get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Classification: """ Retrieves the classification metadata instance that - + has been applied to a file. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`. :param file_id: The unique identifier that represents a file. @@ -90,21 +115,42 @@ def get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo(self, f if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/enterprise/securityClassification-6VMVochwUWo']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/enterprise/securityClassification-6VMVochwUWo', + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Classification.from_dict(json.loads(response.text)) - def create_file_metadata_enterprise_security_classification(self, file_id: str, box_security_classification_key: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Classification: + + def create_file_metadata_enterprise_security_classification( + self, + file_id: str, + box_security_classification_key: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Classification: """ Adds a classification to a file by specifying the label of the - + classification to add. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`. :param file_id: The unique identifier that represents a file. @@ -126,20 +172,47 @@ def create_file_metadata_enterprise_security_classification(self, file_id: str, """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(Box__Security__Classification__Key=box_security_classification_key) + request_body = BaseObject( + Box__Security__Classification__Key=box_security_classification_key + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/enterprise/securityClassification-6VMVochwUWo']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/enterprise/securityClassification-6VMVochwUWo', + ] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Classification.from_dict(json.loads(response.text)) - def update_file_metadata_enterprise_security_classification(self, file_id: str, request_body: List[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Classification: + + def update_file_metadata_enterprise_security_classification( + self, + file_id: str, + request_body: List[ + UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArg + ], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Classification: """ Updates a classification on a file. - + The classification can only be updated if a classification has already been - + applied to the file before. When editing classifications, only values are - + defined for the enterprise will be accepted. :param file_id: The unique identifier that represents a file. @@ -158,18 +231,38 @@ def update_file_metadata_enterprise_security_classification(self, file_id: str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/enterprise/securityClassification-6VMVochwUWo']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/enterprise/securityClassification-6VMVochwUWo', + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Classification.from_dict(json.loads(response.text)) - def delete_file_metadata_enterprise_security_classification(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_metadata_enterprise_security_classification( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Removes any classifications from a file. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`. :param file_id: The unique identifier that represents a file. @@ -186,5 +279,20 @@ def delete_file_metadata_enterprise_security_classification(self, file_id: str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/enterprise/securityClassification-6VMVochwUWo']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/enterprise/securityClassification-6VMVochwUWo', + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/file_metadata.py b/box_sdk_gen/managers/file_metadata.py index 03704c5a..4e1cffba 100644 --- a/box_sdk_gen/managers/file_metadata.py +++ b/box_sdk_gen/managers/file_metadata.py @@ -34,21 +34,26 @@ from box_sdk_gen.fetch import FetchResponse + class GetFileMetadataByIdScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class CreateFileMetadataByIdScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class CreateFileMetadataByIdRequestBodyArg(BaseObject): pass + class UpdateFileMetadataByIdScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class UpdateFileMetadataByIdRequestBodyArgOpField(str, Enum): ADD = 'add' REPLACE = 'replace' @@ -57,10 +62,25 @@ class UpdateFileMetadataByIdRequestBodyArgOpField(str, Enum): MOVE = 'move' COPY = 'copy' + class UpdateFileMetadataByIdRequestBodyArg(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'from_': 'from', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'from': 'from_', **BaseObject._json_to_fields_mapping} - def __init__(self, op: Optional[UpdateFileMetadataByIdRequestBodyArgOpField] = None, path: Optional[str] = None, value: Optional[str] = None, from_: Optional[str] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'from_': 'from', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'from': 'from_', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + op: Optional[UpdateFileMetadataByIdRequestBodyArgOpField] = None, + path: Optional[str] = None, + value: Optional[str] = None, + from_: Optional[str] = None, + **kwargs + ): """ :param op: The type of change to perform on the template. Some of these are hazardous as they will change existing templates. @@ -91,15 +111,24 @@ def __init__(self, op: Optional[UpdateFileMetadataByIdRequestBodyArgOpField] = N self.value = value self.from_ = from_ + class DeleteFileMetadataByIdScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class FileMetadataManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_metadata(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Metadatas: + + def get_file_metadata( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Metadatas: """ Retrieves all metadata for a given file. :param file_id: The unique identifier that represents a file. @@ -116,12 +145,28 @@ def get_file_metadata(self, file_id: str, extra_headers: Optional[Dict[str, Opti if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/metadata']), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Metadatas.from_dict(json.loads(response.text)) - def get_file_metadata_by_id(self, file_id: str, scope: GetFileMetadataByIdScopeArg, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataFull: + + def get_file_metadata_by_id( + self, + file_id: str, + scope: GetFileMetadataByIdScopeArg, + template_key: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataFull: """ Retrieves the instance of a metadata template that has been applied to a - + file. :param file_id: The unique identifier that represents a file. @@ -144,18 +189,44 @@ def get_file_metadata_by_id(self, file_id: str, scope: GetFileMetadataByIdScopeA if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/', scope, '/', template_key]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/', + scope, + '/', + template_key, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataFull.from_dict(json.loads(response.text)) - def create_file_metadata_by_id(self, file_id: str, scope: CreateFileMetadataByIdScopeArg, template_key: str, request_body: CreateFileMetadataByIdRequestBodyArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Metadata: + + def create_file_metadata_by_id( + self, + file_id: str, + scope: CreateFileMetadataByIdScopeArg, + template_key: str, + request_body: CreateFileMetadataByIdRequestBodyArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Metadata: """ Applies an instance of a metadata template to a file. - + In most cases only values that are present in the metadata template - + will be accepted, except for the `global.properties` template which accepts - + any key-value pair. :param file_id: The unique identifier that represents a file. @@ -180,24 +251,52 @@ def create_file_metadata_by_id(self, file_id: str, scope: CreateFileMetadataById if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/', scope, '/', template_key]), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/', + scope, + '/', + template_key, + ] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Metadata.from_dict(json.loads(response.text)) - def update_file_metadata_by_id(self, file_id: str, scope: UpdateFileMetadataByIdScopeArg, template_key: str, request_body: List[UpdateFileMetadataByIdRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Metadata: + + def update_file_metadata_by_id( + self, + file_id: str, + scope: UpdateFileMetadataByIdScopeArg, + template_key: str, + request_body: List[UpdateFileMetadataByIdRequestBodyArg], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Metadata: """ Updates a piece of metadata on a file. - + The metadata instance can only be updated if the template has already been - + applied to the file before. When editing metadata, only values that match - + the metadata template schema will be accepted. - + The update is applied atomically. If any errors occur during the - + application of the operations, the metadata instance will not be changed. :param file_id: The unique identifier that represents a file. @@ -222,9 +321,36 @@ def update_file_metadata_by_id(self, file_id: str, scope: UpdateFileMetadataById if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/', scope, '/', template_key]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/', + scope, + '/', + template_key, + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Metadata.from_dict(json.loads(response.text)) - def delete_file_metadata_by_id(self, file_id: str, scope: DeleteFileMetadataByIdScopeArg, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_metadata_by_id( + self, + file_id: str, + scope: DeleteFileMetadataByIdScopeArg, + template_key: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a piece of file metadata. :param file_id: The unique identifier that represents a file. @@ -247,5 +373,23 @@ def delete_file_metadata_by_id(self, file_id: str, scope: DeleteFileMetadataById if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/', scope, '/', template_key]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/', + scope, + '/', + template_key, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/file_requests.py b/box_sdk_gen/managers/file_requests.py index 3f5d4bf4..ed2e2046 100644 --- a/box_sdk_gen/managers/file_requests.py +++ b/box_sdk_gen/managers/file_requests.py @@ -32,15 +32,23 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateFileRequestByIdStatusArg(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' + class CreateFileRequestCopyFolderArgTypeField(str, Enum): FOLDER = 'folder' + class CreateFileRequestCopyFolderArg(BaseObject): - def __init__(self, id: str, type: Optional[CreateFileRequestCopyFolderArgTypeField] = None, **kwargs): + def __init__( + self, + id: str, + type: Optional[CreateFileRequestCopyFolderArgTypeField] = None, + **kwargs + ): """ :param id: The ID of the folder to associate the new file request to. @@ -52,15 +60,26 @@ def __init__(self, id: str, type: Optional[CreateFileRequestCopyFolderArgTypeFie self.id = id self.type = type + class CreateFileRequestCopyStatusArg(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' + class FileRequestsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_request_by_id(self, file_request_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileRequest: + + def get_file_request_by_id( + self, + file_request_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileRequest: """ Retrieves the information about a file request. :param file_request_id: The unique identifier that represent a file request. @@ -77,12 +96,33 @@ def get_file_request_by_id(self, file_request_id: str, extra_headers: Optional[D if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/file_requests/', file_request_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/file_requests/', file_request_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileRequest.from_dict(json.loads(response.text)) - def update_file_request_by_id(self, file_request_id: str, title: Optional[str] = None, description: Optional[str] = None, status: Optional[UpdateFileRequestByIdStatusArg] = None, is_email_required: Optional[bool] = None, is_description_required: Optional[bool] = None, expires_at: Optional[str] = None, if_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileRequest: + + def update_file_request_by_id( + self, + file_request_id: str, + title: Optional[str] = None, + description: Optional[str] = None, + status: Optional[UpdateFileRequestByIdStatusArg] = None, + is_email_required: Optional[bool] = None, + is_description_required: Optional[bool] = None, + expires_at: Optional[str] = None, + if_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileRequest: """ Updates a file request. This can be used to activate or - + deactivate a file request. :param file_request_id: The unique identifier that represent a file request. @@ -138,11 +178,36 @@ def update_file_request_by_id(self, file_request_id: str, title: Optional[str] = """ if extra_headers is None: extra_headers = {} - request_body: FileRequestUpdateRequest = FileRequestUpdateRequest(title=title, description=description, status=status, is_email_required=is_email_required, is_description_required=is_description_required, expires_at=expires_at) - headers_map: Dict[str, str] = prepare_params({'if-match': to_string(if_match), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/file_requests/', file_request_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + request_body = FileRequestUpdateRequest( + title=title, + description=description, + status=status, + is_email_required=is_email_required, + is_description_required=is_description_required, + expires_at=expires_at, + ) + headers_map: Dict[str, str] = prepare_params( + {'if-match': to_string(if_match), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/file_requests/', file_request_id]), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileRequest.from_dict(json.loads(response.text)) - def delete_file_request_by_id(self, file_request_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_request_by_id( + self, + file_request_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a file request permanently. :param file_request_id: The unique identifier that represent a file request. @@ -159,12 +224,33 @@ def delete_file_request_by_id(self, file_request_id: str, extra_headers: Optiona if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/file_requests/', file_request_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/file_requests/', file_request_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_file_request_copy(self, file_request_id: str, folder: CreateFileRequestCopyFolderArg, title: Optional[str] = None, description: Optional[str] = None, status: Optional[CreateFileRequestCopyStatusArg] = None, is_email_required: Optional[bool] = None, is_description_required: Optional[bool] = None, expires_at: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileRequest: + + def create_file_request_copy( + self, + file_request_id: str, + folder: CreateFileRequestCopyFolderArg, + title: Optional[str] = None, + description: Optional[str] = None, + status: Optional[CreateFileRequestCopyStatusArg] = None, + is_email_required: Optional[bool] = None, + is_description_required: Optional[bool] = None, + expires_at: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileRequest: """ Copies an existing file request that is already present on one folder, - + and applies it to another folder. :param file_request_id: The unique identifier that represent a file request. @@ -215,7 +301,28 @@ def create_file_request_copy(self, file_request_id: str, folder: CreateFileReque """ if extra_headers is None: extra_headers = {} - request_body: FileRequestCopyRequest = FileRequestCopyRequest(folder=folder, title=title, description=description, status=status, is_email_required=is_email_required, is_description_required=is_description_required, expires_at=expires_at) + request_body = FileRequestCopyRequest( + folder=folder, + title=title, + description=description, + status=status, + is_email_required=is_email_required, + is_description_required=is_description_required, + expires_at=expires_at, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/file_requests/', file_request_id, '/copy']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return FileRequest.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/file_requests/', file_request_id, '/copy'] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FileRequest.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/file_version_legal_holds.py b/box_sdk_gen/managers/file_version_legal_holds.py index a0067abf..c93607d0 100644 --- a/box_sdk_gen/managers/file_version_legal_holds.py +++ b/box_sdk_gen/managers/file_version_legal_holds.py @@ -26,14 +26,24 @@ from box_sdk_gen.fetch import FetchResponse + class FileVersionLegalHoldsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_version_legal_hold_by_id(self, file_version_legal_hold_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionLegalHold: + + def get_file_version_legal_hold_by_id( + self, + file_version_legal_hold_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionLegalHold: """ Retrieves information about the legal hold policies - + assigned to a file version. :param file_version_legal_hold_id: The ID of the file version legal hold @@ -45,51 +55,72 @@ def get_file_version_legal_hold_by_id(self, file_version_legal_hold_id: str, ext if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/file_version_legal_holds/', file_version_legal_hold_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/file_version_legal_holds/', + file_version_legal_hold_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileVersionLegalHold.from_dict(json.loads(response.text)) - def get_file_version_legal_holds(self, policy_id: str, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionLegalHolds: + + def get_file_version_legal_holds( + self, + policy_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionLegalHolds: """ Get a list of file versions on legal hold for a legal hold - + assignment. - + Due to ongoing re-architecture efforts this API might not return all file - + versions for this policy ID. - + Instead, this API will only return file versions held in the legacy - + architecture. Two new endpoints will available to request any file versions - + held in the new architecture. - + For file versions held in the new architecture, the `GET - + /legal_hold_policy_assignments/:id/file_versions_on_hold` API can be used to - + return all past file versions available for this policy assignment, and the - + `GET /legal_hold_policy_assignments/:id/files_on_hold` API can be used to - + return any current (latest) versions of a file under legal hold. - + The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to - + find a list of policy assignments for a given policy ID. - + Once the re-architecture is completed this API will be deprecated. :param policy_id: The ID of the legal hold policy to get the file version legal @@ -106,7 +137,23 @@ def get_file_version_legal_holds(self, policy_id: str, marker: Optional[str] = N """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'policy_id': to_string(policy_id), 'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'policy_id': to_string(policy_id), + 'marker': to_string(marker), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/file_version_legal_holds']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return FileVersionLegalHolds.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/file_version_legal_holds']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FileVersionLegalHolds.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/file_version_retentions.py b/box_sdk_gen/managers/file_version_retentions.py index d90bc250..614d4d54 100644 --- a/box_sdk_gen/managers/file_version_retentions.py +++ b/box_sdk_gen/managers/file_version_retentions.py @@ -28,15 +28,35 @@ from box_sdk_gen.fetch import FetchResponse + class GetFileVersionRetentionsDispositionActionArg(str, Enum): PERMANENTLY_DELETE = 'permanently_delete' REMOVE_RETENTION = 'remove_retention' + class FileVersionRetentionsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_version_retentions(self, file_id: Optional[str] = None, file_version_id: Optional[str] = None, policy_id: Optional[str] = None, disposition_action: Optional[GetFileVersionRetentionsDispositionActionArg] = None, disposition_before: Optional[str] = None, disposition_after: Optional[str] = None, limit: Optional[int] = None, marker: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionRetentions: + + def get_file_version_retentions( + self, + file_id: Optional[str] = None, + file_version_id: Optional[str] = None, + policy_id: Optional[str] = None, + disposition_action: Optional[ + GetFileVersionRetentionsDispositionActionArg + ] = None, + disposition_before: Optional[str] = None, + disposition_after: Optional[str] = None, + limit: Optional[int] = None, + marker: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionRetentions: """ Retrieves all file version retentions for the given enterprise. :param file_id: Filters results by files with this ID. @@ -65,11 +85,37 @@ def get_file_version_retentions(self, file_id: Optional[str] = None, file_versio """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'file_id': to_string(file_id), 'file_version_id': to_string(file_version_id), 'policy_id': to_string(policy_id), 'disposition_action': to_string(disposition_action), 'disposition_before': to_string(disposition_before), 'disposition_after': to_string(disposition_after), 'limit': to_string(limit), 'marker': to_string(marker)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'file_id': to_string(file_id), + 'file_version_id': to_string(file_version_id), + 'policy_id': to_string(policy_id), + 'disposition_action': to_string(disposition_action), + 'disposition_before': to_string(disposition_before), + 'disposition_after': to_string(disposition_after), + 'limit': to_string(limit), + 'marker': to_string(marker), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/file_version_retentions']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/file_version_retentions']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileVersionRetentions.from_dict(json.loads(response.text)) - def get_file_version_retention_by_id(self, file_version_retention_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionRetention: + + def get_file_version_retention_by_id( + self, + file_version_retention_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionRetention: """ Returns information about a file version retention. :param file_version_retention_id: The ID of the file version retention @@ -81,5 +127,19 @@ def get_file_version_retention_by_id(self, file_version_retention_id: str, extra if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/file_version_retentions/', file_version_retention_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return FileVersionRetention.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/file_version_retentions/', + file_version_retention_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FileVersionRetention.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/file_versions.py b/box_sdk_gen/managers/file_versions.py index cda1ef29..e0348ede 100644 --- a/box_sdk_gen/managers/file_versions.py +++ b/box_sdk_gen/managers/file_versions.py @@ -30,20 +30,34 @@ from box_sdk_gen.fetch import FetchResponse + class PromoteFileVersionTypeArg(str, Enum): FILE_VERSION = 'file_version' + class FileVersionsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_versions(self, file_id: str, fields: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersions: + + def get_file_versions( + self, + file_id: str, + fields: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersions: """ Retrieve a list of the past versions for a file. - + Versions are only tracked by Box users with premium accounts. To fetch the ID - + of the current version of a file, use the `GET /file/:id` API. :param file_id: The unique identifier that represents a file. @@ -75,14 +89,37 @@ def get_file_versions(self, file_id: str, fields: Optional[str] = None, limit: O """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'limit': to_string(limit), 'offset': to_string(offset)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'limit': to_string(limit), + 'offset': to_string(offset), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/versions']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/versions']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileVersions.from_dict(json.loads(response.text)) - def get_file_version_by_id(self, file_id: str, file_version_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionFull: + + def get_file_version_by_id( + self, + file_id: str, + file_version_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionFull: """ Retrieve a specific version of a file. - + Versions are only tracked for Box users with premium accounts. :param file_id: The unique identifier that represents a file. @@ -112,18 +149,42 @@ def get_file_version_by_id(self, file_id: str, file_version_id: str, fields: Opt extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/versions/', file_version_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/versions/', + file_version_id, + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileVersionFull.from_dict(json.loads(response.text)) - def update_file_version_by_id(self, file_id: str, file_version_id: str, trashed_at: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionFull: + + def update_file_version_by_id( + self, + file_id: str, + file_version_id: str, + trashed_at: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionFull: """ Restores a specific version of a file after it was deleted. - + Don't use this endpoint to restore Box Notes, - + as it works with file formats such as PDF, DOC, - + PPTX or similar. :param file_id: The unique identifier that represents a file. @@ -145,14 +206,39 @@ def update_file_version_by_id(self, file_id: str, file_version_id: str, trashed_ """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(trashed_at=trashed_at) + request_body = BaseObject(trashed_at=trashed_at) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/versions/', file_version_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/versions/', + file_version_id, + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileVersionFull.from_dict(json.loads(response.text)) - def delete_file_version_by_id(self, file_id: str, file_version_id: str, if_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_version_by_id( + self, + file_id: str, + file_version_id: str, + if_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Move a file version to the trash. - + Versions are only tracked for Box users with premium accounts. :param file_id: The unique identifier that represents a file. @@ -178,43 +264,69 @@ def delete_file_version_by_id(self, file_id: str, file_version_id: str, if_match """ if extra_headers is None: extra_headers = {} - headers_map: Dict[str, str] = prepare_params({'if-match': to_string(if_match), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/versions/', file_version_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + {'if-match': to_string(if_match), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/versions/', + file_version_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def promote_file_version(self, file_id: str, id: Optional[str] = None, type: Optional[PromoteFileVersionTypeArg] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionFull: + + def promote_file_version( + self, + file_id: str, + id: Optional[str] = None, + type: Optional[PromoteFileVersionTypeArg] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionFull: """ Promote a specific version of a file. - + If previous versions exist, this method can be used to - + promote one of the older versions to the top of the version history. - + This creates a new copy of the old version and puts it at the - + top of the versions history. The file will have the exact same contents - + as the older version, with the the same hash digest, `etag`, and - + name as the original. - + Other properties such as comments do not get updated to their - + former values. - + Don't use this endpoint to restore Box Notes, - + as it works with file formats such as PDF, DOC, - + PPTX or similar. :param file_id: The unique identifier that represents a file. @@ -243,8 +355,20 @@ def promote_file_version(self, file_id: str, id: Optional[str] = None, type: Opt """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(id=id, type=type) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/files/', file_id, '/versions/current']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return FileVersionFull.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/versions/current']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FileVersionFull.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/file_watermarks.py b/box_sdk_gen/managers/file_watermarks.py index 873b8c6c..f003de76 100644 --- a/box_sdk_gen/managers/file_watermarks.py +++ b/box_sdk_gen/managers/file_watermarks.py @@ -30,9 +30,11 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateFileWatermarkWatermarkArgImprintField(str, Enum): DEFAULT = 'default' + class UpdateFileWatermarkWatermarkArg(BaseObject): def __init__(self, imprint: UpdateFileWatermarkWatermarkArgImprintField, **kwargs): """ @@ -43,11 +45,19 @@ def __init__(self, imprint: UpdateFileWatermarkWatermarkArgImprintField, **kwarg super().__init__(**kwargs) self.imprint = imprint + class FileWatermarksManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_watermark(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Watermark: + + def get_file_watermark( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Watermark: """ Retrieve the watermark for a file. :param file_id: The unique identifier that represents a file. @@ -64,9 +74,24 @@ def get_file_watermark(self, file_id: str, extra_headers: Optional[Dict[str, Opt if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/watermark']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/watermark']), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Watermark.from_dict(json.loads(response.text)) - def update_file_watermark(self, file_id: str, watermark: UpdateFileWatermarkWatermarkArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Watermark: + + def update_file_watermark( + self, + file_id: str, + watermark: UpdateFileWatermarkWatermarkArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Watermark: """ Applies or update a watermark on a file. :param file_id: The unique identifier that represents a file. @@ -84,11 +109,25 @@ def update_file_watermark(self, file_id: str, watermark: UpdateFileWatermarkWate """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(watermark=watermark) + request_body = BaseObject(watermark=watermark) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/watermark']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/watermark']), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Watermark.from_dict(json.loads(response.text)) - def delete_file_watermark(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_watermark( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Removes the watermark from a file. :param file_id: The unique identifier that represents a file. @@ -105,5 +144,14 @@ def delete_file_watermark(self, file_id: str, extra_headers: Optional[Dict[str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/watermark']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/watermark']), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/files.py b/box_sdk_gen/managers/files.py index 20202f0b..601501c3 100644 --- a/box_sdk_gen/managers/files.py +++ b/box_sdk_gen/managers/files.py @@ -32,6 +32,7 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateFileByIdParentArg(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ @@ -41,11 +42,13 @@ def __init__(self, id: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.id = id + class UpdateFileByIdSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateFileByIdSharedLinkArgPermissionsField(BaseObject): def __init__(self, can_download: Optional[bool] = None, **kwargs): """ @@ -57,8 +60,17 @@ def __init__(self, can_download: Optional[bool] = None, **kwargs): super().__init__(**kwargs) self.can_download = can_download + class UpdateFileByIdSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateFileByIdSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[UpdateFileByIdSharedLinkArgPermissionsField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateFileByIdSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + permissions: Optional[UpdateFileByIdSharedLinkArgPermissionsField] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -95,11 +107,19 @@ def __init__(self, access: Optional[UpdateFileByIdSharedLinkArgAccessField] = No self.unshared_at = unshared_at self.permissions = permissions + class UpdateFileByIdLockArgAccessField(str, Enum): LOCK = 'lock' + class UpdateFileByIdLockArg(BaseObject): - def __init__(self, access: Optional[UpdateFileByIdLockArgAccessField] = None, expires_at: Optional[str] = None, is_download_prevented: Optional[bool] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateFileByIdLockArgAccessField] = None, + expires_at: Optional[str] = None, + is_download_prevented: Optional[bool] = None, + **kwargs + ): """ :param access: The type of this object. :type access: Optional[UpdateFileByIdLockArgAccessField], optional @@ -113,12 +133,18 @@ def __init__(self, access: Optional[UpdateFileByIdLockArgAccessField] = None, ex self.expires_at = expires_at self.is_download_prevented = is_download_prevented + class UpdateFileByIdPermissionsArgCanDownloadField(str, Enum): OPEN = 'open' COMPANY = 'company' + class UpdateFileByIdPermissionsArg(BaseObject): - def __init__(self, can_download: Optional[UpdateFileByIdPermissionsArgCanDownloadField] = None, **kwargs): + def __init__( + self, + can_download: Optional[UpdateFileByIdPermissionsArgCanDownloadField] = None, + **kwargs + ): """ :param can_download: Defines who is allowed to download this file. The possible values are either `open` for everyone or `company` for @@ -132,6 +158,7 @@ def __init__(self, can_download: Optional[UpdateFileByIdPermissionsArgCanDownloa super().__init__(**kwargs) self.can_download = can_download + class UpdateFileByIdCollectionsArg(BaseObject): def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwargs): """ @@ -144,6 +171,7 @@ def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwarg self.id = id self.type = type + class CopyFileParentArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -153,15 +181,30 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class GetFileThumbnailByIdExtensionArg(str, Enum): PNG = 'png' JPG = 'jpg' + class FilesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_by_id(self, file_id: str, fields: Optional[str] = None, if_none_match: Optional[str] = None, boxapi: Optional[str] = None, x_rep_hints: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileFull: + + def get_file_by_id( + self, + file_id: str, + fields: Optional[str] = None, + if_none_match: Optional[str] = None, + boxapi: Optional[str] = None, + x_rep_hints: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileFull: """ Retrieves the details about a file. :param file_id: The unique identifier that represents a file. @@ -220,13 +263,46 @@ def get_file_by_id(self, file_id: str, fields: Optional[str] = None, if_none_mat if extra_headers is None: extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) - headers_map: Dict[str, str] = prepare_params({'if-none-match': to_string(if_none_match), 'boxapi': to_string(boxapi), 'x-rep-hints': to_string(x_rep_hints), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + { + 'if-none-match': to_string(if_none_match), + 'boxapi': to_string(boxapi), + 'x-rep-hints': to_string(x_rep_hints), + **extra_headers, + } + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id]), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileFull.from_dict(json.loads(response.text)) - def update_file_by_id(self, file_id: str, name: Optional[str] = None, description: Optional[str] = None, parent: Optional[UpdateFileByIdParentArg] = None, shared_link: Optional[UpdateFileByIdSharedLinkArg] = None, lock: Optional[UpdateFileByIdLockArg] = None, disposition_at: Optional[str] = None, permissions: Optional[UpdateFileByIdPermissionsArg] = None, collections: Optional[List[UpdateFileByIdCollectionsArg]] = None, tags: Optional[List[str]] = None, fields: Optional[str] = None, if_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileFull: + + def update_file_by_id( + self, + file_id: str, + name: Optional[str] = None, + description: Optional[str] = None, + parent: Optional[UpdateFileByIdParentArg] = None, + shared_link: Optional[UpdateFileByIdSharedLinkArg] = None, + lock: Optional[UpdateFileByIdLockArg] = None, + disposition_at: Optional[str] = None, + permissions: Optional[UpdateFileByIdPermissionsArg] = None, + collections: Optional[List[UpdateFileByIdCollectionsArg]] = None, + tags: Optional[List[str]] = None, + fields: Optional[str] = None, + if_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileFull: """ Updates a file. This can be used to rename or move a file, - + create a shared link, or lock a file. :param file_id: The unique identifier that represents a file. @@ -292,21 +368,51 @@ def update_file_by_id(self, file_id: str, name: Optional[str] = None, descriptio """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, description=description, parent=parent, shared_link=shared_link, lock=lock, disposition_at=disposition_at, permissions=permissions, collections=collections, tags=tags) + request_body = BaseObject( + name=name, + description=description, + parent=parent, + shared_link=shared_link, + lock=lock, + disposition_at=disposition_at, + permissions=permissions, + collections=collections, + tags=tags, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) - headers_map: Dict[str, str] = prepare_params({'if-match': to_string(if_match), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id]), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + {'if-match': to_string(if_match), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id]), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileFull.from_dict(json.loads(response.text)) - def delete_file_by_id(self, file_id: str, if_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_by_id( + self, + file_id: str, + if_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a file, either permanently or by moving it to - + the trash. - + The the enterprise settings determine whether the item will - + be permanently deleted from Box or moved to the trash. :param file_id: The unique identifier that represents a file. @@ -329,10 +435,30 @@ def delete_file_by_id(self, file_id: str, if_match: Optional[str] = None, extra_ """ if extra_headers is None: extra_headers = {} - headers_map: Dict[str, str] = prepare_params({'if-match': to_string(if_match), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + {'if-match': to_string(if_match), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def copy_file(self, file_id: str, parent: CopyFileParentArg, name: Optional[str] = None, version: Optional[str] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileFull: + + def copy_file( + self, + file_id: str, + parent: CopyFileParentArg, + name: Optional[str] = None, + version: Optional[str] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileFull: """ Creates a copy of a file. :param file_id: The unique identifier that represents a file. @@ -368,30 +494,52 @@ def copy_file(self, file_id: str, parent: CopyFileParentArg, name: Optional[str] """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, version=version, parent=parent) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/files/', file_id, '/copy']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/copy']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileFull.from_dict(json.loads(response.text)) - def get_file_thumbnail_by_id(self, file_id: str, extension: GetFileThumbnailByIdExtensionArg, min_height: Optional[int] = None, min_width: Optional[int] = None, max_height: Optional[int] = None, max_width: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ByteStream: + + def get_file_thumbnail_by_id( + self, + file_id: str, + extension: GetFileThumbnailByIdExtensionArg, + min_height: Optional[int] = None, + min_width: Optional[int] = None, + max_height: Optional[int] = None, + max_width: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ByteStream: """ Retrieves a thumbnail, or smaller image representation, of a file. - + Sizes of `32x32`,`64x64`, `128x128`, and `256x256` can be returned in - + the `.png` format and sizes of `32x32`, `160x160`, and `320x320` - + can be returned in the `.jpg` format. - + Thumbnails can be generated for the image and video file formats listed - + [found on our community site][1]. - + [1]: https://community.box.com/t5/Migrating-and-Previewing-Content/File-Types-and-Fonts-Supported-in-Box-Content-Preview/ta-p/327 :param file_id: The unique identifier that represents a file. @@ -418,7 +566,26 @@ def get_file_thumbnail_by_id(self, file_id: str, extension: GetFileThumbnailById """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'min_height': to_string(min_height), 'min_width': to_string(min_width), 'max_height': to_string(max_height), 'max_width': to_string(max_width)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'min_height': to_string(min_height), + 'min_width': to_string(min_width), + 'max_height': to_string(max_height), + 'max_width': to_string(max_width), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/thumbnail.', extension]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='binary', auth=self.auth, network_session=self.network_session)) - return response.content \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/files/', file_id, '/thumbnail.', extension] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='binary', + auth=self.auth, + network_session=self.network_session, + ), + ) + return response.content diff --git a/box_sdk_gen/managers/folder_classifications.py b/box_sdk_gen/managers/folder_classifications.py index de1f5ebe..8892638a 100644 --- a/box_sdk_gen/managers/folder_classifications.py +++ b/box_sdk_gen/managers/folder_classifications.py @@ -32,14 +32,31 @@ from box_sdk_gen.fetch import FetchResponse -class UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgOpField(str, Enum): + +class UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgOpField( + str, Enum +): REPLACE = 'replace' -class UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgPathField(str, Enum): + +class UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgPathField( + str, Enum +): _BOX__SECURITY__CLASSIFICATION__KEY = '/Box__Security__Classification__Key' + class UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArg(BaseObject): - def __init__(self, op: Optional[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgOpField] = None, path: Optional[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgPathField] = None, value: Optional[str] = None, **kwargs): + def __init__( + self, + op: Optional[ + UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgOpField + ] = None, + path: Optional[ + UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgPathField + ] = None, + value: Optional[str] = None, + **kwargs + ): """ :param op: `replace` :type op: Optional[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgOpField], optional @@ -57,23 +74,31 @@ def __init__(self, op: Optional[UpdateFolderMetadataEnterpriseSecurityClassifica self.path = path self.value = value + class FolderClassificationsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo(self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Classification: + + def get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo( + self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Classification: """ Retrieves the classification metadata instance that - + has been applied to a folder. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/folders/:id//enterprise_12345/securityClassification-6VMVochwUWo`. :param folder_id: The unique identifier that represent a folder. @@ -92,21 +117,42 @@ def get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo(self, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata/enterprise/securityClassification-6VMVochwUWo']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/folders/', + folder_id, + '/metadata/enterprise/securityClassification-6VMVochwUWo', + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Classification.from_dict(json.loads(response.text)) - def create_folder_metadata_enterprise_security_classification(self, folder_id: str, box_security_classification_key: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Classification: + + def create_folder_metadata_enterprise_security_classification( + self, + folder_id: str, + box_security_classification_key: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Classification: """ Adds a classification to a folder by specifying the label of the - + classification to add. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/folders/:id//enterprise_12345/securityClassification-6VMVochwUWo`. :param folder_id: The unique identifier that represent a folder. @@ -130,20 +176,47 @@ def create_folder_metadata_enterprise_security_classification(self, folder_id: s """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(Box__Security__Classification__Key=box_security_classification_key) + request_body = BaseObject( + Box__Security__Classification__Key=box_security_classification_key + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata/enterprise/securityClassification-6VMVochwUWo']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/folders/', + folder_id, + '/metadata/enterprise/securityClassification-6VMVochwUWo', + ] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Classification.from_dict(json.loads(response.text)) - def update_folder_metadata_enterprise_security_classification(self, folder_id: str, request_body: List[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Classification: + + def update_folder_metadata_enterprise_security_classification( + self, + folder_id: str, + request_body: List[ + UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArg + ], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Classification: """ Updates a classification on a folder. - + The classification can only be updated if a classification has already been - + applied to the folder before. When editing classifications, only values are - + defined for the enterprise will be accepted. :param folder_id: The unique identifier that represent a folder. @@ -164,18 +237,38 @@ def update_folder_metadata_enterprise_security_classification(self, folder_id: s if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata/enterprise/securityClassification-6VMVochwUWo']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/folders/', + folder_id, + '/metadata/enterprise/securityClassification-6VMVochwUWo', + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Classification.from_dict(json.loads(response.text)) - def delete_folder_metadata_enterprise_security_classification(self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_folder_metadata_enterprise_security_classification( + self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Removes any classifications from a folder. - + This API can also be called by including the enterprise ID in the - + URL explicitly, for example - + `/folders/:id//enterprise_12345/securityClassification-6VMVochwUWo`. :param folder_id: The unique identifier that represent a folder. @@ -194,5 +287,20 @@ def delete_folder_metadata_enterprise_security_classification(self, folder_id: s if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata/enterprise/securityClassification-6VMVochwUWo']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/folders/', + folder_id, + '/metadata/enterprise/securityClassification-6VMVochwUWo', + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/folder_locks.py b/box_sdk_gen/managers/folder_locks.py index b5a353de..8ddf8848 100644 --- a/box_sdk_gen/managers/folder_locks.py +++ b/box_sdk_gen/managers/folder_locks.py @@ -30,6 +30,7 @@ from box_sdk_gen.fetch import FetchResponse + class CreateFolderLockLockedOperationsArg(BaseObject): def __init__(self, move: bool, delete: bool, **kwargs): """ @@ -42,6 +43,7 @@ def __init__(self, move: bool, delete: bool, **kwargs): self.move = move self.delete = delete + class CreateFolderLockFolderArg(BaseObject): def __init__(self, type: str, id: str, **kwargs): """ @@ -55,17 +57,25 @@ def __init__(self, type: str, id: str, **kwargs): self.type = type self.id = id + class FolderLocksManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_folder_locks(self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderLocks: + + def get_folder_locks( + self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> FolderLocks: """ Retrieves folder lock details for a given folder. - + You must be authenticated as the owner or co-owner of the folder to - + use this endpoint. :param folder_id: The unique identifier that represent a folder. @@ -82,20 +92,38 @@ def get_folder_locks(self, folder_id: str, extra_headers: Optional[Dict[str, Opt """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'folder_id': to_string(folder_id)}) + query_params_map: Dict[str, str] = prepare_params( + {'folder_id': to_string(folder_id)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folder_locks']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folder_locks']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderLocks.from_dict(json.loads(response.text)) - def create_folder_lock(self, folder: CreateFolderLockFolderArg, locked_operations: Optional[CreateFolderLockLockedOperationsArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderLock: + + def create_folder_lock( + self, + folder: CreateFolderLockFolderArg, + locked_operations: Optional[CreateFolderLockLockedOperationsArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderLock: """ Creates a folder lock on a folder, preventing it from being moved and/or - + deleted. - + You must be authenticated as the owner or co-owner of the folder to - + use this endpoint. :param folder: The folder to apply the lock to. @@ -109,17 +137,33 @@ def create_folder_lock(self, folder: CreateFolderLockFolderArg, locked_operation """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(locked_operations=locked_operations, folder=folder) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folder_locks']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderLock.from_dict(json.loads(response.text)) - def delete_folder_lock_by_id(self, folder_lock_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_folder_lock_by_id( + self, + folder_lock_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a folder lock on a given folder. - + You must be authenticated as the owner or co-owner of the folder to - + use this endpoint. :param folder_lock_id: The ID of the folder lock. @@ -131,5 +175,14 @@ def delete_folder_lock_by_id(self, folder_lock_id: str, extra_headers: Optional[ if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folder_locks/', folder_lock_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folder_locks/', folder_lock_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/folder_metadata.py b/box_sdk_gen/managers/folder_metadata.py index bae99099..a17efc35 100644 --- a/box_sdk_gen/managers/folder_metadata.py +++ b/box_sdk_gen/managers/folder_metadata.py @@ -32,21 +32,26 @@ from box_sdk_gen.fetch import FetchResponse + class GetFolderMetadataByIdScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class CreateFolderMetadataByIdScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class CreateFolderMetadataByIdRequestBodyArg(BaseObject): pass + class UpdateFolderMetadataByIdScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class UpdateFolderMetadataByIdRequestBodyArgOpField(str, Enum): ADD = 'add' REPLACE = 'replace' @@ -55,10 +60,25 @@ class UpdateFolderMetadataByIdRequestBodyArgOpField(str, Enum): MOVE = 'move' COPY = 'copy' + class UpdateFolderMetadataByIdRequestBodyArg(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'from_': 'from', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'from': 'from_', **BaseObject._json_to_fields_mapping} - def __init__(self, op: Optional[UpdateFolderMetadataByIdRequestBodyArgOpField] = None, path: Optional[str] = None, value: Optional[str] = None, from_: Optional[str] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'from_': 'from', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'from': 'from_', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + op: Optional[UpdateFolderMetadataByIdRequestBodyArgOpField] = None, + path: Optional[str] = None, + value: Optional[str] = None, + from_: Optional[str] = None, + **kwargs + ): """ :param op: The type of change to perform on the template. Some of these are hazardous as they will change existing templates. @@ -89,18 +109,27 @@ def __init__(self, op: Optional[UpdateFolderMetadataByIdRequestBodyArgOpField] = self.value = value self.from_ = from_ + class DeleteFolderMetadataByIdScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class FolderMetadataManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_folder_metadata(self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Metadatas: + + def get_folder_metadata( + self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Metadatas: """ Retrieves all metadata for a given folder. This can not be used on the root - + folder with ID `0`. :param folder_id: The unique identifier that represent a folder. @@ -119,12 +148,28 @@ def get_folder_metadata(self, folder_id: str, extra_headers: Optional[Dict[str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata']), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Metadatas.from_dict(json.loads(response.text)) - def get_folder_metadata_by_id(self, folder_id: str, scope: GetFolderMetadataByIdScopeArg, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Metadata: + + def get_folder_metadata_by_id( + self, + folder_id: str, + scope: GetFolderMetadataByIdScopeArg, + template_key: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Metadata: """ Retrieves the instance of a metadata template that has been applied to a - + folder. This can not be used on the root folder with ID `0`. :param folder_id: The unique identifier that represent a folder. @@ -149,27 +194,53 @@ def get_folder_metadata_by_id(self, folder_id: str, scope: GetFolderMetadataById if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata/', scope, '/', template_key]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/folders/', + folder_id, + '/metadata/', + scope, + '/', + template_key, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Metadata.from_dict(json.loads(response.text)) - def create_folder_metadata_by_id(self, folder_id: str, scope: CreateFolderMetadataByIdScopeArg, template_key: str, request_body: CreateFolderMetadataByIdRequestBodyArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Metadata: + + def create_folder_metadata_by_id( + self, + folder_id: str, + scope: CreateFolderMetadataByIdScopeArg, + template_key: str, + request_body: CreateFolderMetadataByIdRequestBodyArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Metadata: """ Applies an instance of a metadata template to a folder. - + In most cases only values that are present in the metadata template - + will be accepted, except for the `global.properties` template which accepts - + any key-value pair. - + To display the metadata template in the Box web app the enterprise needs to be - + configured to enable **Cascading Folder Level Metadata** for the user in the - + admin console. :param folder_id: The unique identifier that represent a folder. @@ -196,24 +267,52 @@ def create_folder_metadata_by_id(self, folder_id: str, scope: CreateFolderMetada if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata/', scope, '/', template_key]), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/folders/', + folder_id, + '/metadata/', + scope, + '/', + template_key, + ] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Metadata.from_dict(json.loads(response.text)) - def update_folder_metadata_by_id(self, folder_id: str, scope: UpdateFolderMetadataByIdScopeArg, template_key: str, request_body: List[UpdateFolderMetadataByIdRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Metadata: + + def update_folder_metadata_by_id( + self, + folder_id: str, + scope: UpdateFolderMetadataByIdScopeArg, + template_key: str, + request_body: List[UpdateFolderMetadataByIdRequestBodyArg], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Metadata: """ Updates a piece of metadata on a folder. - + The metadata instance can only be updated if the template has already been - + applied to the folder before. When editing metadata, only values that match - + the metadata template schema will be accepted. - + The update is applied atomically. If any errors occur during the - + application of the operations, the metadata instance will not be changed. :param folder_id: The unique identifier that represent a folder. @@ -240,9 +339,36 @@ def update_folder_metadata_by_id(self, folder_id: str, scope: UpdateFolderMetada if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata/', scope, '/', template_key]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/folders/', + folder_id, + '/metadata/', + scope, + '/', + template_key, + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Metadata.from_dict(json.loads(response.text)) - def delete_folder_metadata_by_id(self, folder_id: str, scope: DeleteFolderMetadataByIdScopeArg, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_folder_metadata_by_id( + self, + folder_id: str, + scope: DeleteFolderMetadataByIdScopeArg, + template_key: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a piece of folder metadata. :param folder_id: The unique identifier that represent a folder. @@ -267,5 +393,23 @@ def delete_folder_metadata_by_id(self, folder_id: str, scope: DeleteFolderMetada if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/metadata/', scope, '/', template_key]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/folders/', + folder_id, + '/metadata/', + scope, + '/', + template_key, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/folder_watermarks.py b/box_sdk_gen/managers/folder_watermarks.py index 960c6264..ec70f968 100644 --- a/box_sdk_gen/managers/folder_watermarks.py +++ b/box_sdk_gen/managers/folder_watermarks.py @@ -30,11 +30,15 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateFolderWatermarkWatermarkArgImprintField(str, Enum): DEFAULT = 'default' + class UpdateFolderWatermarkWatermarkArg(BaseObject): - def __init__(self, imprint: UpdateFolderWatermarkWatermarkArgImprintField, **kwargs): + def __init__( + self, imprint: UpdateFolderWatermarkWatermarkArgImprintField, **kwargs + ): """ :param imprint: The type of watermark to apply. Currently only supports one option. @@ -43,11 +47,19 @@ def __init__(self, imprint: UpdateFolderWatermarkWatermarkArgImprintField, **kwa super().__init__(**kwargs) self.imprint = imprint + class FolderWatermarksManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_folder_watermark(self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Watermark: + + def get_folder_watermark( + self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Watermark: """ Retrieve the watermark for a folder. :param folder_id: The unique identifier that represent a folder. @@ -66,9 +78,24 @@ def get_folder_watermark(self, folder_id: str, extra_headers: Optional[Dict[str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/watermark']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/watermark']), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Watermark.from_dict(json.loads(response.text)) - def update_folder_watermark(self, folder_id: str, watermark: UpdateFolderWatermarkWatermarkArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Watermark: + + def update_folder_watermark( + self, + folder_id: str, + watermark: UpdateFolderWatermarkWatermarkArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Watermark: """ Applies or update a watermark on a folder. :param folder_id: The unique identifier that represent a folder. @@ -88,11 +115,25 @@ def update_folder_watermark(self, folder_id: str, watermark: UpdateFolderWaterma """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(watermark=watermark) + request_body = BaseObject(watermark=watermark) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/watermark']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/watermark']), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Watermark.from_dict(json.loads(response.text)) - def delete_folder_watermark(self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_folder_watermark( + self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Removes the watermark from a folder. :param folder_id: The unique identifier that represent a folder. @@ -111,5 +152,14 @@ def delete_folder_watermark(self, folder_id: str, extra_headers: Optional[Dict[s if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/watermark']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/watermark']), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/folders.py b/box_sdk_gen/managers/folders.py index 6f5cd189..88c209f4 100644 --- a/box_sdk_gen/managers/folders.py +++ b/box_sdk_gen/managers/folders.py @@ -34,21 +34,25 @@ from box_sdk_gen.fetch import FetchResponse + class GetFolderByIdSortArg(str, Enum): ID = 'id' NAME = 'name' DATE = 'date' SIZE = 'size' + class GetFolderByIdDirectionArg(str, Enum): ASC = 'ASC' DESC = 'DESC' + class UpdateFolderByIdSyncStateArg(str, Enum): SYNCED = 'synced' NOT_SYNCED = 'not_synced' PARTIALLY_SYNCED = 'partially_synced' + class UpdateFolderByIdParentArg(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ @@ -58,11 +62,13 @@ def __init__(self, id: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.id = id + class UpdateFolderByIdSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateFolderByIdSharedLinkArgPermissionsField(BaseObject): def __init__(self, can_download: Optional[bool] = None, **kwargs): """ @@ -74,8 +80,17 @@ def __init__(self, can_download: Optional[bool] = None, **kwargs): super().__init__(**kwargs) self.can_download = can_download + class UpdateFolderByIdSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateFolderByIdSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[UpdateFolderByIdSharedLinkArgPermissionsField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateFolderByIdSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + permissions: Optional[UpdateFolderByIdSharedLinkArgPermissionsField] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -112,12 +127,18 @@ def __init__(self, access: Optional[UpdateFolderByIdSharedLinkArgAccessField] = self.unshared_at = unshared_at self.permissions = permissions + class UpdateFolderByIdFolderUploadEmailArgAccessField(str, Enum): OPEN = 'open' COLLABORATORS = 'collaborators' + class UpdateFolderByIdFolderUploadEmailArg(BaseObject): - def __init__(self, access: Optional[UpdateFolderByIdFolderUploadEmailArgAccessField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateFolderByIdFolderUploadEmailArgAccessField] = None, + **kwargs + ): """ :param access: When this parameter has been set, users can email files to the email address that has been automatically @@ -134,6 +155,7 @@ def __init__(self, access: Optional[UpdateFolderByIdFolderUploadEmailArgAccessFi super().__init__(**kwargs) self.access = access + class UpdateFolderByIdCollectionsArg(BaseObject): def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwargs): """ @@ -146,16 +168,19 @@ def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwarg self.id = id self.type = type + class GetFolderItemsSortArg(str, Enum): ID = 'id' NAME = 'name' DATE = 'date' SIZE = 'size' + class GetFolderItemsDirectionArg(str, Enum): ASC = 'ASC' DESC = 'DESC' + class CreateFolderParentArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -165,12 +190,18 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class CreateFolderFolderUploadEmailArgAccessField(str, Enum): OPEN = 'open' COLLABORATORS = 'collaborators' + class CreateFolderFolderUploadEmailArg(BaseObject): - def __init__(self, access: Optional[CreateFolderFolderUploadEmailArgAccessField] = None, **kwargs): + def __init__( + self, + access: Optional[CreateFolderFolderUploadEmailArgAccessField] = None, + **kwargs + ): """ :param access: When this parameter has been set, users can email files to the email address that has been automatically @@ -187,11 +218,13 @@ def __init__(self, access: Optional[CreateFolderFolderUploadEmailArgAccessField] super().__init__(**kwargs) self.access = access + class CreateFolderSyncStateArg(str, Enum): SYNCED = 'synced' NOT_SYNCED = 'not_synced' PARTIALLY_SYNCED = 'partially_synced' + class CopyFolderParentArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -201,32 +234,49 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class FoldersManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_folder_by_id(self, folder_id: str, fields: Optional[str] = None, sort: Optional[GetFolderByIdSortArg] = None, direction: Optional[GetFolderByIdDirectionArg] = None, offset: Optional[int] = None, limit: Optional[int] = None, if_none_match: Optional[str] = None, boxapi: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def get_folder_by_id( + self, + folder_id: str, + fields: Optional[str] = None, + sort: Optional[GetFolderByIdSortArg] = None, + direction: Optional[GetFolderByIdDirectionArg] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + if_none_match: Optional[str] = None, + boxapi: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Retrieves details for a folder, including the first 100 entries - + in the folder. - + Passing `sort`, `direction`, `offset`, and `limit` - + parameters in query allows you to manage the - + list of returned - + [folder items](r://folder--full#param-item-collection). - + To fetch more items within the folder, use the - + [Get items in a folder](#get-folders-id-items) endpoint. :param folder_id: The unique identifier that represent a folder. @@ -305,14 +355,56 @@ def get_folder_by_id(self, folder_id: str, fields: Optional[str] = None, sort: O """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'sort': to_string(sort), 'direction': to_string(direction), 'offset': to_string(offset), 'limit': to_string(limit)}) - headers_map: Dict[str, str] = prepare_params({'if-none-match': to_string(if_none_match), 'boxapi': to_string(boxapi), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'sort': to_string(sort), + 'direction': to_string(direction), + 'offset': to_string(offset), + 'limit': to_string(limit), + } + ) + headers_map: Dict[str, str] = prepare_params( + { + 'if-none-match': to_string(if_none_match), + 'boxapi': to_string(boxapi), + **extra_headers, + } + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id]), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderFull.from_dict(json.loads(response.text)) - def update_folder_by_id(self, folder_id: str, name: Optional[str] = None, description: Optional[str] = None, sync_state: Optional[UpdateFolderByIdSyncStateArg] = None, can_non_owners_invite: Optional[bool] = None, parent: Optional[UpdateFolderByIdParentArg] = None, shared_link: Optional[UpdateFolderByIdSharedLinkArg] = None, folder_upload_email: Optional[UpdateFolderByIdFolderUploadEmailArg] = None, tags: Optional[List[str]] = None, is_collaboration_restricted_to_enterprise: Optional[bool] = None, collections: Optional[List[UpdateFolderByIdCollectionsArg]] = None, can_non_owners_view_collaborators: Optional[bool] = None, fields: Optional[str] = None, if_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def update_folder_by_id( + self, + folder_id: str, + name: Optional[str] = None, + description: Optional[str] = None, + sync_state: Optional[UpdateFolderByIdSyncStateArg] = None, + can_non_owners_invite: Optional[bool] = None, + parent: Optional[UpdateFolderByIdParentArg] = None, + shared_link: Optional[UpdateFolderByIdSharedLinkArg] = None, + folder_upload_email: Optional[UpdateFolderByIdFolderUploadEmailArg] = None, + tags: Optional[List[str]] = None, + is_collaboration_restricted_to_enterprise: Optional[bool] = None, + collections: Optional[List[UpdateFolderByIdCollectionsArg]] = None, + can_non_owners_view_collaborators: Optional[bool] = None, + fields: Optional[str] = None, + if_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Updates a folder. This can be also be used to move the folder, - + create shared links, update collaborations, and more. :param folder_id: The unique identifier that represent a folder. @@ -389,15 +481,48 @@ def update_folder_by_id(self, folder_id: str, name: Optional[str] = None, descri """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, description=description, sync_state=sync_state, can_non_owners_invite=can_non_owners_invite, parent=parent, shared_link=shared_link, folder_upload_email=folder_upload_email, tags=tags, is_collaboration_restricted_to_enterprise=is_collaboration_restricted_to_enterprise, collections=collections, can_non_owners_view_collaborators=can_non_owners_view_collaborators) + request_body = BaseObject( + name=name, + description=description, + sync_state=sync_state, + can_non_owners_invite=can_non_owners_invite, + parent=parent, + shared_link=shared_link, + folder_upload_email=folder_upload_email, + tags=tags, + is_collaboration_restricted_to_enterprise=is_collaboration_restricted_to_enterprise, + collections=collections, + can_non_owners_view_collaborators=can_non_owners_view_collaborators, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) - headers_map: Dict[str, str] = prepare_params({'if-match': to_string(if_match), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id]), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + {'if-match': to_string(if_match), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id]), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderFull.from_dict(json.loads(response.text)) - def delete_folder_by_id(self, folder_id: str, recursive: Optional[bool] = None, if_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_folder_by_id( + self, + folder_id: str, + recursive: Optional[bool] = None, + if_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a folder, either permanently or by moving it to - + the trash. :param folder_id: The unique identifier that represent a folder. @@ -425,20 +550,47 @@ def delete_folder_by_id(self, folder_id: str, recursive: Optional[bool] = None, """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'recursive': to_string(recursive)}) - headers_map: Dict[str, str] = prepare_params({'if-match': to_string(if_match), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id]), FetchOptions(method='DELETE', params=query_params_map, headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + query_params_map: Dict[str, str] = prepare_params( + {'recursive': to_string(recursive)} + ) + headers_map: Dict[str, str] = prepare_params( + {'if-match': to_string(if_match), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id]), + FetchOptions( + method='DELETE', + params=query_params_map, + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_folder_items(self, folder_id: str, fields: Optional[str] = None, usemarker: Optional[bool] = None, marker: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, sort: Optional[GetFolderItemsSortArg] = None, direction: Optional[GetFolderItemsDirectionArg] = None, boxapi: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Items: + + def get_folder_items( + self, + folder_id: str, + fields: Optional[str] = None, + usemarker: Optional[bool] = None, + marker: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + sort: Optional[GetFolderItemsSortArg] = None, + direction: Optional[GetFolderItemsDirectionArg] = None, + boxapi: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Items: """ Retrieves a page of items in a folder. These items can be files, - + folders, and web links. - + To request more information about the folder itself, like its size, - + use the [Get a folder](#get-folders-id) endpoint instead. :param folder_id: The unique identifier that represent a folder. @@ -522,11 +674,42 @@ def get_folder_items(self, folder_id: str, fields: Optional[str] = None, usemark """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'usemarker': to_string(usemarker), 'marker': to_string(marker), 'offset': to_string(offset), 'limit': to_string(limit), 'sort': to_string(sort), 'direction': to_string(direction)}) - headers_map: Dict[str, str] = prepare_params({'boxapi': to_string(boxapi), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/items']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'usemarker': to_string(usemarker), + 'marker': to_string(marker), + 'offset': to_string(offset), + 'limit': to_string(limit), + 'sort': to_string(sort), + 'direction': to_string(direction), + } + ) + headers_map: Dict[str, str] = prepare_params( + {'boxapi': to_string(boxapi), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/items']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Items.from_dict(json.loads(response.text)) - def create_folder(self, name: str, parent: CreateFolderParentArg, folder_upload_email: Optional[CreateFolderFolderUploadEmailArg] = None, sync_state: Optional[CreateFolderSyncStateArg] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def create_folder( + self, + name: str, + parent: CreateFolderParentArg, + folder_upload_email: Optional[CreateFolderFolderUploadEmailArg] = None, + sync_state: Optional[CreateFolderSyncStateArg] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Creates a new empty folder within the specified parent folder. :param name: The name for the new folder. @@ -557,15 +740,40 @@ def create_folder(self, name: str, parent: CreateFolderParentArg, folder_upload_ """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, parent=parent, folder_upload_email=folder_upload_email, sync_state=sync_state) + request_body = BaseObject( + name=name, + parent=parent, + folder_upload_email=folder_upload_email, + sync_state=sync_state, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderFull.from_dict(json.loads(response.text)) - def copy_folder(self, folder_id: str, parent: CopyFolderParentArg, name: Optional[str] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def copy_folder( + self, + folder_id: str, + parent: CopyFolderParentArg, + name: Optional[str] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Creates a copy of a folder within a destination folder. - + The original folder will not be changed. :param folder_id: The unique identifier of the folder to copy. @@ -601,8 +809,20 @@ def copy_folder(self, folder_id: str, parent: CopyFolderParentArg, name: Optiona """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, parent=parent) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/folders/', folder_id, '/copy']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return FolderFull.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/copy']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FolderFull.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/groups.py b/box_sdk_gen/managers/groups.py index 04ee3d64..3c3a4de1 100644 --- a/box_sdk_gen/managers/groups.py +++ b/box_sdk_gen/managers/groups.py @@ -32,34 +32,51 @@ from box_sdk_gen.fetch import FetchResponse + class CreateGroupInvitabilityLevelArg(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' + class CreateGroupMemberViewabilityLevelArg(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' + class UpdateGroupByIdInvitabilityLevelArg(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' + class UpdateGroupByIdMemberViewabilityLevelArg(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' + class GroupsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_groups(self, filter_term: Optional[str] = None, fields: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Groups: + + def get_groups( + self, + filter_term: Optional[str] = None, + fields: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Groups: """ Retrieves all of the groups for a given enterprise. The user - + must have admin permissions to inspect enterprise's groups. :param filter_term: Limits the results to only groups whose `name` starts @@ -86,14 +103,42 @@ def get_groups(self, filter_term: Optional[str] = None, fields: Optional[str] = """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'filter_term': to_string(filter_term), 'fields': to_string(fields), 'limit': to_string(limit), 'offset': to_string(offset)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'filter_term': to_string(filter_term), + 'fields': to_string(fields), + 'limit': to_string(limit), + 'offset': to_string(offset), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/groups']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/groups']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Groups.from_dict(json.loads(response.text)) - def create_group(self, name: str, provenance: Optional[str] = None, external_sync_identifier: Optional[str] = None, description: Optional[str] = None, invitability_level: Optional[CreateGroupInvitabilityLevelArg] = None, member_viewability_level: Optional[CreateGroupMemberViewabilityLevelArg] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Group: + + def create_group( + self, + name: str, + provenance: Optional[str] = None, + external_sync_identifier: Optional[str] = None, + description: Optional[str] = None, + invitability_level: Optional[CreateGroupInvitabilityLevelArg] = None, + member_viewability_level: Optional[CreateGroupMemberViewabilityLevelArg] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Group: """ Creates a new group of users in an enterprise. Only users with admin - + permissions can create new groups. :param name: The name of the new group to be created. This name must be unique @@ -148,18 +193,43 @@ def create_group(self, name: str, provenance: Optional[str] = None, external_syn """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, provenance=provenance, external_sync_identifier=external_sync_identifier, description=description, invitability_level=invitability_level, member_viewability_level=member_viewability_level) + request_body = BaseObject( + name=name, + provenance=provenance, + external_sync_identifier=external_sync_identifier, + description=description, + invitability_level=invitability_level, + member_viewability_level=member_viewability_level, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/groups']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/groups']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Group.from_dict(json.loads(response.text)) - def get_group_by_id(self, group_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> GroupFull: + + def get_group_by_id( + self, + group_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> GroupFull: """ Retrieves information about a group. Only members of this - + group or users with admin-level permissions will be able to - + use this API. :param group_id: The ID of the group. @@ -181,15 +251,39 @@ def get_group_by_id(self, group_id: str, fields: Optional[str] = None, extra_hea extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/groups/', group_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/groups/', group_id]), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return GroupFull.from_dict(json.loads(response.text)) - def update_group_by_id(self, group_id: str, name: Optional[str] = None, provenance: Optional[str] = None, external_sync_identifier: Optional[str] = None, description: Optional[str] = None, invitability_level: Optional[UpdateGroupByIdInvitabilityLevelArg] = None, member_viewability_level: Optional[UpdateGroupByIdMemberViewabilityLevelArg] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> GroupFull: + + def update_group_by_id( + self, + group_id: str, + name: Optional[str] = None, + provenance: Optional[str] = None, + external_sync_identifier: Optional[str] = None, + description: Optional[str] = None, + invitability_level: Optional[UpdateGroupByIdInvitabilityLevelArg] = None, + member_viewability_level: Optional[ + UpdateGroupByIdMemberViewabilityLevelArg + ] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> GroupFull: """ Updates a specific group. Only admins of this - + group or users with admin-level permissions will be able to - + use this API. :param group_id: The ID of the group. @@ -247,15 +341,37 @@ def update_group_by_id(self, group_id: str, name: Optional[str] = None, provenan """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, provenance=provenance, external_sync_identifier=external_sync_identifier, description=description, invitability_level=invitability_level, member_viewability_level=member_viewability_level) + request_body = BaseObject( + name=name, + provenance=provenance, + external_sync_identifier=external_sync_identifier, + description=description, + invitability_level=invitability_level, + member_viewability_level=member_viewability_level, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/groups/', group_id]), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/groups/', group_id]), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return GroupFull.from_dict(json.loads(response.text)) - def delete_group_by_id(self, group_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_group_by_id( + self, group_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Permanently deletes a group. Only users with - + admin-level permissions will be able to use this API. :param group_id: The ID of the group. @@ -267,5 +383,14 @@ def delete_group_by_id(self, group_id: str, extra_headers: Optional[Dict[str, Op if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/groups/', group_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/groups/', group_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/integration_mappings.py b/box_sdk_gen/managers/integration_mappings.py index bdecc119..fb45edcc 100644 --- a/box_sdk_gen/managers/integration_mappings.py +++ b/box_sdk_gen/managers/integration_mappings.py @@ -38,23 +38,43 @@ from box_sdk_gen.fetch import FetchResponse + class GetIntegrationMappingSlackPartnerItemTypeArg(str, Enum): CHANNEL = 'channel' + class GetIntegrationMappingSlackBoxItemTypeArg(str, Enum): FOLDER = 'folder' + class IntegrationMappingsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_integration_mapping_slack(self, marker: Optional[str] = None, limit: Optional[int] = None, partner_item_type: Optional[GetIntegrationMappingSlackPartnerItemTypeArg] = None, partner_item_id: Optional[str] = None, box_item_id: Optional[str] = None, box_item_type: Optional[GetIntegrationMappingSlackBoxItemTypeArg] = None, is_manually_created: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> IntegrationMappings: + + def get_integration_mapping_slack( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + partner_item_type: Optional[ + GetIntegrationMappingSlackPartnerItemTypeArg + ] = None, + partner_item_id: Optional[str] = None, + box_item_id: Optional[str] = None, + box_item_type: Optional[GetIntegrationMappingSlackBoxItemTypeArg] = None, + is_manually_created: Optional[bool] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> IntegrationMappings: """ Lists [Slack integration mappings](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack) in a users' enterprise. - + You need Admin or Co-Admin role to - + use this endpoint. :param marker: Defines the position marker at which to begin returning results. This is @@ -78,20 +98,47 @@ def get_integration_mapping_slack(self, marker: Optional[str] = None, limit: Opt """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit), 'partner_item_type': to_string(partner_item_type), 'partner_item_id': to_string(partner_item_id), 'box_item_id': to_string(box_item_id), 'box_item_type': to_string(box_item_type), 'is_manually_created': to_string(is_manually_created)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'marker': to_string(marker), + 'limit': to_string(limit), + 'partner_item_type': to_string(partner_item_type), + 'partner_item_id': to_string(partner_item_id), + 'box_item_id': to_string(box_item_id), + 'box_item_type': to_string(box_item_type), + 'is_manually_created': to_string(is_manually_created), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/integration_mappings/slack']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/integration_mappings/slack']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return IntegrationMappings.from_dict(json.loads(response.text)) - def create_integration_mapping_slack(self, partner_item: IntegrationMappingPartnerItemSlack, box_item: IntegrationMappingBoxItemSlack, options: Optional[IntegrationMappingSlackOptions] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> IntegrationMapping: + + def create_integration_mapping_slack( + self, + partner_item: IntegrationMappingPartnerItemSlack, + box_item: IntegrationMappingBoxItemSlack, + options: Optional[IntegrationMappingSlackOptions] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> IntegrationMapping: """ Creates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack) - + by mapping a Slack channel to a Box item. - + You need Admin or Co-Admin role to - + use this endpoint. :param extra_headers: Extra headers that will be included in the HTTP request. @@ -99,20 +146,40 @@ def create_integration_mapping_slack(self, partner_item: IntegrationMappingPartn """ if extra_headers is None: extra_headers = {} - request_body: IntegrationMappingSlackCreateRequest = IntegrationMappingSlackCreateRequest(partner_item=partner_item, box_item=box_item, options=options) + request_body = IntegrationMappingSlackCreateRequest( + partner_item=partner_item, box_item=box_item, options=options + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/integration_mappings/slack']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/integration_mappings/slack']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return IntegrationMapping.from_dict(json.loads(response.text)) - def update_integration_mapping_slack_by_id(self, integration_mapping_id: str, box_item: Optional[IntegrationMappingBoxItemSlack] = None, options: Optional[IntegrationMappingSlackOptions] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> IntegrationMapping: + + def update_integration_mapping_slack_by_id( + self, + integration_mapping_id: str, + box_item: Optional[IntegrationMappingBoxItemSlack] = None, + options: Optional[IntegrationMappingSlackOptions] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> IntegrationMapping: """ Updates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack). - + Supports updating the Box folder ID and options. - + You need Admin or Co-Admin role to - + use this endpoint. :param integration_mapping_id: An ID of an integration mapping @@ -123,17 +190,38 @@ def update_integration_mapping_slack_by_id(self, integration_mapping_id: str, bo """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(box_item=box_item, options=options) + request_body = BaseObject(box_item=box_item, options=options) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/integration_mappings/slack/', integration_mapping_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/integration_mappings/slack/', + integration_mapping_id, + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return IntegrationMapping.from_dict(json.loads(response.text)) - def delete_integration_mapping_slack_by_id(self, integration_mapping_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_integration_mapping_slack_by_id( + self, + integration_mapping_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack). - + You need Admin or Co-Admin role to - + use this endpoint. :param integration_mapping_id: An ID of an integration mapping @@ -145,5 +233,19 @@ def delete_integration_mapping_slack_by_id(self, integration_mapping_id: str, ex if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/integration_mappings/slack/', integration_mapping_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/integration_mappings/slack/', + integration_mapping_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/invites.py b/box_sdk_gen/managers/invites.py index fb9ee9b1..febb5e3e 100644 --- a/box_sdk_gen/managers/invites.py +++ b/box_sdk_gen/managers/invites.py @@ -28,6 +28,7 @@ from box_sdk_gen.fetch import FetchResponse + class CreateInviteEnterpriseArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -37,6 +38,7 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class CreateInviteActionableByArg(BaseObject): def __init__(self, login: Optional[str] = None, **kwargs): """ @@ -46,29 +48,41 @@ def __init__(self, login: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.login = login + class InvitesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def create_invite(self, enterprise: CreateInviteEnterpriseArg, actionable_by: CreateInviteActionableByArg, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Invite: + + def create_invite( + self, + enterprise: CreateInviteEnterpriseArg, + actionable_by: CreateInviteActionableByArg, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Invite: """ Invites an existing external user to join an enterprise. - + The existing user can not be part of another enterprise and - + must already have a Box account. Once invited, the user will receive an - + email and are prompted to accept the invitation within the - + Box web application. - + This method requires the "Manage An Enterprise" scope enabled for - + the application, which can be enabled within the developer console. :param enterprise: The enterprise to invite the user to @@ -89,12 +103,30 @@ def create_invite(self, enterprise: CreateInviteEnterpriseArg, actionable_by: Cr """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(enterprise=enterprise, actionable_by=actionable_by) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/invites']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/invites']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Invite.from_dict(json.loads(response.text)) - def get_invite_by_id(self, invite_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Invite: + + def get_invite_by_id( + self, + invite_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Invite: """ Returns the status of a user invite. :param invite_id: The ID of an invite. @@ -116,5 +148,15 @@ def get_invite_by_id(self, invite_id: str, fields: Optional[str] = None, extra_h extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/invites/', invite_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return Invite.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/invites/', invite_id]), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return Invite.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/legal_hold_policies.py b/box_sdk_gen/managers/legal_hold_policies.py index 5e5d47ae..2c77c95b 100644 --- a/box_sdk_gen/managers/legal_hold_policies.py +++ b/box_sdk_gen/managers/legal_hold_policies.py @@ -28,14 +28,27 @@ from box_sdk_gen.fetch import FetchResponse + class LegalHoldPoliciesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_legal_hold_policies(self, policy_name: Optional[str] = None, fields: Optional[str] = None, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> LegalHoldPolicies: + + def get_legal_hold_policies( + self, + policy_name: Optional[str] = None, + fields: Optional[str] = None, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> LegalHoldPolicies: """ Retrieves a list of legal hold policies that belong to - + an enterprise. :param policy_name: Limits results to policies for which the names start with @@ -61,11 +74,37 @@ def get_legal_hold_policies(self, policy_name: Optional[str] = None, fields: Opt """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'policy_name': to_string(policy_name), 'fields': to_string(fields), 'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'policy_name': to_string(policy_name), + 'fields': to_string(fields), + 'marker': to_string(marker), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policies']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/legal_hold_policies']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return LegalHoldPolicies.from_dict(json.loads(response.text)) - def create_legal_hold_policy(self, policy_name: str, description: Optional[str] = None, filter_started_at: Optional[str] = None, filter_ended_at: Optional[str] = None, is_ongoing: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> LegalHoldPolicy: + + def create_legal_hold_policy( + self, + policy_name: str, + description: Optional[str] = None, + filter_started_at: Optional[str] = None, + filter_ended_at: Optional[str] = None, + is_ongoing: Optional[bool] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> LegalHoldPolicy: """ Create a new legal hold policy. :param policy_name: The name of the policy. @@ -103,11 +142,33 @@ def create_legal_hold_policy(self, policy_name: str, description: Optional[str] """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(policy_name=policy_name, description=description, filter_started_at=filter_started_at, filter_ended_at=filter_ended_at, is_ongoing=is_ongoing) + request_body = BaseObject( + policy_name=policy_name, + description=description, + filter_started_at=filter_started_at, + filter_ended_at=filter_ended_at, + is_ongoing=is_ongoing, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policies']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/legal_hold_policies']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return LegalHoldPolicy.from_dict(json.loads(response.text)) - def get_legal_hold_policy_by_id(self, legal_hold_policy_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> LegalHoldPolicy: + + def get_legal_hold_policy_by_id( + self, + legal_hold_policy_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> LegalHoldPolicy: """ Retrieve a legal hold policy. :param legal_hold_policy_id: The ID of the legal hold policy @@ -119,9 +180,28 @@ def get_legal_hold_policy_by_id(self, legal_hold_policy_id: str, extra_headers: if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policies/', legal_hold_policy_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/legal_hold_policies/', legal_hold_policy_id] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return LegalHoldPolicy.from_dict(json.loads(response.text)) - def update_legal_hold_policy_by_id(self, legal_hold_policy_id: str, policy_name: Optional[str] = None, description: Optional[str] = None, release_notes: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> LegalHoldPolicy: + + def update_legal_hold_policy_by_id( + self, + legal_hold_policy_id: str, + policy_name: Optional[str] = None, + description: Optional[str] = None, + release_notes: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> LegalHoldPolicy: """ Update legal hold policy. :param legal_hold_policy_id: The ID of the legal hold policy @@ -138,17 +218,39 @@ def update_legal_hold_policy_by_id(self, legal_hold_policy_id: str, policy_name: """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(policy_name=policy_name, description=description, release_notes=release_notes) + request_body = BaseObject( + policy_name=policy_name, + description=description, + release_notes=release_notes, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policies/', legal_hold_policy_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/legal_hold_policies/', legal_hold_policy_id] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return LegalHoldPolicy.from_dict(json.loads(response.text)) - def delete_legal_hold_policy_by_id(self, legal_hold_policy_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_legal_hold_policy_by_id( + self, + legal_hold_policy_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Delete an existing legal hold policy. - + This is an asynchronous process. The policy will not be - + fully deleted yet when the response returns. :param legal_hold_policy_id: The ID of the legal hold policy @@ -160,5 +262,16 @@ def delete_legal_hold_policy_by_id(self, legal_hold_policy_id: str, extra_header if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policies/', legal_hold_policy_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/legal_hold_policies/', legal_hold_policy_id] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/legal_hold_policy_assignments.py b/box_sdk_gen/managers/legal_hold_policy_assignments.py index 364a5294..6568983a 100644 --- a/box_sdk_gen/managers/legal_hold_policy_assignments.py +++ b/box_sdk_gen/managers/legal_hold_policy_assignments.py @@ -34,20 +34,28 @@ from box_sdk_gen.fetch import FetchResponse + class GetLegalHoldPolicyAssignmentsAssignToTypeArg(str, Enum): FILE = 'file' FILE_VERSION = 'file_version' FOLDER = 'folder' USER = 'user' + class CreateLegalHoldPolicyAssignmentAssignToArgTypeField(str, Enum): FILE = 'file' FILE_VERSION = 'file_version' FOLDER = 'folder' USER = 'user' + class CreateLegalHoldPolicyAssignmentAssignToArg(BaseObject): - def __init__(self, type: CreateLegalHoldPolicyAssignmentAssignToArgTypeField, id: str, **kwargs): + def __init__( + self, + type: CreateLegalHoldPolicyAssignmentAssignToArgTypeField, + id: str, + **kwargs + ): """ :param type: The type of item to assign the policy to :type type: CreateLegalHoldPolicyAssignmentAssignToArgTypeField @@ -58,11 +66,26 @@ def __init__(self, type: CreateLegalHoldPolicyAssignmentAssignToArgTypeField, id self.type = type self.id = id + class LegalHoldPolicyAssignmentsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_legal_hold_policy_assignments(self, policy_id: str, assign_to_type: Optional[GetLegalHoldPolicyAssignmentsAssignToTypeArg] = None, assign_to_id: Optional[str] = None, marker: Optional[str] = None, limit: Optional[int] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> LegalHoldPolicyAssignments: + + def get_legal_hold_policy_assignments( + self, + policy_id: str, + assign_to_type: Optional[GetLegalHoldPolicyAssignmentsAssignToTypeArg] = None, + assign_to_id: Optional[str] = None, + marker: Optional[str] = None, + limit: Optional[int] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> LegalHoldPolicyAssignments: """ Retrieves a list of items a legal hold policy has been assigned to. :param policy_id: The ID of the legal hold policy @@ -93,11 +116,36 @@ def get_legal_hold_policy_assignments(self, policy_id: str, assign_to_type: Opti """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'policy_id': to_string(policy_id), 'assign_to_type': to_string(assign_to_type), 'assign_to_id': to_string(assign_to_id), 'marker': to_string(marker), 'limit': to_string(limit), 'fields': to_string(fields)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'policy_id': to_string(policy_id), + 'assign_to_type': to_string(assign_to_type), + 'assign_to_id': to_string(assign_to_id), + 'marker': to_string(marker), + 'limit': to_string(limit), + 'fields': to_string(fields), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policy_assignments']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/legal_hold_policy_assignments']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return LegalHoldPolicyAssignments.from_dict(json.loads(response.text)) - def create_legal_hold_policy_assignment(self, policy_id: str, assign_to: CreateLegalHoldPolicyAssignmentAssignToArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> LegalHoldPolicyAssignment: + + def create_legal_hold_policy_assignment( + self, + policy_id: str, + assign_to: CreateLegalHoldPolicyAssignmentAssignToArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> LegalHoldPolicyAssignment: """ Assign a legal hold to a file, file version, folder, or user. :param policy_id: The ID of the policy to assign. @@ -109,11 +157,27 @@ def create_legal_hold_policy_assignment(self, policy_id: str, assign_to: CreateL """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(policy_id=policy_id, assign_to=assign_to) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/legal_hold_policy_assignments']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return LegalHoldPolicyAssignment.from_dict(json.loads(response.text)) - def get_legal_hold_policy_assignment_by_id(self, legal_hold_policy_assignment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> LegalHoldPolicyAssignment: + + def get_legal_hold_policy_assignment_by_id( + self, + legal_hold_policy_assignment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> LegalHoldPolicyAssignment: """ Retrieve a legal hold policy assignment. :param legal_hold_policy_assignment_id: The ID of the legal hold policy assignment @@ -125,15 +189,34 @@ def get_legal_hold_policy_assignment_by_id(self, legal_hold_policy_assignment_id if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policy_assignments/', legal_hold_policy_assignment_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/legal_hold_policy_assignments/', + legal_hold_policy_assignment_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return LegalHoldPolicyAssignment.from_dict(json.loads(response.text)) - def delete_legal_hold_policy_assignment_by_id(self, legal_hold_policy_assignment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_legal_hold_policy_assignment_by_id( + self, + legal_hold_policy_assignment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Remove a legal hold from an item. - + This is an asynchronous process. The policy will not be - + fully removed yet when the response returns. :param legal_hold_policy_assignment_id: The ID of the legal hold policy assignment @@ -145,45 +228,67 @@ def delete_legal_hold_policy_assignment_by_id(self, legal_hold_policy_assignment if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policy_assignments/', legal_hold_policy_assignment_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/legal_hold_policy_assignments/', + legal_hold_policy_assignment_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_legal_hold_policy_assignment_file_on_hold(self, legal_hold_policy_assignment_id: str, marker: Optional[str] = None, limit: Optional[int] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionLegalHolds: + + def get_legal_hold_policy_assignment_file_on_hold( + self, + legal_hold_policy_assignment_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionLegalHolds: """ Get a list of current file versions for a legal hold - + assignment. - + In some cases you may want to get previous file versions instead. In these - + cases, use the `GET /legal_hold_policy_assignments/:id/file_versions_on_hold` - + API instead to return any previous versions of a file for this legal hold - + policy assignment. - + Due to ongoing re-architecture efforts this API might not return all file - + versions held for this policy ID. Instead, this API will only return the - + latest file version held in the newly developed architecture. The `GET - + /file_version_legal_holds` API can be used to fetch current and past versions - + of files held within the legacy architecture. - + The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to - + find a list of policy assignments for a given policy ID. :param legal_hold_policy_assignment_id: The ID of the legal hold policy assignment @@ -209,47 +314,77 @@ def get_legal_hold_policy_assignment_file_on_hold(self, legal_hold_policy_assign """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit), 'fields': to_string(fields)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'marker': to_string(marker), + 'limit': to_string(limit), + 'fields': to_string(fields), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policy_assignments/', legal_hold_policy_assignment_id, '/files_on_hold']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/legal_hold_policy_assignments/', + legal_hold_policy_assignment_id, + '/files_on_hold', + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileVersionLegalHolds.from_dict(json.loads(response.text)) - def get_legal_hold_policy_assignment_file_version_on_hold(self, legal_hold_policy_assignment_id: str, marker: Optional[str] = None, limit: Optional[int] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileVersionLegalHolds: + + def get_legal_hold_policy_assignment_file_version_on_hold( + self, + legal_hold_policy_assignment_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileVersionLegalHolds: """ Get a list of previous file versions for a legal hold - + assignment. - + In some cases you may only need the latest file versions instead. In these - + cases, use the `GET /legal_hold_policy_assignments/:id/files_on_hold` API - + instead to return any current (latest) versions of a file for this legal hold - + policy assignment. - + Due to ongoing re-architecture efforts this API might not return all files - + held for this policy ID. Instead, this API will only return past file versions - + held in the newly developed architecture. The `GET /file_version_legal_holds` - + API can be used to fetch current and past versions of files held within the - + legacy architecture. - + The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to - + find a list of policy assignments for a given policy ID. :param legal_hold_policy_assignment_id: The ID of the legal hold policy assignment @@ -275,7 +410,29 @@ def get_legal_hold_policy_assignment_file_version_on_hold(self, legal_hold_polic """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit), 'fields': to_string(fields)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'marker': to_string(marker), + 'limit': to_string(limit), + 'fields': to_string(fields), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/legal_hold_policy_assignments/', legal_hold_policy_assignment_id, '/file_versions_on_hold']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return FileVersionLegalHolds.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/legal_hold_policy_assignments/', + legal_hold_policy_assignment_id, + '/file_versions_on_hold', + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FileVersionLegalHolds.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/list_collaborations.py b/box_sdk_gen/managers/list_collaborations.py index 99099715..5076f25e 100644 --- a/box_sdk_gen/managers/list_collaborations.py +++ b/box_sdk_gen/managers/list_collaborations.py @@ -26,20 +26,34 @@ from box_sdk_gen.fetch import FetchResponse + class GetCollaborationsStatusArg(str, Enum): PENDING = 'pending' + class ListCollaborationsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_collaborations(self, file_id: str, fields: Optional[str] = None, limit: Optional[int] = None, marker: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Collaborations: + + def get_file_collaborations( + self, + file_id: str, + fields: Optional[str] = None, + limit: Optional[int] = None, + marker: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Collaborations: """ Retrieves a list of pending and active collaborations for a - + file. This returns all the users that have access to the file - + or have been invited to the file. :param file_id: The unique identifier that represents a file. @@ -70,17 +84,39 @@ def get_file_collaborations(self, file_id: str, fields: Optional[str] = None, li """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'limit': to_string(limit), 'marker': to_string(marker)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'limit': to_string(limit), + 'marker': to_string(marker), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/collaborations']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/collaborations']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Collaborations.from_dict(json.loads(response.text)) - def get_folder_collaborations(self, folder_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Collaborations: + + def get_folder_collaborations( + self, + folder_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Collaborations: """ Retrieves a list of pending and active collaborations for a - + folder. This returns all the users that have access to the folder - + or have been invited to the folder. :param folder_id: The unique identifier that represent a folder. @@ -107,9 +143,27 @@ def get_folder_collaborations(self, folder_id: str, fields: Optional[str] = None extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/collaborations']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/collaborations']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Collaborations.from_dict(json.loads(response.text)) - def get_collaborations(self, status: GetCollaborationsStatusArg, fields: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Collaborations: + + def get_collaborations( + self, + status: GetCollaborationsStatusArg, + fields: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Collaborations: """ Retrieves all pending collaboration invites for this user. :param status: The status of the collaborations to retrieve @@ -135,20 +189,44 @@ def get_collaborations(self, status: GetCollaborationsStatusArg, fields: Optiona """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'status': to_string(status), 'fields': to_string(fields), 'offset': to_string(offset), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'status': to_string(status), + 'fields': to_string(fields), + 'offset': to_string(offset), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaborations']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaborations']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Collaborations.from_dict(json.loads(response.text)) - def get_group_collaborations(self, group_id: str, limit: Optional[int] = None, offset: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Collaborations: + + def get_group_collaborations( + self, + group_id: str, + limit: Optional[int] = None, + offset: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Collaborations: """ Retrieves all the collaborations for a group. The user - + must have admin permissions to inspect enterprise's groups. - + Each collaboration object has details on which files or - + folders the group has access to and with what role. :param group_id: The ID of the group. @@ -166,7 +244,19 @@ def get_group_collaborations(self, group_id: str, limit: Optional[int] = None, o """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'limit': to_string(limit), 'offset': to_string(offset)}) + query_params_map: Dict[str, str] = prepare_params( + {'limit': to_string(limit), 'offset': to_string(offset)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/groups/', group_id, '/collaborations']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return Collaborations.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/groups/', group_id, '/collaborations']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return Collaborations.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/memberships.py b/box_sdk_gen/managers/memberships.py index 54bc090a..89e00c34 100644 --- a/box_sdk_gen/managers/memberships.py +++ b/box_sdk_gen/managers/memberships.py @@ -32,6 +32,7 @@ from box_sdk_gen.fetch import FetchResponse + class CreateGroupMembershipUserArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -41,6 +42,7 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class CreateGroupMembershipGroupArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -50,25 +52,39 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class CreateGroupMembershipRoleArg(str, Enum): MEMBER = 'member' ADMIN = 'admin' + class UpdateGroupMembershipByIdRoleArg(str, Enum): MEMBER = 'member' ADMIN = 'admin' + class MembershipsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_user_memberships(self, user_id: str, limit: Optional[int] = None, offset: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> GroupMemberships: + + def get_user_memberships( + self, + user_id: str, + limit: Optional[int] = None, + offset: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> GroupMemberships: """ Retrieves all the groups for a user. Only members of this - + group or users with admin-level permissions will be able to - + use this API. :param user_id: The ID of the user. @@ -86,17 +102,36 @@ def get_user_memberships(self, user_id: str, limit: Optional[int] = None, offset """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'limit': to_string(limit), 'offset': to_string(offset)}) + query_params_map: Dict[str, str] = prepare_params( + {'limit': to_string(limit), 'offset': to_string(offset)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/memberships']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id, '/memberships']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return GroupMemberships.from_dict(json.loads(response.text)) - def get_group_memberships(self, group_id: str, limit: Optional[int] = None, offset: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> GroupMemberships: + + def get_group_memberships( + self, + group_id: str, + limit: Optional[int] = None, + offset: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> GroupMemberships: """ Retrieves all the members for a group. Only members of this - + group or users with admin-level permissions will be able to - + use this API. :param group_id: The ID of the group. @@ -114,14 +149,35 @@ def get_group_memberships(self, group_id: str, limit: Optional[int] = None, offs """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'limit': to_string(limit), 'offset': to_string(offset)}) + query_params_map: Dict[str, str] = prepare_params( + {'limit': to_string(limit), 'offset': to_string(offset)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/groups/', group_id, '/memberships']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/groups/', group_id, '/memberships']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return GroupMemberships.from_dict(json.loads(response.text)) - def create_group_membership(self, user: CreateGroupMembershipUserArg, group: CreateGroupMembershipGroupArg, role: Optional[CreateGroupMembershipRoleArg] = None, configurable_permissions: Optional[Dict[str, bool]] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> GroupMembership: + + def create_group_membership( + self, + user: CreateGroupMembershipUserArg, + group: CreateGroupMembershipGroupArg, + role: Optional[CreateGroupMembershipRoleArg] = None, + configurable_permissions: Optional[Dict[str, bool]] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> GroupMembership: """ Creates a group membership. Only users with - + admin-level permissions will be able to use this API. :param user: The user to add to the group. @@ -153,18 +209,41 @@ def create_group_membership(self, user: CreateGroupMembershipUserArg, group: Cre """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(user=user, group=group, role=role, configurable_permissions=configurable_permissions) + request_body = BaseObject( + user=user, + group=group, + role=role, + configurable_permissions=configurable_permissions, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/group_memberships']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/group_memberships']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return GroupMembership.from_dict(json.loads(response.text)) - def get_group_membership_by_id(self, group_membership_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> GroupMembership: + + def get_group_membership_by_id( + self, + group_membership_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> GroupMembership: """ Retrieves a specific group membership. Only admins of this - + group or users with admin-level permissions will be able to - + use this API. :param group_membership_id: The ID of the group membership. @@ -186,15 +265,35 @@ def get_group_membership_by_id(self, group_membership_id: str, fields: Optional[ extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/group_memberships/', group_membership_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/group_memberships/', group_membership_id] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return GroupMembership.from_dict(json.loads(response.text)) - def update_group_membership_by_id(self, group_membership_id: str, role: Optional[UpdateGroupMembershipByIdRoleArg] = None, configurable_permissions: Optional[Dict[str, bool]] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> GroupMembership: + + def update_group_membership_by_id( + self, + group_membership_id: str, + role: Optional[UpdateGroupMembershipByIdRoleArg] = None, + configurable_permissions: Optional[Dict[str, bool]] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> GroupMembership: """ Updates a user's group membership. Only admins of this - + group or users with admin-level permissions will be able to - + use this API. :param group_membership_id: The ID of the group membership. @@ -225,18 +324,39 @@ def update_group_membership_by_id(self, group_membership_id: str, role: Optional """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(role=role, configurable_permissions=configurable_permissions) + request_body = BaseObject( + role=role, configurable_permissions=configurable_permissions + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/group_memberships/', group_membership_id]), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/group_memberships/', group_membership_id] + ), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return GroupMembership.from_dict(json.loads(response.text)) - def delete_group_membership_by_id(self, group_membership_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_group_membership_by_id( + self, + group_membership_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a specific group membership. Only admins of this - + group or users with admin-level permissions will be able to - + use this API. :param group_membership_id: The ID of the group membership. @@ -248,5 +368,16 @@ def delete_group_membership_by_id(self, group_membership_id: str, extra_headers: if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/group_memberships/', group_membership_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/group_memberships/', group_membership_id] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/metadata_cascade_policies.py b/box_sdk_gen/managers/metadata_cascade_policies.py index b02a1a43..a07eb1d4 100644 --- a/box_sdk_gen/managers/metadata_cascade_policies.py +++ b/box_sdk_gen/managers/metadata_cascade_policies.py @@ -32,25 +32,40 @@ from box_sdk_gen.fetch import FetchResponse + class CreateMetadataCascadePolicyScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class CreateMetadataCascadePolicyApplyConflictResolutionArg(str, Enum): NONE = 'none' OVERWRITE = 'overwrite' + class MetadataCascadePoliciesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_metadata_cascade_policies(self, folder_id: str, owner_enterprise_id: Optional[str] = None, marker: Optional[str] = None, offset: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataCascadePolicies: + + def get_metadata_cascade_policies( + self, + folder_id: str, + owner_enterprise_id: Optional[str] = None, + marker: Optional[str] = None, + offset: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataCascadePolicies: """ Retrieves a list of all the metadata cascade policies - + that are applied to a given folder. This can not be used on the root - + folder with ID `0`. :param folder_id: Specifies which folder to return policies for. This can not be used on the @@ -74,23 +89,47 @@ def get_metadata_cascade_policies(self, folder_id: str, owner_enterprise_id: Opt """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'folder_id': to_string(folder_id), 'owner_enterprise_id': to_string(owner_enterprise_id), 'marker': to_string(marker), 'offset': to_string(offset)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'folder_id': to_string(folder_id), + 'owner_enterprise_id': to_string(owner_enterprise_id), + 'marker': to_string(marker), + 'offset': to_string(offset), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_cascade_policies']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_cascade_policies']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataCascadePolicies.from_dict(json.loads(response.text)) - def create_metadata_cascade_policy(self, folder_id: str, scope: CreateMetadataCascadePolicyScopeArg, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataCascadePolicy: + + def create_metadata_cascade_policy( + self, + folder_id: str, + scope: CreateMetadataCascadePolicyScopeArg, + template_key: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataCascadePolicy: """ Creates a new metadata cascade policy that applies a given - + metadata template to a given folder and automatically - + cascades it down to any files within that folder. - + In order for the policy to be applied a metadata instance must first - + be applied to the folder the policy is to be applied to. :param folder_id: The ID of the folder to apply the policy to. This folder will @@ -118,11 +157,29 @@ def create_metadata_cascade_policy(self, folder_id: str, scope: CreateMetadataCa """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(folder_id=folder_id, scope=scope, templateKey=template_key) + request_body = BaseObject( + folder_id=folder_id, scope=scope, templateKey=template_key + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_cascade_policies']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_cascade_policies']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataCascadePolicy.from_dict(json.loads(response.text)) - def get_metadata_cascade_policy_by_id(self, metadata_cascade_policy_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataCascadePolicy: + + def get_metadata_cascade_policy_by_id( + self, + metadata_cascade_policy_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataCascadePolicy: """ Retrieve a specific metadata cascade policy assigned to a folder. :param metadata_cascade_policy_id: The ID of the metadata cascade policy. @@ -134,9 +191,28 @@ def get_metadata_cascade_policy_by_id(self, metadata_cascade_policy_id: str, ext if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_cascade_policies/', metadata_cascade_policy_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_cascade_policies/', + metadata_cascade_policy_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataCascadePolicy.from_dict(json.loads(response.text)) - def delete_metadata_cascade_policy_by_id(self, metadata_cascade_policy_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_metadata_cascade_policy_by_id( + self, + metadata_cascade_policy_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a metadata cascade policy. :param metadata_cascade_policy_id: The ID of the metadata cascade policy. @@ -148,18 +224,38 @@ def delete_metadata_cascade_policy_by_id(self, metadata_cascade_policy_id: str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_cascade_policies/', metadata_cascade_policy_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_cascade_policies/', + metadata_cascade_policy_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_metadata_cascade_policy_apply(self, metadata_cascade_policy_id: str, conflict_resolution: CreateMetadataCascadePolicyApplyConflictResolutionArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def create_metadata_cascade_policy_apply( + self, + metadata_cascade_policy_id: str, + conflict_resolution: CreateMetadataCascadePolicyApplyConflictResolutionArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Force the metadata on a folder with a metadata cascade policy to be applied to - + all of its children. This can be used after creating a new cascade policy to - + enforce the metadata to be cascaded down to all existing files within that - + folder. :param metadata_cascade_policy_id: The ID of the cascade policy to force-apply. @@ -177,7 +273,24 @@ def create_metadata_cascade_policy_apply(self, metadata_cascade_policy_id: str, """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(conflict_resolution=conflict_resolution) + request_body = BaseObject(conflict_resolution=conflict_resolution) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_cascade_policies/', metadata_cascade_policy_id, '/apply']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_cascade_policies/', + metadata_cascade_policy_id, + '/apply', + ] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/metadata_templates.py b/box_sdk_gen/managers/metadata_templates.py index f4f23501..d92d1e42 100644 --- a/box_sdk_gen/managers/metadata_templates.py +++ b/box_sdk_gen/managers/metadata_templates.py @@ -34,14 +34,17 @@ from box_sdk_gen.fetch import FetchResponse + class GetMetadataTemplateSchemaScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class UpdateMetadataTemplateSchemaScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class UpdateMetadataTemplateSchemaRequestBodyArgOpField(str, Enum): EDITTEMPLATE = 'editTemplate' ADDFIELD = 'addField' @@ -57,10 +60,39 @@ class UpdateMetadataTemplateSchemaRequestBodyArgOpField(str, Enum): EDITMULTISELECTOPTION = 'editMultiSelectOption' REMOVEMULTISELECTOPTION = 'removeMultiSelectOption' + class UpdateMetadataTemplateSchemaRequestBodyArg(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'field_key': 'fieldKey', 'field_keys': 'fieldKeys', 'enum_option_key': 'enumOptionKey', 'enum_option_keys': 'enumOptionKeys', 'multi_select_option_key': 'multiSelectOptionKey', 'multi_select_option_keys': 'multiSelectOptionKeys', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'fieldKey': 'field_key', 'fieldKeys': 'field_keys', 'enumOptionKey': 'enum_option_key', 'enumOptionKeys': 'enum_option_keys', 'multiSelectOptionKey': 'multi_select_option_key', 'multiSelectOptionKeys': 'multi_select_option_keys', **BaseObject._json_to_fields_mapping} - def __init__(self, op: UpdateMetadataTemplateSchemaRequestBodyArgOpField, data: Optional[Dict[str, str]] = None, field_key: Optional[str] = None, field_keys: Optional[List[str]] = None, enum_option_key: Optional[str] = None, enum_option_keys: Optional[List[str]] = None, multi_select_option_key: Optional[str] = None, multi_select_option_keys: Optional[List[str]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'field_key': 'fieldKey', + 'field_keys': 'fieldKeys', + 'enum_option_key': 'enumOptionKey', + 'enum_option_keys': 'enumOptionKeys', + 'multi_select_option_key': 'multiSelectOptionKey', + 'multi_select_option_keys': 'multiSelectOptionKeys', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'fieldKey': 'field_key', + 'fieldKeys': 'field_keys', + 'enumOptionKey': 'enum_option_key', + 'enumOptionKeys': 'enum_option_keys', + 'multiSelectOptionKey': 'multi_select_option_key', + 'multiSelectOptionKeys': 'multi_select_option_keys', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + op: UpdateMetadataTemplateSchemaRequestBodyArgOpField, + data: Optional[Dict[str, str]] = None, + field_key: Optional[str] = None, + field_keys: Optional[List[str]] = None, + enum_option_key: Optional[str] = None, + enum_option_keys: Optional[List[str]] = None, + multi_select_option_key: Optional[str] = None, + multi_select_option_keys: Optional[List[str]] = None, + **kwargs + ): """ :param op: The type of change to perform on the template. Some of these are hazardous as they will change existing templates. @@ -97,10 +129,12 @@ def __init__(self, op: UpdateMetadataTemplateSchemaRequestBodyArgOpField, data: self.multi_select_option_key = multi_select_option_key self.multi_select_option_keys = multi_select_option_keys + class DeleteMetadataTemplateSchemaScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class CreateMetadataTemplateSchemaFieldsArgTypeField(str, Enum): STRING = 'string' FLOAT = 'float' @@ -108,6 +142,7 @@ class CreateMetadataTemplateSchemaFieldsArgTypeField(str, Enum): ENUM = 'enum' MULTISELECT = 'multiSelect' + class CreateMetadataTemplateSchemaFieldsArgOptionsField(BaseObject): def __init__(self, key: str, **kwargs): """ @@ -118,10 +153,29 @@ def __init__(self, key: str, **kwargs): super().__init__(**kwargs) self.key = key + class CreateMetadataTemplateSchemaFieldsArg(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'display_name': 'displayName', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'displayName': 'display_name', **BaseObject._json_to_fields_mapping} - def __init__(self, type: CreateMetadataTemplateSchemaFieldsArgTypeField, key: str, display_name: str, description: Optional[str] = None, hidden: Optional[bool] = None, options: Optional[List[CreateMetadataTemplateSchemaFieldsArgOptionsField]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'display_name': 'displayName', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'displayName': 'display_name', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + type: CreateMetadataTemplateSchemaFieldsArgTypeField, + key: str, + display_name: str, + description: Optional[str] = None, + hidden: Optional[bool] = None, + options: Optional[ + List[CreateMetadataTemplateSchemaFieldsArgOptionsField] + ] = None, + **kwargs + ): """ :param type: The type of field. The basic fields are a `string` field for text, a `float` field for numbers, and a `date` fields to present the user with a @@ -153,14 +207,24 @@ def __init__(self, type: CreateMetadataTemplateSchemaFieldsArgTypeField, key: st self.hidden = hidden self.options = options + class MetadataTemplatesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_metadata_templates(self, metadata_instance_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataTemplates: + + def get_metadata_templates( + self, + metadata_instance_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataTemplates: """ Finds a metadata template by searching for the ID of an instance of the - + template. :param metadata_instance_id: The ID of an instance of the metadata template to find. @@ -170,17 +234,35 @@ def get_metadata_templates(self, metadata_instance_id: str, extra_headers: Optio """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'metadata_instance_id': to_string(metadata_instance_id)}) + query_params_map: Dict[str, str] = prepare_params( + {'metadata_instance_id': to_string(metadata_instance_id)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_templates']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataTemplates.from_dict(json.loads(response.text)) - def get_metadata_template_schema(self, scope: GetMetadataTemplateSchemaScopeArg, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataTemplate: + + def get_metadata_template_schema( + self, + scope: GetMetadataTemplateSchemaScopeArg, + template_key: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataTemplate: """ Retrieves a metadata template by its `scope` and `templateKey` values. - + To find the `scope` and `templateKey` for a template, list all templates for - + an enterprise or globally, or list all templates applied to a file or folder. :param scope: The scope of the metadata template @@ -195,21 +277,45 @@ def get_metadata_template_schema(self, scope: GetMetadataTemplateSchemaScopeArg, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/', scope, '/', template_key, '/schema']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_templates/', + scope, + '/', + template_key, + '/schema', + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataTemplate.from_dict(json.loads(response.text)) - def update_metadata_template_schema(self, scope: UpdateMetadataTemplateSchemaScopeArg, template_key: str, request_body: List[UpdateMetadataTemplateSchemaRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataTemplate: + + def update_metadata_template_schema( + self, + scope: UpdateMetadataTemplateSchemaScopeArg, + template_key: str, + request_body: List[UpdateMetadataTemplateSchemaRequestBodyArg], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataTemplate: """ Updates a metadata template. - + The metadata template can only be updated if the template - + already exists. - + The update is applied atomically. If any errors occur during the - + application of the operations, the metadata template will not be changed. :param scope: The scope of the metadata template @@ -226,12 +332,37 @@ def update_metadata_template_schema(self, scope: UpdateMetadataTemplateSchemaSco if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/', scope, '/', template_key, '/schema']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_templates/', + scope, + '/', + template_key, + '/schema', + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataTemplate.from_dict(json.loads(response.text)) - def delete_metadata_template_schema(self, scope: DeleteMetadataTemplateSchemaScopeArg, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_metadata_template_schema( + self, + scope: DeleteMetadataTemplateSchemaScopeArg, + template_key: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Delete a metadata template and its instances. - + This deletion is permanent and can not be reversed. :param scope: The scope of the metadata template @@ -246,9 +377,29 @@ def delete_metadata_template_schema(self, scope: DeleteMetadataTemplateSchemaSco if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/', scope, '/', template_key, '/schema']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/metadata_templates/', + scope, + '/', + template_key, + '/schema', + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_metadata_template_by_id(self, template_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataTemplate: + + def get_metadata_template_by_id( + self, template_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> MetadataTemplate: """ Retrieves a metadata template by its ID. :param template_id: The ID of the template @@ -260,12 +411,27 @@ def get_metadata_template_by_id(self, template_id: str, extra_headers: Optional[ if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/', template_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_templates/', template_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataTemplate.from_dict(json.loads(response.text)) - def get_metadata_template_global(self, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataTemplates: + + def get_metadata_template_global( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataTemplates: """ Used to retrieve all generic, global metadata templates available to all - + enterprises using Box. :param marker: Defines the position marker at which to begin returning results. This is @@ -279,14 +445,32 @@ def get_metadata_template_global(self, marker: Optional[str] = None, limit: Opti """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/global']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_templates/global']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataTemplates.from_dict(json.loads(response.text)) - def get_metadata_template_enterprise(self, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataTemplates: + + def get_metadata_template_enterprise( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataTemplates: """ Used to retrieve all metadata templates created to be used specifically within - + the user's enterprise :param marker: Defines the position marker at which to begin returning results. This is @@ -300,14 +484,36 @@ def get_metadata_template_enterprise(self, marker: Optional[str] = None, limit: """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/enterprise']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_templates/enterprise']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataTemplates.from_dict(json.loads(response.text)) - def create_metadata_template_schema(self, scope: str, display_name: str, template_key: Optional[str] = None, hidden: Optional[bool] = None, fields: Optional[List[CreateMetadataTemplateSchemaFieldsArg]] = None, copy_instance_on_item_copy: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataTemplate: + + def create_metadata_template_schema( + self, + scope: str, + display_name: str, + template_key: Optional[str] = None, + hidden: Optional[bool] = None, + fields: Optional[List[CreateMetadataTemplateSchemaFieldsArg]] = None, + copy_instance_on_item_copy: Optional[bool] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataTemplate: """ Creates a new metadata template that can be applied to - + files and folders. :param scope: The scope of the metadata template to create. Applications can @@ -340,7 +546,25 @@ def create_metadata_template_schema(self, scope: str, display_name: str, templat """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(scope=scope, templateKey=template_key, displayName=display_name, hidden=hidden, fields=fields, copyInstanceOnItemCopy=copy_instance_on_item_copy) + request_body = BaseObject( + scope=scope, + templateKey=template_key, + displayName=display_name, + hidden=hidden, + fields=fields, + copyInstanceOnItemCopy=copy_instance_on_item_copy, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_templates/schema']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return MetadataTemplate.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_templates/schema']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return MetadataTemplate.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/recent_items.py b/box_sdk_gen/managers/recent_items.py index 44e5866e..b33b97e8 100644 --- a/box_sdk_gen/managers/recent_items.py +++ b/box_sdk_gen/managers/recent_items.py @@ -24,17 +24,29 @@ from box_sdk_gen.fetch import FetchResponse + class RecentItemsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_recent_items(self, fields: Optional[str] = None, limit: Optional[int] = None, marker: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RecentItems: + + def get_recent_items( + self, + fields: Optional[str] = None, + limit: Optional[int] = None, + marker: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> RecentItems: """ Returns information about the recent items accessed - + by a user, either in the last 90 days or up to the last - + 1000 items accessed. :param fields: A comma-separated list of attributes to include in the @@ -57,7 +69,23 @@ def get_recent_items(self, fields: Optional[str] = None, limit: Optional[int] = """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'limit': to_string(limit), 'marker': to_string(marker)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'limit': to_string(limit), + 'marker': to_string(marker), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/recent_items']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return RecentItems.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/recent_items']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return RecentItems.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/retention_policies.py b/box_sdk_gen/managers/retention_policies.py index d22d32a0..2cc93549 100644 --- a/box_sdk_gen/managers/retention_policies.py +++ b/box_sdk_gen/managers/retention_policies.py @@ -34,31 +34,51 @@ from box_sdk_gen.fetch import FetchResponse + class GetRetentionPoliciesPolicyTypeArg(str, Enum): FINITE = 'finite' INDEFINITE = 'indefinite' + class CreateRetentionPolicyPolicyTypeArg(str, Enum): FINITE = 'finite' INDEFINITE = 'indefinite' + class CreateRetentionPolicyDispositionActionArg(str, Enum): PERMANENTLY_DELETE = 'permanently_delete' REMOVE_RETENTION = 'remove_retention' + class CreateRetentionPolicyRetentionTypeArg(str, Enum): MODIFIABLE = 'modifiable' NON_MODIFIABLE = 'non-modifiable' + class UpdateRetentionPolicyByIdDispositionActionArg(str, Enum): PERMANENTLY_DELETE = 'permanently_delete' REMOVE_RETENTION = 'remove_retention' + class RetentionPoliciesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_retention_policies(self, policy_name: Optional[str] = None, policy_type: Optional[GetRetentionPoliciesPolicyTypeArg] = None, created_by_user_id: Optional[str] = None, fields: Optional[str] = None, limit: Optional[int] = None, marker: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RetentionPolicies: + + def get_retention_policies( + self, + policy_name: Optional[str] = None, + policy_type: Optional[GetRetentionPoliciesPolicyTypeArg] = None, + created_by_user_id: Optional[str] = None, + fields: Optional[str] = None, + limit: Optional[int] = None, + marker: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> RetentionPolicies: """ Retrieves all of the retention policies for an enterprise. :param policy_name: Filters results by a case sensitive prefix of the name of @@ -87,11 +107,43 @@ def get_retention_policies(self, policy_name: Optional[str] = None, policy_type: """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'policy_name': to_string(policy_name), 'policy_type': to_string(policy_type), 'created_by_user_id': to_string(created_by_user_id), 'fields': to_string(fields), 'limit': to_string(limit), 'marker': to_string(marker)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'policy_name': to_string(policy_name), + 'policy_type': to_string(policy_type), + 'created_by_user_id': to_string(created_by_user_id), + 'fields': to_string(fields), + 'limit': to_string(limit), + 'marker': to_string(marker), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policies']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/retention_policies']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return RetentionPolicies.from_dict(json.loads(response.text)) - def create_retention_policy(self, policy_name: str, policy_type: CreateRetentionPolicyPolicyTypeArg, disposition_action: CreateRetentionPolicyDispositionActionArg, description: Optional[str] = None, retention_length: Optional[str] = None, retention_type: Optional[CreateRetentionPolicyRetentionTypeArg] = None, can_owner_extend_retention: Optional[bool] = None, are_owners_notified: Optional[bool] = None, custom_notification_recipients: Optional[List[UserMini]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RetentionPolicy: + + def create_retention_policy( + self, + policy_name: str, + policy_type: CreateRetentionPolicyPolicyTypeArg, + disposition_action: CreateRetentionPolicyDispositionActionArg, + description: Optional[str] = None, + retention_length: Optional[str] = None, + retention_type: Optional[CreateRetentionPolicyRetentionTypeArg] = None, + can_owner_extend_retention: Optional[bool] = None, + are_owners_notified: Optional[bool] = None, + custom_notification_recipients: Optional[List[UserMini]] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> RetentionPolicy: """ Creates a retention policy. :param policy_name: The name for the retention policy @@ -146,11 +198,38 @@ def create_retention_policy(self, policy_name: str, policy_type: CreateRetention """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(policy_name=policy_name, description=description, policy_type=policy_type, disposition_action=disposition_action, retention_length=retention_length, retention_type=retention_type, can_owner_extend_retention=can_owner_extend_retention, are_owners_notified=are_owners_notified, custom_notification_recipients=custom_notification_recipients) + request_body = BaseObject( + policy_name=policy_name, + description=description, + policy_type=policy_type, + disposition_action=disposition_action, + retention_length=retention_length, + retention_type=retention_type, + can_owner_extend_retention=can_owner_extend_retention, + are_owners_notified=are_owners_notified, + custom_notification_recipients=custom_notification_recipients, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policies']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/retention_policies']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return RetentionPolicy.from_dict(json.loads(response.text)) - def get_retention_policy_by_id(self, retention_policy_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RetentionPolicy: + + def get_retention_policy_by_id( + self, + retention_policy_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> RetentionPolicy: """ Retrieves a retention policy. :param retention_policy_id: The ID of the retention policy. @@ -172,9 +251,37 @@ def get_retention_policy_by_id(self, retention_policy_id: str, fields: Optional[ extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policies/', retention_policy_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/retention_policies/', retention_policy_id] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return RetentionPolicy.from_dict(json.loads(response.text)) - def update_retention_policy_by_id(self, retention_policy_id: str, policy_name: Optional[str] = None, description: Optional[str] = None, disposition_action: Optional[UpdateRetentionPolicyByIdDispositionActionArg] = None, retention_type: Optional[str] = None, retention_length: Optional[str] = None, status: Optional[str] = None, can_owner_extend_retention: Optional[bool] = None, are_owners_notified: Optional[bool] = None, custom_notification_recipients: Optional[List[UserMini]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RetentionPolicy: + + def update_retention_policy_by_id( + self, + retention_policy_id: str, + policy_name: Optional[str] = None, + description: Optional[str] = None, + disposition_action: Optional[ + UpdateRetentionPolicyByIdDispositionActionArg + ] = None, + retention_type: Optional[str] = None, + retention_length: Optional[str] = None, + status: Optional[str] = None, + can_owner_extend_retention: Optional[bool] = None, + are_owners_notified: Optional[bool] = None, + custom_notification_recipients: Optional[List[UserMini]] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> RetentionPolicy: """ Updates a retention policy. :param retention_policy_id: The ID of the retention policy. @@ -235,11 +342,39 @@ def update_retention_policy_by_id(self, retention_policy_id: str, policy_name: O """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(policy_name=policy_name, description=description, disposition_action=disposition_action, retention_type=retention_type, retention_length=retention_length, status=status, can_owner_extend_retention=can_owner_extend_retention, are_owners_notified=are_owners_notified, custom_notification_recipients=custom_notification_recipients) + request_body = BaseObject( + policy_name=policy_name, + description=description, + disposition_action=disposition_action, + retention_type=retention_type, + retention_length=retention_length, + status=status, + can_owner_extend_retention=can_owner_extend_retention, + are_owners_notified=are_owners_notified, + custom_notification_recipients=custom_notification_recipients, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policies/', retention_policy_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/retention_policies/', retention_policy_id] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return RetentionPolicy.from_dict(json.loads(response.text)) - def delete_retention_policy_by_id(self, retention_policy_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_retention_policy_by_id( + self, + retention_policy_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Permanently deletes a retention policy. :param retention_policy_id: The ID of the retention policy. @@ -251,5 +386,16 @@ def delete_retention_policy_by_id(self, retention_policy_id: str, extra_headers: if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policies/', retention_policy_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/retention_policies/', retention_policy_id] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/retention_policy_assignments.py b/box_sdk_gen/managers/retention_policy_assignments.py index 9cd55471..713975b1 100644 --- a/box_sdk_gen/managers/retention_policy_assignments.py +++ b/box_sdk_gen/managers/retention_policy_assignments.py @@ -36,18 +36,26 @@ from box_sdk_gen.fetch import FetchResponse + class GetRetentionPolicyAssignmentsTypeArg(str, Enum): FOLDER = 'folder' ENTERPRISE = 'enterprise' METADATA_TEMPLATE = 'metadata_template' + class CreateRetentionPolicyAssignmentAssignToArgTypeField(str, Enum): ENTERPRISE = 'enterprise' FOLDER = 'folder' METADATA_TEMPLATE = 'metadata_template' + class CreateRetentionPolicyAssignmentAssignToArg(BaseObject): - def __init__(self, type: CreateRetentionPolicyAssignmentAssignToArgTypeField, id: str, **kwargs): + def __init__( + self, + type: CreateRetentionPolicyAssignmentAssignToArgTypeField, + id: str, + **kwargs + ): """ :param type: The type of item to assign the policy to. :type type: CreateRetentionPolicyAssignmentAssignToArgTypeField @@ -60,8 +68,11 @@ def __init__(self, type: CreateRetentionPolicyAssignmentAssignToArgTypeField, id self.type = type self.id = id + class CreateRetentionPolicyAssignmentFilterFieldsArg(BaseObject): - def __init__(self, field: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__( + self, field: Optional[str] = None, value: Optional[str] = None, **kwargs + ): """ :param field: The metadata attribute key id. :type field: Optional[str], optional @@ -73,14 +84,28 @@ def __init__(self, field: Optional[str] = None, value: Optional[str] = None, **k self.field = field self.value = value + class RetentionPolicyAssignmentsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_retention_policy_assignments(self, retention_policy_id: str, type: Optional[GetRetentionPolicyAssignmentsTypeArg] = None, fields: Optional[str] = None, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RetentionPolicyAssignments: + + def get_retention_policy_assignments( + self, + retention_policy_id: str, + type: Optional[GetRetentionPolicyAssignmentsTypeArg] = None, + fields: Optional[str] = None, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> RetentionPolicyAssignments: """ Returns a list of all retention policy assignments associated with a specified - + retention policy. :param retention_policy_id: The ID of the retention policy. @@ -107,11 +132,44 @@ def get_retention_policy_assignments(self, retention_policy_id: str, type: Optio """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'type': to_string(type), 'fields': to_string(fields), 'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'type': to_string(type), + 'fields': to_string(fields), + 'marker': to_string(marker), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policies/', retention_policy_id, '/assignments']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/retention_policies/', + retention_policy_id, + '/assignments', + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return RetentionPolicyAssignments.from_dict(json.loads(response.text)) - def create_retention_policy_assignment(self, policy_id: str, assign_to: CreateRetentionPolicyAssignmentAssignToArg, filter_fields: Optional[List[CreateRetentionPolicyAssignmentFilterFieldsArg]] = None, start_date_field: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RetentionPolicyAssignment: + + def create_retention_policy_assignment( + self, + policy_id: str, + assign_to: CreateRetentionPolicyAssignmentAssignToArg, + filter_fields: Optional[ + List[CreateRetentionPolicyAssignmentFilterFieldsArg] + ] = None, + start_date_field: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> RetentionPolicyAssignment: """ Assigns a retention policy to an item. :param policy_id: The ID of the retention policy to assign @@ -132,11 +190,33 @@ def create_retention_policy_assignment(self, policy_id: str, assign_to: CreateRe """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(policy_id=policy_id, assign_to=assign_to, filter_fields=filter_fields, start_date_field=start_date_field) + request_body = BaseObject( + policy_id=policy_id, + assign_to=assign_to, + filter_fields=filter_fields, + start_date_field=start_date_field, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policy_assignments']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/retention_policy_assignments']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return RetentionPolicyAssignment.from_dict(json.loads(response.text)) - def get_retention_policy_assignment_by_id(self, retention_policy_assignment_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> RetentionPolicyAssignment: + + def get_retention_policy_assignment_by_id( + self, + retention_policy_assignment_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> RetentionPolicyAssignment: """ Retrieves a retention policy assignment :param retention_policy_assignment_id: The ID of the retention policy assignment. @@ -158,12 +238,32 @@ def get_retention_policy_assignment_by_id(self, retention_policy_assignment_id: extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policy_assignments/', retention_policy_assignment_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/retention_policy_assignments/', + retention_policy_assignment_id, + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return RetentionPolicyAssignment.from_dict(json.loads(response.text)) - def delete_retention_policy_assignment_by_id(self, retention_policy_assignment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_retention_policy_assignment_by_id( + self, + retention_policy_assignment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Removes a retention policy assignment - + applied to content. :param retention_policy_assignment_id: The ID of the retention policy assignment. @@ -175,9 +275,30 @@ def delete_retention_policy_assignment_by_id(self, retention_policy_assignment_i if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policy_assignments/', retention_policy_assignment_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/retention_policy_assignments/', + retention_policy_assignment_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_retention_policy_assignment_file_under_retention(self, retention_policy_assignment_id: str, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FilesUnderRetention: + + def get_retention_policy_assignment_file_under_retention( + self, + retention_policy_assignment_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FilesUnderRetention: """ Returns a list of files under retention for a retention policy assignment. :param retention_policy_assignment_id: The ID of the retention policy assignment. @@ -194,14 +315,39 @@ def get_retention_policy_assignment_file_under_retention(self, retention_policy_ """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policy_assignments/', retention_policy_assignment_id, '/files_under_retention']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/retention_policy_assignments/', + retention_policy_assignment_id, + '/files_under_retention', + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FilesUnderRetention.from_dict(json.loads(response.text)) - def get_retention_policy_assignment_file_version_under_retention(self, retention_policy_assignment_id: str, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FilesUnderRetention: + + def get_retention_policy_assignment_file_version_under_retention( + self, + retention_policy_assignment_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FilesUnderRetention: """ Returns a list of file versions under retention for a retention policy - + assignment. :param retention_policy_assignment_id: The ID of the retention policy assignment. @@ -218,7 +364,25 @@ def get_retention_policy_assignment_file_version_under_retention(self, retention """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/retention_policy_assignments/', retention_policy_assignment_id, '/file_versions_under_retention']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return FilesUnderRetention.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/retention_policy_assignments/', + retention_policy_assignment_id, + '/file_versions_under_retention', + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FilesUnderRetention.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/search.py b/box_sdk_gen/managers/search.py index 5fbd3e1b..531c9321 100644 --- a/box_sdk_gen/managers/search.py +++ b/box_sdk_gen/managers/search.py @@ -40,12 +40,21 @@ from box_sdk_gen.fetch import FetchResponse + class CreateMetadataQueryExecuteReadOrderByArgDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class CreateMetadataQueryExecuteReadOrderByArg(BaseObject): - def __init__(self, field_key: Optional[str] = None, direction: Optional[CreateMetadataQueryExecuteReadOrderByArgDirectionField] = None, **kwargs): + def __init__( + self, + field_key: Optional[str] = None, + direction: Optional[ + CreateMetadataQueryExecuteReadOrderByArgDirectionField + ] = None, + **kwargs + ): """ :param field_key: The metadata template field to order by. The `field_key` represents the `key` value of a field from the @@ -60,49 +69,72 @@ def __init__(self, field_key: Optional[str] = None, direction: Optional[CreateMe self.field_key = field_key self.direction = direction + class GetMetadataQueryIndicesScopeArg(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' + class GetSearchScopeArg(str, Enum): USER_CONTENT = 'user_content' ENTERPRISE_CONTENT = 'enterprise_content' + class GetSearchTypeArg(str, Enum): FILE = 'file' FOLDER = 'folder' WEB_LINK = 'web_link' + class GetSearchTrashContentArg(str, Enum): NON_TRASHED_ONLY = 'non_trashed_only' TRASHED_ONLY = 'trashed_only' ALL_ITEMS = 'all_items' + class GetSearchSortArg(str, Enum): MODIFIED_AT = 'modified_at' RELEVANCE = 'relevance' + class GetSearchDirectionArg(str, Enum): DESC = 'DESC' ASC = 'ASC' + class SearchManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def create_metadata_query_execute_read(self, from_: str, ancestor_folder_id: str, query: Optional[str] = None, query_params: Optional[Dict[str, str]] = None, order_by: Optional[List[CreateMetadataQueryExecuteReadOrderByArg]] = None, limit: Optional[int] = None, marker: Optional[str] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataQueryResults: + + def create_metadata_query_execute_read( + self, + from_: str, + ancestor_folder_id: str, + query: Optional[str] = None, + query_params: Optional[Dict[str, str]] = None, + order_by: Optional[List[CreateMetadataQueryExecuteReadOrderByArg]] = None, + limit: Optional[int] = None, + marker: Optional[str] = None, + fields: Optional[List[str]] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataQueryResults: """ Create a search using SQL-like syntax to return items that match specific - + metadata. - + By default, this endpoint returns only the most basic info about the items for - + which the query matches. To get additional fields for each item, including any - + of the metadata, use the `fields` attribute in the query. :param from_: Specifies the template used in the query. Must be in the form @@ -157,11 +189,37 @@ def create_metadata_query_execute_read(self, from_: str, ancestor_folder_id: str """ if extra_headers is None: extra_headers = {} - request_body: MetadataQuery = MetadataQuery(from_=from_, query=query, query_params=query_params, ancestor_folder_id=ancestor_folder_id, order_by=order_by, limit=limit, marker=marker, fields=fields) + request_body = MetadataQuery( + from_=from_, + query=query, + query_params=query_params, + ancestor_folder_id=ancestor_folder_id, + order_by=order_by, + limit=limit, + marker=marker, + fields=fields, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_queries/execute_read']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_queries/execute_read']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataQueryResults.from_dict(json.loads(response.text)) - def get_metadata_query_indices(self, scope: GetMetadataQueryIndicesScopeArg, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> MetadataQueryIndices: + + def get_metadata_query_indices( + self, + scope: GetMetadataQueryIndicesScopeArg, + template_key: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> MetadataQueryIndices: """ Retrieves the metadata query indices for a given scope and template key. :param scope: The scope of the metadata template @@ -173,14 +231,51 @@ def get_metadata_query_indices(self, scope: GetMetadataQueryIndicesScopeArg, tem """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'scope': to_string(scope), 'template_key': to_string(template_key)}) + query_params_map: Dict[str, str] = prepare_params( + {'scope': to_string(scope), 'template_key': to_string(template_key)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/metadata_query_indices']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/metadata_query_indices']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return MetadataQueryIndices.from_dict(json.loads(response.text)) - def get_search(self, query: Optional[str] = None, scope: Optional[GetSearchScopeArg] = None, file_extensions: Optional[str] = None, created_at_range: Optional[str] = None, updated_at_range: Optional[str] = None, size_range: Optional[str] = None, owner_user_ids: Optional[str] = None, recent_updater_user_ids: Optional[str] = None, ancestor_folder_ids: Optional[str] = None, content_types: Optional[str] = None, type: Optional[GetSearchTypeArg] = None, trash_content: Optional[GetSearchTrashContentArg] = None, mdfilters: Optional[str] = None, sort: Optional[GetSearchSortArg] = None, direction: Optional[GetSearchDirectionArg] = None, limit: Optional[int] = None, include_recent_shared_links: Optional[bool] = None, fields: Optional[str] = None, offset: Optional[int] = None, deleted_user_ids: Optional[str] = None, deleted_at_range: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def get_search( + self, + query: Optional[str] = None, + scope: Optional[GetSearchScopeArg] = None, + file_extensions: Optional[str] = None, + created_at_range: Optional[str] = None, + updated_at_range: Optional[str] = None, + size_range: Optional[str] = None, + owner_user_ids: Optional[str] = None, + recent_updater_user_ids: Optional[str] = None, + ancestor_folder_ids: Optional[str] = None, + content_types: Optional[str] = None, + type: Optional[GetSearchTypeArg] = None, + trash_content: Optional[GetSearchTrashContentArg] = None, + mdfilters: Optional[str] = None, + sort: Optional[GetSearchSortArg] = None, + direction: Optional[GetSearchDirectionArg] = None, + limit: Optional[int] = None, + include_recent_shared_links: Optional[bool] = None, + fields: Optional[str] = None, + offset: Optional[int] = None, + deleted_user_ids: Optional[str] = None, + deleted_at_range: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Searches for files, folders, web links, and shared files across the - + users content or across the entire enterprise. :param query: The string to search for. This query is matched against item names, @@ -388,7 +483,41 @@ def get_search(self, query: Optional[str] = None, scope: Optional[GetSearchScope """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'query': to_string(query), 'scope': to_string(scope), 'file_extensions': to_string(file_extensions), 'created_at_range': to_string(created_at_range), 'updated_at_range': to_string(updated_at_range), 'size_range': to_string(size_range), 'owner_user_ids': to_string(owner_user_ids), 'recent_updater_user_ids': to_string(recent_updater_user_ids), 'ancestor_folder_ids': to_string(ancestor_folder_ids), 'content_types': to_string(content_types), 'type': to_string(type), 'trash_content': to_string(trash_content), 'mdfilters': to_string(mdfilters), 'sort': to_string(sort), 'direction': to_string(direction), 'limit': to_string(limit), 'include_recent_shared_links': to_string(include_recent_shared_links), 'fields': to_string(fields), 'offset': to_string(offset), 'deleted_user_ids': to_string(deleted_user_ids), 'deleted_at_range': to_string(deleted_at_range)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'query': to_string(query), + 'scope': to_string(scope), + 'file_extensions': to_string(file_extensions), + 'created_at_range': to_string(created_at_range), + 'updated_at_range': to_string(updated_at_range), + 'size_range': to_string(size_range), + 'owner_user_ids': to_string(owner_user_ids), + 'recent_updater_user_ids': to_string(recent_updater_user_ids), + 'ancestor_folder_ids': to_string(ancestor_folder_ids), + 'content_types': to_string(content_types), + 'type': to_string(type), + 'trash_content': to_string(trash_content), + 'mdfilters': to_string(mdfilters), + 'sort': to_string(sort), + 'direction': to_string(direction), + 'limit': to_string(limit), + 'include_recent_shared_links': to_string(include_recent_shared_links), + 'fields': to_string(fields), + 'offset': to_string(offset), + 'deleted_user_ids': to_string(deleted_user_ids), + 'deleted_at_range': to_string(deleted_at_range), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/search']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/search']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/session_termination.py b/box_sdk_gen/managers/session_termination.py index 6e871326..2e15a451 100644 --- a/box_sdk_gen/managers/session_termination.py +++ b/box_sdk_gen/managers/session_termination.py @@ -28,20 +28,31 @@ from box_sdk_gen.fetch import FetchResponse + class SessionTerminationManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def create_user_terminate_session(self, user_ids: List[str], user_logins: List[str], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SessionTerminationMessage: + + def create_user_terminate_session( + self, + user_ids: List[str], + user_logins: List[str], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SessionTerminationMessage: """ Validates the roles and permissions of the user, - + and creates asynchronous jobs - + to terminate the user's sessions. - + Returns the status for the POST request. :param user_ids: A list of user IDs @@ -53,20 +64,36 @@ def create_user_terminate_session(self, user_ids: List[str], user_logins: List[s """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(user_ids=user_ids, user_logins=user_logins) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/terminate_sessions']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return SessionTerminationMessage.from_dict(json.loads(response.text)) - def create_group_terminate_session(self, group_ids: List[str], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SessionTerminationMessage: + + def create_group_terminate_session( + self, + group_ids: List[str], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SessionTerminationMessage: """ Validates the roles and permissions of the group, - + and creates asynchronous jobs - + to terminate the group's sessions. - + Returns the status for the POST request. :param group_ids: A list of group IDs @@ -76,7 +103,18 @@ def create_group_terminate_session(self, group_ids: List[str], extra_headers: Op """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(group_ids=group_ids) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return SessionTerminationMessage.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/groups/terminate_sessions']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return SessionTerminationMessage.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/shared_links_files.py b/box_sdk_gen/managers/shared_links_files.py index 1682ce80..abd1e1a9 100644 --- a/box_sdk_gen/managers/shared_links_files.py +++ b/box_sdk_gen/managers/shared_links_files.py @@ -30,13 +30,21 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateFileAddSharedLinkSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateFileAddSharedLinkSharedLinkArgPermissionsField(BaseObject): - def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bool] = None, can_edit: Optional[bool] = None, **kwargs): + def __init__( + self, + can_download: Optional[bool] = None, + can_preview: Optional[bool] = None, + can_edit: Optional[bool] = None, + **kwargs + ): """ :param can_download: If the shared link allows for downloading of files. This can only be set when `access` is set to @@ -58,8 +66,19 @@ def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bo self.can_preview = can_preview self.can_edit = can_edit + class UpdateFileAddSharedLinkSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateFileAddSharedLinkSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[UpdateFileAddSharedLinkSharedLinkArgPermissionsField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateFileAddSharedLinkSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + permissions: Optional[ + UpdateFileAddSharedLinkSharedLinkArgPermissionsField + ] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -98,13 +117,21 @@ def __init__(self, access: Optional[UpdateFileAddSharedLinkSharedLinkArgAccessFi self.unshared_at = unshared_at self.permissions = permissions + class UpdateFileUpdateSharedLinkSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateFileUpdateSharedLinkSharedLinkArgPermissionsField(BaseObject): - def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bool] = None, can_edit: Optional[bool] = None, **kwargs): + def __init__( + self, + can_download: Optional[bool] = None, + can_preview: Optional[bool] = None, + can_edit: Optional[bool] = None, + **kwargs + ): """ :param can_download: If the shared link allows for downloading of files. This can only be set when `access` is set to @@ -126,8 +153,19 @@ def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bo self.can_preview = can_preview self.can_edit = can_edit + class UpdateFileUpdateSharedLinkSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateFileUpdateSharedLinkSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[UpdateFileUpdateSharedLinkSharedLinkArgPermissionsField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateFileUpdateSharedLinkSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + permissions: Optional[ + UpdateFileUpdateSharedLinkSharedLinkArgPermissionsField + ] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -166,33 +204,46 @@ def __init__(self, access: Optional[UpdateFileUpdateSharedLinkSharedLinkArgAcces self.unshared_at = unshared_at self.permissions = permissions + class UpdateFileRemoveSharedLinkSharedLinkArg(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) + class SharedLinksFilesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_shared_items(self, boxapi: str, fields: Optional[str] = None, if_none_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileFull: + + def get_shared_items( + self, + boxapi: str, + fields: Optional[str] = None, + if_none_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileFull: """ Returns the file represented by a shared link. - + A shared file can be represented by a shared link, - + which can originate within the current enterprise or within another. - + This endpoint allows an application to retrieve information about a - + shared file when only given a shared link. - + The `shared_link_permission_options` array field can be returned - + by requesting it in the `fields` query parameter. :param boxapi: A header containing the shared link and optional password for the @@ -221,10 +272,32 @@ def get_shared_items(self, boxapi: str, fields: Optional[str] = None, if_none_ma if extra_headers is None: extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) - headers_map: Dict[str, str] = prepare_params({'if-none-match': to_string(if_none_match), 'boxapi': to_string(boxapi), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shared_items']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + { + 'if-none-match': to_string(if_none_match), + 'boxapi': to_string(boxapi), + **extra_headers, + } + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shared_items']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileFull.from_dict(json.loads(response.text)) - def get_file_get_shared_link(self, file_id: str, fields: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileFull: + + def get_file_get_shared_link( + self, + file_id: str, + fields: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileFull: """ Gets the information for a shared link on a file. :param file_id: The unique identifier that represents a file. @@ -245,9 +318,26 @@ def get_file_get_shared_link(self, file_id: str, fields: str, extra_headers: Opt extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '#get_shared_link']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '#get_shared_link']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileFull.from_dict(json.loads(response.text)) - def update_file_add_shared_link(self, file_id: str, fields: str, shared_link: Optional[UpdateFileAddSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileFull: + + def update_file_add_shared_link( + self, + file_id: str, + fields: str, + shared_link: Optional[UpdateFileAddSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileFull: """ Adds a shared link to a file. :param file_id: The unique identifier that represents a file. @@ -270,12 +360,31 @@ def update_file_add_shared_link(self, file_id: str, fields: str, shared_link: Op """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/files/', file_id, '#add_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '#add_shared_link']), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileFull.from_dict(json.loads(response.text)) - def update_file_update_shared_link(self, file_id: str, fields: str, shared_link: Optional[UpdateFileUpdateSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileFull: + + def update_file_update_shared_link( + self, + file_id: str, + fields: str, + shared_link: Optional[UpdateFileUpdateSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileFull: """ Updates a shared link on a file. :param file_id: The unique identifier that represents a file. @@ -296,12 +405,31 @@ def update_file_update_shared_link(self, file_id: str, fields: str, shared_link: """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/files/', file_id, '#update_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '#update_shared_link']), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FileFull.from_dict(json.loads(response.text)) - def update_file_remove_shared_link(self, file_id: str, fields: str, shared_link: Optional[UpdateFileRemoveSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FileFull: + + def update_file_remove_shared_link( + self, + file_id: str, + fields: str, + shared_link: Optional[UpdateFileRemoveSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FileFull: """ Removes a shared link from a file. :param file_id: The unique identifier that represents a file. @@ -323,8 +451,20 @@ def update_file_remove_shared_link(self, file_id: str, fields: str, shared_link: """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/files/', file_id, '#remove_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return FileFull.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '#remove_shared_link']), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FileFull.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/shared_links_folders.py b/box_sdk_gen/managers/shared_links_folders.py index c0a98940..f09d4075 100644 --- a/box_sdk_gen/managers/shared_links_folders.py +++ b/box_sdk_gen/managers/shared_links_folders.py @@ -30,13 +30,21 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateFolderAddSharedLinkSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateFolderAddSharedLinkSharedLinkArgPermissionsField(BaseObject): - def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bool] = None, can_edit: Optional[bool] = None, **kwargs): + def __init__( + self, + can_download: Optional[bool] = None, + can_preview: Optional[bool] = None, + can_edit: Optional[bool] = None, + **kwargs + ): """ :param can_download: If the shared link allows for downloading of files. This can only be set when `access` is set to @@ -55,8 +63,19 @@ def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bo self.can_preview = can_preview self.can_edit = can_edit + class UpdateFolderAddSharedLinkSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateFolderAddSharedLinkSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[UpdateFolderAddSharedLinkSharedLinkArgPermissionsField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateFolderAddSharedLinkSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + permissions: Optional[ + UpdateFolderAddSharedLinkSharedLinkArgPermissionsField + ] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -95,13 +114,21 @@ def __init__(self, access: Optional[UpdateFolderAddSharedLinkSharedLinkArgAccess self.unshared_at = unshared_at self.permissions = permissions + class UpdateFolderUpdateSharedLinkSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateFolderUpdateSharedLinkSharedLinkArgPermissionsField(BaseObject): - def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bool] = None, can_edit: Optional[bool] = None, **kwargs): + def __init__( + self, + can_download: Optional[bool] = None, + can_preview: Optional[bool] = None, + can_edit: Optional[bool] = None, + **kwargs + ): """ :param can_download: If the shared link allows for downloading of files. This can only be set when `access` is set to @@ -120,8 +147,19 @@ def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bo self.can_preview = can_preview self.can_edit = can_edit + class UpdateFolderUpdateSharedLinkSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateFolderUpdateSharedLinkSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[UpdateFolderUpdateSharedLinkSharedLinkArgPermissionsField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateFolderUpdateSharedLinkSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + permissions: Optional[ + UpdateFolderUpdateSharedLinkSharedLinkArgPermissionsField + ] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -160,27 +198,40 @@ def __init__(self, access: Optional[UpdateFolderUpdateSharedLinkSharedLinkArgAcc self.unshared_at = unshared_at self.permissions = permissions + class UpdateFolderRemoveSharedLinkSharedLinkArg(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) + class SharedLinksFoldersManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_shared_item_folders(self, boxapi: str, fields: Optional[str] = None, if_none_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def get_shared_item_folders( + self, + boxapi: str, + fields: Optional[str] = None, + if_none_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Return the folder represented by a shared link. - + A shared folder can be represented by a shared link, - + which can originate within the current enterprise or within another. - + This endpoint allows an application to retrieve information about a - + shared folder when only given a shared link. :param boxapi: A header containing the shared link and optional password for the @@ -209,10 +260,32 @@ def get_shared_item_folders(self, boxapi: str, fields: Optional[str] = None, if_ if extra_headers is None: extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) - headers_map: Dict[str, str] = prepare_params({'if-none-match': to_string(if_none_match), 'boxapi': to_string(boxapi), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shared_items#folders']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + { + 'if-none-match': to_string(if_none_match), + 'boxapi': to_string(boxapi), + **extra_headers, + } + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shared_items#folders']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderFull.from_dict(json.loads(response.text)) - def get_folder_get_shared_link(self, folder_id: str, fields: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def get_folder_get_shared_link( + self, + folder_id: str, + fields: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Gets the information for a shared link on a folder. :param folder_id: The unique identifier that represent a folder. @@ -235,9 +308,28 @@ def get_folder_get_shared_link(self, folder_id: str, fields: str, extra_headers: extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '#get_shared_link']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/folders/', folder_id, '#get_shared_link'] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderFull.from_dict(json.loads(response.text)) - def update_folder_add_shared_link(self, folder_id: str, fields: str, shared_link: Optional[UpdateFolderAddSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def update_folder_add_shared_link( + self, + folder_id: str, + fields: str, + shared_link: Optional[UpdateFolderAddSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Adds a shared link to a folder. :param folder_id: The unique identifier that represent a folder. @@ -262,12 +354,33 @@ def update_folder_add_shared_link(self, folder_id: str, fields: str, shared_link """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/folders/', folder_id, '#add_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/folders/', folder_id, '#add_shared_link'] + ), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderFull.from_dict(json.loads(response.text)) - def update_folder_update_shared_link(self, folder_id: str, fields: str, shared_link: Optional[UpdateFolderUpdateSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def update_folder_update_shared_link( + self, + folder_id: str, + fields: str, + shared_link: Optional[UpdateFolderUpdateSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Updates a shared link on a folder. :param folder_id: The unique identifier that represent a folder. @@ -290,12 +403,33 @@ def update_folder_update_shared_link(self, folder_id: str, fields: str, shared_l """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/folders/', folder_id, '#update_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/folders/', folder_id, '#update_shared_link'] + ), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return FolderFull.from_dict(json.loads(response.text)) - def update_folder_remove_shared_link(self, folder_id: str, fields: str, shared_link: Optional[UpdateFolderRemoveSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def update_folder_remove_shared_link( + self, + folder_id: str, + fields: str, + shared_link: Optional[UpdateFolderRemoveSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Removes a shared link from a folder. :param folder_id: The unique identifier that represent a folder. @@ -319,8 +453,22 @@ def update_folder_remove_shared_link(self, folder_id: str, fields: str, shared_l """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/folders/', folder_id, '#remove_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return FolderFull.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/folders/', folder_id, '#remove_shared_link'] + ), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FolderFull.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/shared_links_web_links.py b/box_sdk_gen/managers/shared_links_web_links.py index 92c4e0f3..4b6f8d55 100644 --- a/box_sdk_gen/managers/shared_links_web_links.py +++ b/box_sdk_gen/managers/shared_links_web_links.py @@ -30,13 +30,21 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateWebLinkAddSharedLinkSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateWebLinkAddSharedLinkSharedLinkArgPermissionsField(BaseObject): - def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bool] = None, can_edit: Optional[bool] = None, **kwargs): + def __init__( + self, + can_download: Optional[bool] = None, + can_preview: Optional[bool] = None, + can_edit: Optional[bool] = None, + **kwargs + ): """ :param can_download: If the shared link allows for downloading of files. This can only be set when `access` is set to @@ -54,8 +62,19 @@ def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bo self.can_preview = can_preview self.can_edit = can_edit + class UpdateWebLinkAddSharedLinkSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateWebLinkAddSharedLinkSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[UpdateWebLinkAddSharedLinkSharedLinkArgPermissionsField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateWebLinkAddSharedLinkSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + permissions: Optional[ + UpdateWebLinkAddSharedLinkSharedLinkArgPermissionsField + ] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -94,13 +113,21 @@ def __init__(self, access: Optional[UpdateWebLinkAddSharedLinkSharedLinkArgAcces self.unshared_at = unshared_at self.permissions = permissions + class UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateWebLinkUpdateSharedLinkSharedLinkArgPermissionsField(BaseObject): - def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bool] = None, can_edit: Optional[bool] = None, **kwargs): + def __init__( + self, + can_download: Optional[bool] = None, + can_preview: Optional[bool] = None, + can_edit: Optional[bool] = None, + **kwargs + ): """ :param can_download: If the shared link allows for downloading of files. This can only be set when `access` is set to @@ -118,8 +145,19 @@ def __init__(self, can_download: Optional[bool] = None, can_preview: Optional[bo self.can_preview = can_preview self.can_edit = can_edit + class UpdateWebLinkUpdateSharedLinkSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArgPermissionsField] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + permissions: Optional[ + UpdateWebLinkUpdateSharedLinkSharedLinkArgPermissionsField + ] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -158,27 +196,40 @@ def __init__(self, access: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArgAc self.unshared_at = unshared_at self.permissions = permissions + class UpdateWebLinkRemoveSharedLinkSharedLinkArg(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) + class SharedLinksWebLinksManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_shared_item_web_links(self, boxapi: str, fields: Optional[str] = None, if_none_match: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> WebLink: + + def get_shared_item_web_links( + self, + boxapi: str, + fields: Optional[str] = None, + if_none_match: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> WebLink: """ Returns the web link represented by a shared link. - + A shared web link can be represented by a shared link, - + which can originate within the current enterprise or within another. - + This endpoint allows an application to retrieve information about a - + shared web link when only given a shared link. :param boxapi: A header containing the shared link and optional password for the @@ -207,10 +258,32 @@ def get_shared_item_web_links(self, boxapi: str, fields: Optional[str] = None, i if extra_headers is None: extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) - headers_map: Dict[str, str] = prepare_params({'if-none-match': to_string(if_none_match), 'boxapi': to_string(boxapi), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shared_items#web_links']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + { + 'if-none-match': to_string(if_none_match), + 'boxapi': to_string(boxapi), + **extra_headers, + } + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shared_items#web_links']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return WebLink.from_dict(json.loads(response.text)) - def get_web_link_get_shared_link(self, web_link_id: str, fields: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> WebLink: + + def get_web_link_get_shared_link( + self, + web_link_id: str, + fields: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> WebLink: """ Gets the information for a shared link on a web link. :param web_link_id: The ID of the web link. @@ -226,9 +299,28 @@ def get_web_link_get_shared_link(self, web_link_id: str, fields: str, extra_head extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/web_links/', web_link_id, '#get_shared_link']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/web_links/', web_link_id, '#get_shared_link'] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return WebLink.from_dict(json.loads(response.text)) - def update_web_link_add_shared_link(self, web_link_id: str, fields: str, shared_link: Optional[UpdateWebLinkAddSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> WebLink: + + def update_web_link_add_shared_link( + self, + web_link_id: str, + fields: str, + shared_link: Optional[UpdateWebLinkAddSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> WebLink: """ Adds a shared link to a web link. :param web_link_id: The ID of the web link. @@ -246,12 +338,33 @@ def update_web_link_add_shared_link(self, web_link_id: str, fields: str, shared_ """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/web_links/', web_link_id, '#add_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/web_links/', web_link_id, '#add_shared_link'] + ), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return WebLink.from_dict(json.loads(response.text)) - def update_web_link_update_shared_link(self, web_link_id: str, fields: str, shared_link: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> WebLink: + + def update_web_link_update_shared_link( + self, + web_link_id: str, + fields: str, + shared_link: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> WebLink: """ Updates a shared link on a web link. :param web_link_id: The ID of the web link. @@ -267,12 +380,37 @@ def update_web_link_update_shared_link(self, web_link_id: str, fields: str, shar """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/web_links/', web_link_id, '#update_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/web_links/', + web_link_id, + '#update_shared_link', + ] + ), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return WebLink.from_dict(json.loads(response.text)) - def update_web_link_remove_shared_link(self, web_link_id: str, fields: str, shared_link: Optional[UpdateWebLinkRemoveSharedLinkSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> WebLink: + + def update_web_link_remove_shared_link( + self, + web_link_id: str, + fields: str, + shared_link: Optional[UpdateWebLinkRemoveSharedLinkSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> WebLink: """ Removes a shared link from a web link. :param web_link_id: The ID of the web link. @@ -289,8 +427,26 @@ def update_web_link_remove_shared_link(self, web_link_id: str, fields: str, shar """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shared_link=shared_link) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/web_links/', web_link_id, '#remove_shared_link']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return WebLink.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/web_links/', + web_link_id, + '#remove_shared_link', + ] + ), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return WebLink.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/shield_information_barrier_reports.py b/box_sdk_gen/managers/shield_information_barrier_reports.py index 07d8955c..c0c84bff 100644 --- a/box_sdk_gen/managers/shield_information_barrier_reports.py +++ b/box_sdk_gen/managers/shield_information_barrier_reports.py @@ -28,11 +28,23 @@ from box_sdk_gen.fetch import FetchResponse + class ShieldInformationBarrierReportsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_shield_information_barrier_reports(self, shield_information_barrier_id: str, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def get_shield_information_barrier_reports( + self, + shield_information_barrier_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Lists shield information barrier reports with specific IDs. :param shield_information_barrier_id: The ID of the shield information barrier. @@ -48,11 +60,34 @@ def get_shield_information_barrier_reports(self, shield_information_barrier_id: """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'shield_information_barrier_id': to_string(shield_information_barrier_id), 'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'shield_information_barrier_id': to_string( + shield_information_barrier_id + ), + 'marker': to_string(marker), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_reports']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shield_information_barrier_reports']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_shield_information_barrier_report(self, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierReport: + + def create_shield_information_barrier_report( + self, + shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierReport: """ Creates a shield information barrier report for a given barrier. :param extra_headers: Extra headers that will be included in the HTTP request. @@ -60,11 +95,29 @@ def create_shield_information_barrier_report(self, shield_information_barrier: O """ if extra_headers is None: extra_headers = {} - request_body: ShieldInformationBarrierReference = ShieldInformationBarrierReference(shield_information_barrier=shield_information_barrier) + request_body = ShieldInformationBarrierReference( + 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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shield_information_barrier_reports']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ShieldInformationBarrierReport.from_dict(json.loads(response.text)) - def get_shield_information_barrier_report_by_id(self, shield_information_barrier_report_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierReport: + + def get_shield_information_barrier_report_by_id( + self, + shield_information_barrier_report_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierReport: """ Retrieves a shield information barrier report by its ID. :param shield_information_barrier_report_id: The ID of the shield information barrier Report. @@ -76,5 +129,19 @@ def get_shield_information_barrier_report_by_id(self, shield_information_barrier if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_reports/', shield_information_barrier_report_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return ShieldInformationBarrierReport.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_reports/', + shield_information_barrier_report_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ShieldInformationBarrierReport.from_dict(json.loads(response.text)) 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 f450eba6..d8725238 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segment_members.py +++ b/box_sdk_gen/managers/shield_information_barrier_segment_members.py @@ -34,14 +34,30 @@ from box_sdk_gen.fetch import FetchResponse + class CreateShieldInformationBarrierSegmentMemberTypeArg(str, Enum): - SHIELD_INFORMATION_BARRIER_SEGMENT_MEMBER = 'shield_information_barrier_segment_member' + SHIELD_INFORMATION_BARRIER_SEGMENT_MEMBER = ( + 'shield_information_barrier_segment_member' + ) + -class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField(str, Enum): +class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField( + str, Enum +): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' -class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField] = None, **kwargs): + +class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg( + BaseObject +): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ + CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField + ] = None, + **kwargs + ): """ :param id: The ID reference of the requesting shield information barrier segment. @@ -53,14 +69,24 @@ def __init__(self, id: Optional[str] = None, type: Optional[CreateShieldInformat self.id = id self.type = type + class ShieldInformationBarrierSegmentMembersManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_shield_information_barrier_segment_member_by_id(self, shield_information_barrier_segment_member_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierSegmentMember: + + def get_shield_information_barrier_segment_member_by_id( + self, + shield_information_barrier_segment_member_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierSegmentMember: """ Retrieves a shield information barrier - + segment member by its ID. :param shield_information_barrier_segment_member_id: The ID of the shield information barrier segment Member. @@ -72,12 +98,33 @@ def get_shield_information_barrier_segment_member_by_id(self, shield_information if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segment_members/', shield_information_barrier_segment_member_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return ShieldInformationBarrierSegmentMember.from_dict(json.loads(response.text)) - def delete_shield_information_barrier_segment_member_by_id(self, shield_information_barrier_segment_member_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segment_members/', + shield_information_barrier_segment_member_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ShieldInformationBarrierSegmentMember.from_dict( + json.loads(response.text) + ) + + def delete_shield_information_barrier_segment_member_by_id( + self, + shield_information_barrier_segment_member_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a shield information barrier - + segment member based on provided ID. :param shield_information_barrier_segment_member_id: The ID of the shield information barrier segment Member. @@ -89,12 +136,33 @@ def delete_shield_information_barrier_segment_member_by_id(self, shield_informat if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segment_members/', shield_information_barrier_segment_member_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segment_members/', + shield_information_barrier_segment_member_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_shield_information_barrier_segment_members(self, shield_information_barrier_segment_id: str, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def get_shield_information_barrier_segment_members( + self, + shield_information_barrier_segment_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Lists shield information barrier segment members - + based on provided segment IDs. :param shield_information_barrier_segment_id: The ID of the shield information barrier segment. @@ -110,11 +178,39 @@ def get_shield_information_barrier_segment_members(self, shield_information_barr """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'shield_information_barrier_segment_id': to_string(shield_information_barrier_segment_id), 'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'shield_information_barrier_segment_id': to_string( + shield_information_barrier_segment_id + ), + 'marker': to_string(marker), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segment_members']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/shield_information_barrier_segment_members'] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_shield_information_barrier_segment_member(self, shield_information_barrier_segment: CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg, user: UserBase, type: Optional[CreateShieldInformationBarrierSegmentMemberTypeArg] = None, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierSegmentMember: + + def create_shield_information_barrier_segment_member( + self, + shield_information_barrier_segment: CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg, + user: UserBase, + type: Optional[CreateShieldInformationBarrierSegmentMemberTypeArg] = None, + shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierSegmentMember: """ Creates a new shield information barrier segment member. :param shield_information_barrier_segment: The `type` and `id` of the @@ -127,7 +223,27 @@ def create_shield_information_barrier_segment_member(self, shield_information_ba """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(type=type, shield_information_barrier=shield_information_barrier, shield_information_barrier_segment=shield_information_barrier_segment, user=user) + request_body = BaseObject( + type=type, + shield_information_barrier=shield_information_barrier, + shield_information_barrier_segment=shield_information_barrier_segment, + user=user, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segment_members']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return ShieldInformationBarrierSegmentMember.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/shield_information_barrier_segment_members'] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ShieldInformationBarrierSegmentMember.from_dict( + json.loads(response.text) + ) 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 b4ee3924..b2991ed4 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py +++ b/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py @@ -32,14 +32,30 @@ from box_sdk_gen.fetch import FetchResponse + class CreateShieldInformationBarrierSegmentRestrictionTypeArg(str, Enum): - SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION = 'shield_information_barrier_segment_restriction' + SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION = ( + 'shield_information_barrier_segment_restriction' + ) + -class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField(str, Enum): +class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField( + str, Enum +): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' -class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField] = None, **kwargs): + +class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg( + BaseObject +): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ + CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField + ] = None, + **kwargs + ): """ :param id: The ID reference of the requesting shield information barrier segment. @@ -51,11 +67,22 @@ def __init__(self, id: Optional[str] = None, type: Optional[CreateShieldInformat self.id = id self.type = type -class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField(str, Enum): + +class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField( + str, Enum +): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' + class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ + CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField + ] = None, + **kwargs + ): """ :param id: The ID reference of the restricted shield information barrier segment. @@ -68,14 +95,24 @@ def __init__(self, id: Optional[str] = None, type: Optional[CreateShieldInformat self.id = id self.type = type + class ShieldInformationBarrierSegmentRestrictionsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_shield_information_barrier_segment_restriction_by_id(self, shield_information_barrier_segment_restriction_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierSegmentRestriction: + + def get_shield_information_barrier_segment_restriction_by_id( + self, + shield_information_barrier_segment_restriction_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierSegmentRestriction: """ Retrieves a shield information barrier segment - + restriction based on provided ID. :param shield_information_barrier_segment_restriction_id: The ID of the shield information barrier segment Restriction. @@ -87,12 +124,33 @@ def get_shield_information_barrier_segment_restriction_by_id(self, shield_inform if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segment_restrictions/', shield_information_barrier_segment_restriction_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return ShieldInformationBarrierSegmentRestriction.from_dict(json.loads(response.text)) - def delete_shield_information_barrier_segment_restriction_by_id(self, shield_information_barrier_segment_restriction_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segment_restrictions/', + shield_information_barrier_segment_restriction_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ShieldInformationBarrierSegmentRestriction.from_dict( + json.loads(response.text) + ) + + def delete_shield_information_barrier_segment_restriction_by_id( + self, + shield_information_barrier_segment_restriction_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Delete shield information barrier segment restriction - + based on provided ID. :param shield_information_barrier_segment_restriction_id: The ID of the shield information barrier segment Restriction. @@ -104,12 +162,33 @@ def delete_shield_information_barrier_segment_restriction_by_id(self, shield_inf if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segment_restrictions/', shield_information_barrier_segment_restriction_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segment_restrictions/', + shield_information_barrier_segment_restriction_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_shield_information_barrier_segment_restrictions(self, shield_information_barrier_segment_id: str, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def get_shield_information_barrier_segment_restrictions( + self, + shield_information_barrier_segment_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Lists shield information barrier segment restrictions - + based on provided segment ID. :param shield_information_barrier_segment_id: The ID of the shield information barrier segment. @@ -125,14 +204,44 @@ def get_shield_information_barrier_segment_restrictions(self, shield_information """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'shield_information_barrier_segment_id': to_string(shield_information_barrier_segment_id), 'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'shield_information_barrier_segment_id': to_string( + shield_information_barrier_segment_id + ), + 'marker': to_string(marker), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segment_restrictions']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segment_restrictions' + ] + ), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_shield_information_barrier_segment_restriction(self, type: CreateShieldInformationBarrierSegmentRestrictionTypeArg, shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg, restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierSegmentRestriction: + + def create_shield_information_barrier_segment_restriction( + self, + type: CreateShieldInformationBarrierSegmentRestrictionTypeArg, + shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg, + restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg, + shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierSegmentRestriction: """ Creates a shield information barrier - + segment restriction object. :param type: The type of the shield barrier segment @@ -149,7 +258,29 @@ def create_shield_information_barrier_segment_restriction(self, type: CreateShie """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(type=type, shield_information_barrier=shield_information_barrier, shield_information_barrier_segment=shield_information_barrier_segment, restricted_segment=restricted_segment) + request_body = BaseObject( + type=type, + shield_information_barrier=shield_information_barrier, + shield_information_barrier_segment=shield_information_barrier_segment, + restricted_segment=restricted_segment, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segment_restrictions']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return ShieldInformationBarrierSegmentRestriction.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segment_restrictions' + ] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ShieldInformationBarrierSegmentRestriction.from_dict( + json.loads(response.text) + ) diff --git a/box_sdk_gen/managers/shield_information_barrier_segments.py b/box_sdk_gen/managers/shield_information_barrier_segments.py index 82c7845e..49e280be 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segments.py +++ b/box_sdk_gen/managers/shield_information_barrier_segments.py @@ -28,11 +28,21 @@ from box_sdk_gen.fetch import FetchResponse + class ShieldInformationBarrierSegmentsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_shield_information_barrier_segment_by_id(self, shield_information_barrier_segment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierSegment: + + def get_shield_information_barrier_segment_by_id( + self, + shield_information_barrier_segment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierSegment: """ Retrieves shield information barrier segment based on provided ID.. :param shield_information_barrier_segment_id: The ID of the shield information barrier segment. @@ -44,9 +54,30 @@ def get_shield_information_barrier_segment_by_id(self, shield_information_barrie if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segments/', shield_information_barrier_segment_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segments/', + shield_information_barrier_segment_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ShieldInformationBarrierSegment.from_dict(json.loads(response.text)) - def update_shield_information_barrier_segment_by_id(self, shield_information_barrier_segment_id: str, name: Optional[str] = None, description: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierSegment: + + def update_shield_information_barrier_segment_by_id( + self, + shield_information_barrier_segment_id: str, + name: Optional[str] = None, + description: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierSegment: """ Updates the shield information barrier segment based on provided ID.. :param shield_information_barrier_segment_id: The ID of the shield information barrier segment. @@ -62,14 +93,35 @@ def update_shield_information_barrier_segment_by_id(self, shield_information_bar """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, description=description) + request_body = BaseObject(name=name, description=description) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segments/', shield_information_barrier_segment_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segments/', + shield_information_barrier_segment_id, + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ShieldInformationBarrierSegment.from_dict(json.loads(response.text)) - def delete_shield_information_barrier_segment_by_id(self, shield_information_barrier_segment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_shield_information_barrier_segment_by_id( + self, + shield_information_barrier_segment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes the shield information barrier segment - + based on provided ID. :param shield_information_barrier_segment_id: The ID of the shield information barrier segment. @@ -81,12 +133,33 @@ def delete_shield_information_barrier_segment_by_id(self, shield_information_bar if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segments/', shield_information_barrier_segment_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barrier_segments/', + shield_information_barrier_segment_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_shield_information_barrier_segments(self, shield_information_barrier_id: str, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def get_shield_information_barrier_segments( + self, + shield_information_barrier_id: str, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Retrieves a list of shield information barrier segment objects - + for the specified Information Barrier ID. :param shield_information_barrier_id: The ID of the shield information barrier. @@ -102,11 +175,36 @@ def get_shield_information_barrier_segments(self, shield_information_barrier_id: """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'shield_information_barrier_id': to_string(shield_information_barrier_id), 'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'shield_information_barrier_id': to_string( + shield_information_barrier_id + ), + 'marker': to_string(marker), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segments']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shield_information_barrier_segments']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_shield_information_barrier_segment(self, shield_information_barrier: ShieldInformationBarrierBase, name: str, description: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrierSegment: + + def create_shield_information_barrier_segment( + self, + shield_information_barrier: ShieldInformationBarrierBase, + name: str, + description: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrierSegment: """ Creates a shield information barrier segment. :param name: Name of the shield information barrier segment @@ -118,7 +216,22 @@ def create_shield_information_barrier_segment(self, shield_information_barrier: """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(shield_information_barrier=shield_information_barrier, name=name, description=description) + request_body = BaseObject( + shield_information_barrier=shield_information_barrier, + name=name, + description=description, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barrier_segments']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return ShieldInformationBarrierSegment.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shield_information_barrier_segments']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ShieldInformationBarrierSegment.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/shield_information_barriers.py b/box_sdk_gen/managers/shield_information_barriers.py index 241b2333..8fda88e7 100644 --- a/box_sdk_gen/managers/shield_information_barriers.py +++ b/box_sdk_gen/managers/shield_information_barriers.py @@ -32,13 +32,16 @@ from box_sdk_gen.fetch import FetchResponse + class CreateShieldInformationBarrierChangeStatusStatusArg(str, Enum): PENDING = 'pending' DISABLED = 'disabled' + class CreateShieldInformationBarrierTypeArg(str, Enum): SHIELD_INFORMATION_BARRIER = 'shield_information_barrier' + class CreateShieldInformationBarrierStatusArg(str, Enum): DRAFT = 'draft' PENDING = 'pending' @@ -46,11 +49,21 @@ class CreateShieldInformationBarrierStatusArg(str, Enum): ENABLED = 'enabled' INVALID = 'invalid' + class ShieldInformationBarriersManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_shield_information_barrier_by_id(self, shield_information_barrier_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrier: + + def get_shield_information_barrier_by_id( + self, + shield_information_barrier_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrier: """ Get shield information barrier based on provided ID.. :param shield_information_barrier_id: The ID of the shield information barrier. @@ -62,9 +75,29 @@ def get_shield_information_barrier_by_id(self, shield_information_barrier_id: st if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barriers/', shield_information_barrier_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/shield_information_barriers/', + shield_information_barrier_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ShieldInformationBarrier.from_dict(json.loads(response.text)) - def create_shield_information_barrier_change_status(self, id: str, status: CreateShieldInformationBarrierChangeStatusStatusArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrier: + + def create_shield_information_barrier_change_status( + self, + id: str, + status: CreateShieldInformationBarrierChangeStatusStatusArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrier: """ Change status of shield information barrier with the specified ID. :param id: The ID of the shield information barrier. @@ -76,14 +109,33 @@ def create_shield_information_barrier_change_status(self, id: str, status: Creat """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(id=id, status=status) + request_body = BaseObject(id=id, status=status) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barriers/change_status']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/shield_information_barriers/change_status'] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ShieldInformationBarrier.from_dict(json.loads(response.text)) - def get_shield_information_barriers(self, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def get_shield_information_barriers( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Retrieves a list of shield information barrier objects - + for the enterprise of JWT. :param marker: Defines the position marker at which to begin returning results. This is @@ -97,17 +149,43 @@ def get_shield_information_barriers(self, marker: Optional[str] = None, limit: O """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barriers']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shield_information_barriers']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_shield_information_barrier(self, id: Optional[str] = None, type: Optional[CreateShieldInformationBarrierTypeArg] = None, enterprise: Optional[EnterpriseBase] = None, status: Optional[CreateShieldInformationBarrierStatusArg] = None, created_at: Optional[str] = None, created_by: Optional[UserBase] = None, updated_at: Optional[str] = None, updated_by: Optional[UserBase] = None, enabled_at: Optional[str] = None, enabled_by: Optional[UserBase] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ShieldInformationBarrier: + + def create_shield_information_barrier( + self, + id: Optional[str] = None, + type: Optional[CreateShieldInformationBarrierTypeArg] = None, + enterprise: Optional[EnterpriseBase] = None, + status: Optional[CreateShieldInformationBarrierStatusArg] = None, + created_at: Optional[str] = None, + created_by: Optional[UserBase] = None, + updated_at: Optional[str] = None, + updated_by: Optional[UserBase] = None, + enabled_at: Optional[str] = None, + enabled_by: Optional[UserBase] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ShieldInformationBarrier: """ Creates a shield information barrier to - + separate individuals/groups within the same - + firm and prevents confidential information passing between them. :param id: The unique identifier for the shield information barrier @@ -128,7 +206,29 @@ def create_shield_information_barrier(self, id: Optional[str] = None, type: Opti """ if extra_headers is None: extra_headers = {} - request_body: ShieldInformationBarrier = ShieldInformationBarrier(id=id, type=type, enterprise=enterprise, status=status, created_at=created_at, created_by=created_by, updated_at=updated_at, updated_by=updated_by, enabled_at=enabled_at, enabled_by=enabled_by) + request_body = ShieldInformationBarrier( + id=id, + type=type, + enterprise=enterprise, + status=status, + created_at=created_at, + created_by=created_by, + updated_at=updated_at, + updated_by=updated_by, + enabled_at=enabled_at, + enabled_by=enabled_by, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/shield_information_barriers']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return ShieldInformationBarrier.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/shield_information_barriers']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ShieldInformationBarrier.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/sign_requests.py b/box_sdk_gen/managers/sign_requests.py index bca51a81..15661f71 100644 --- a/box_sdk_gen/managers/sign_requests.py +++ b/box_sdk_gen/managers/sign_requests.py @@ -38,11 +38,21 @@ from box_sdk_gen.fetch import FetchResponse + class SignRequestsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def cancel_sign_request(self, sign_request_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SignRequest: + + def cancel_sign_request( + self, + sign_request_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SignRequest: """ Cancels a sign request. :param sign_request_id: The ID of the sign request @@ -54,9 +64,25 @@ def cancel_sign_request(self, sign_request_id: str, extra_headers: Optional[Dict if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/sign_requests/', sign_request_id, '/cancel']), FetchOptions(method='POST', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/sign_requests/', sign_request_id, '/cancel'] + ), + FetchOptions( + method='POST', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return SignRequest.from_dict(json.loads(response.text)) - def resend_sign_request(self, sign_request_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def resend_sign_request( + self, + sign_request_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Resends a sign request email to all outstanding signers. :param sign_request_id: The ID of the sign request @@ -68,9 +94,25 @@ def resend_sign_request(self, sign_request_id: str, extra_headers: Optional[Dict if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/sign_requests/', sign_request_id, '/resend']), FetchOptions(method='POST', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/sign_requests/', sign_request_id, '/resend'] + ), + FetchOptions( + method='POST', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def get_sign_request_by_id(self, sign_request_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SignRequest: + + def get_sign_request_by_id( + self, + sign_request_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SignRequest: """ Gets a sign request by ID. :param sign_request_id: The ID of the sign request @@ -82,12 +124,27 @@ def get_sign_request_by_id(self, sign_request_id: str, extra_headers: Optional[D if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/sign_requests/', sign_request_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/sign_requests/', sign_request_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return SignRequest.from_dict(json.loads(response.text)) - def get_sign_requests(self, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SignRequests: + + def get_sign_requests( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SignRequests: """ Gets sign requests created by a user. If the `sign_files` and/or - + `parent_folder` are deleted, the sign request will not return in the list. :param marker: Defines the position marker at which to begin returning results. This is @@ -101,14 +158,46 @@ def get_sign_requests(self, marker: Optional[str] = None, limit: Optional[int] = """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/sign_requests']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/sign_requests']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return SignRequests.from_dict(json.loads(response.text)) - def create_sign_request(self, signers: List[SignRequestCreateSigner], parent_folder: FolderMini, source_files: Optional[List[FileBase]] = None, is_document_preparation_needed: Optional[bool] = None, redirect_url: Optional[str] = None, declined_redirect_url: Optional[str] = None, are_text_signatures_enabled: Optional[bool] = None, email_subject: Optional[str] = None, email_message: Optional[str] = None, are_reminders_enabled: Optional[bool] = None, name: Optional[str] = None, prefill_tags: Optional[List[SignRequestPrefillTag]] = None, days_valid: Optional[int] = None, external_id: Optional[str] = None, is_phone_verification_required_to_view: Optional[bool] = None, template_id: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SignRequest: + + def create_sign_request( + self, + signers: List[SignRequestCreateSigner], + parent_folder: FolderMini, + source_files: Optional[List[FileBase]] = None, + is_document_preparation_needed: Optional[bool] = None, + redirect_url: Optional[str] = None, + declined_redirect_url: Optional[str] = None, + are_text_signatures_enabled: Optional[bool] = None, + email_subject: Optional[str] = None, + email_message: Optional[str] = None, + are_reminders_enabled: Optional[bool] = None, + name: Optional[str] = None, + prefill_tags: Optional[List[SignRequestPrefillTag]] = None, + days_valid: Optional[int] = None, + external_id: Optional[str] = None, + is_phone_verification_required_to_view: Optional[bool] = None, + template_id: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SignRequest: """ Creates a sign request. This involves preparing a document for signing and - + sending the sign request to signers. :param signers: Array of signers for the sign request. 35 is the @@ -147,7 +236,35 @@ def create_sign_request(self, signers: List[SignRequestCreateSigner], parent_fol """ if extra_headers is None: extra_headers = {} - request_body: SignRequestCreateRequest = SignRequestCreateRequest(source_files=source_files, signers=signers, is_document_preparation_needed=is_document_preparation_needed, redirect_url=redirect_url, declined_redirect_url=declined_redirect_url, are_text_signatures_enabled=are_text_signatures_enabled, email_subject=email_subject, email_message=email_message, are_reminders_enabled=are_reminders_enabled, parent_folder=parent_folder, name=name, prefill_tags=prefill_tags, days_valid=days_valid, external_id=external_id, is_phone_verification_required_to_view=is_phone_verification_required_to_view, template_id=template_id) + request_body = SignRequestCreateRequest( + source_files=source_files, + signers=signers, + is_document_preparation_needed=is_document_preparation_needed, + redirect_url=redirect_url, + declined_redirect_url=declined_redirect_url, + are_text_signatures_enabled=are_text_signatures_enabled, + email_subject=email_subject, + email_message=email_message, + are_reminders_enabled=are_reminders_enabled, + parent_folder=parent_folder, + name=name, + prefill_tags=prefill_tags, + days_valid=days_valid, + external_id=external_id, + is_phone_verification_required_to_view=is_phone_verification_required_to_view, + template_id=template_id, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/sign_requests']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return SignRequest.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/sign_requests']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return SignRequest.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/sign_templates.py b/box_sdk_gen/managers/sign_templates.py index 8cf422ab..074acab8 100644 --- a/box_sdk_gen/managers/sign_templates.py +++ b/box_sdk_gen/managers/sign_templates.py @@ -26,11 +26,22 @@ from box_sdk_gen.fetch import FetchResponse + class SignTemplatesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_sign_templates(self, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SignTemplates: + + def get_sign_templates( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SignTemplates: """ Gets Box Sign templates created by a user. :param marker: Defines the position marker at which to begin returning results. This is @@ -44,11 +55,26 @@ def get_sign_templates(self, marker: Optional[str] = None, limit: Optional[int] """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/sign_templates']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/sign_templates']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return SignTemplates.from_dict(json.loads(response.text)) - def get_sign_template_by_id(self, template_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SignTemplate: + + def get_sign_template_by_id( + self, template_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> SignTemplate: """ Fetches details of a specific Box Sign template. :param template_id: The ID of a Box Sign template. @@ -60,5 +86,14 @@ def get_sign_template_by_id(self, template_id: str, extra_headers: Optional[Dict if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/sign_templates/', template_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return SignTemplate.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/sign_templates/', template_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return SignTemplate.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/skills.py b/box_sdk_gen/managers/skills.py index c6c40493..e5fc6076 100644 --- a/box_sdk_gen/managers/skills.py +++ b/box_sdk_gen/managers/skills.py @@ -42,11 +42,26 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField(str, Enum): REPLACE = 'replace' + class UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg(BaseObject): - def __init__(self, op: Optional[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField] = None, path: Optional[str] = None, value: Optional[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]] = None, **kwargs): + def __init__( + self, + op: Optional[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField] = None, + path: Optional[str] = None, + value: Optional[ + Union[ + KeywordSkillCard, + TimelineSkillCard, + TranscriptSkillCard, + StatusSkillCard, + ] + ] = None, + **kwargs + ): """ :param op: `replace` :type op: Optional[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField], optional @@ -60,6 +75,7 @@ def __init__(self, op: Optional[UpdateFileMetadataGlobalBoxSkillsCardRequestBody self.path = path self.value = value + class UpdateSkillInvocationByIdStatusArg(str, Enum): INVOKED = 'invoked' PROCESSING = 'processing' @@ -67,8 +83,22 @@ class UpdateSkillInvocationByIdStatusArg(str, Enum): TRANSIENT_FAILURE = 'transient_failure' PERMANENT_FAILURE = 'permanent_failure' + class UpdateSkillInvocationByIdMetadataArg(BaseObject): - def __init__(self, cards: Optional[List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]] = None, **kwargs): + def __init__( + self, + cards: Optional[ + List[ + Union[ + KeywordSkillCard, + TimelineSkillCard, + TranscriptSkillCard, + StatusSkillCard, + ] + ] + ] = None, + **kwargs + ): """ :param cards: A list of Box Skill cards to apply to this file. :type cards: Optional[List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]], optional @@ -76,11 +106,18 @@ def __init__(self, cards: Optional[List[Union[KeywordSkillCard, TimelineSkillCar super().__init__(**kwargs) self.cards = cards + class UpdateSkillInvocationByIdFileArgTypeField(str, Enum): FILE = 'file' + class UpdateSkillInvocationByIdFileArg(BaseObject): - def __init__(self, type: Optional[UpdateSkillInvocationByIdFileArgTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[UpdateSkillInvocationByIdFileArgTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `file` :type type: Optional[UpdateSkillInvocationByIdFileArgTypeField], optional @@ -91,11 +128,18 @@ def __init__(self, type: Optional[UpdateSkillInvocationByIdFileArgTypeField] = N self.type = type self.id = id + class UpdateSkillInvocationByIdFileVersionArgTypeField(str, Enum): FILE_VERSION = 'file_version' + class UpdateSkillInvocationByIdFileVersionArg(BaseObject): - def __init__(self, type: Optional[UpdateSkillInvocationByIdFileVersionArgTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[UpdateSkillInvocationByIdFileVersionArgTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `file_version` :type type: Optional[UpdateSkillInvocationByIdFileVersionArgTypeField], optional @@ -106,8 +150,11 @@ def __init__(self, type: Optional[UpdateSkillInvocationByIdFileVersionArgTypeFie self.type = type self.id = id + class UpdateSkillInvocationByIdUsageArg(BaseObject): - def __init__(self, unit: Optional[str] = None, value: Optional[int] = None, **kwargs): + def __init__( + self, unit: Optional[str] = None, value: Optional[int] = None, **kwargs + ): """ :param unit: `file` :type unit: Optional[str], optional @@ -118,11 +165,19 @@ def __init__(self, unit: Optional[str] = None, value: Optional[int] = None, **kw self.unit = unit self.value = value + class SkillsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_metadata_global_box_skills_cards(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SkillCardsMetadata: + + def get_file_metadata_global_box_skills_cards( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> SkillCardsMetadata: """ List the Box Skills metadata cards that are attached to a file. :param file_id: The unique identifier that represents a file. @@ -139,9 +194,37 @@ def get_file_metadata_global_box_skills_cards(self, file_id: str, extra_headers: if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/global/boxSkillsCards']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/global/boxSkillsCards', + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return SkillCardsMetadata.from_dict(json.loads(response.text)) - def create_file_metadata_global_box_skills_card(self, file_id: str, cards: List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SkillCardsMetadata: + + def create_file_metadata_global_box_skills_card( + self, + file_id: str, + cards: List[ + Union[ + KeywordSkillCard, + TimelineSkillCard, + TranscriptSkillCard, + StatusSkillCard, + ] + ], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SkillCardsMetadata: """ Applies one or more Box Skills metadata cards to a file. :param file_id: The unique identifier that represents a file. @@ -159,11 +242,34 @@ def create_file_metadata_global_box_skills_card(self, file_id: str, cards: List[ """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(cards=cards) + request_body = BaseObject(cards=cards) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/global/boxSkillsCards']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/global/boxSkillsCards', + ] + ), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return SkillCardsMetadata.from_dict(json.loads(response.text)) - def update_file_metadata_global_box_skills_card(self, file_id: str, request_body: List[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> SkillCardsMetadata: + + def update_file_metadata_global_box_skills_card( + self, + file_id: str, + request_body: List[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> SkillCardsMetadata: """ Updates one or more Box Skills metadata cards to a file. :param file_id: The unique identifier that represents a file. @@ -182,9 +288,29 @@ def update_file_metadata_global_box_skills_card(self, file_id: str, request_body if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/global/boxSkillsCards']), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json-patch+json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/global/boxSkillsCards', + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json-patch+json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return SkillCardsMetadata.from_dict(json.loads(response.text)) - def delete_file_metadata_global_box_skills_card(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_metadata_global_box_skills_card( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Removes any Box Skills cards metadata from a file. :param file_id: The unique identifier that represents a file. @@ -201,12 +327,37 @@ def delete_file_metadata_global_box_skills_card(self, file_id: str, extra_header if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/metadata/global/boxSkillsCards']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/files/', + file_id, + '/metadata/global/boxSkillsCards', + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def update_skill_invocation_by_id(self, skill_id: str, status: UpdateSkillInvocationByIdStatusArg, metadata: UpdateSkillInvocationByIdMetadataArg, file: UpdateSkillInvocationByIdFileArg, file_version: Optional[UpdateSkillInvocationByIdFileVersionArg] = None, usage: Optional[UpdateSkillInvocationByIdUsageArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def update_skill_invocation_by_id( + self, + skill_id: str, + status: UpdateSkillInvocationByIdStatusArg, + metadata: UpdateSkillInvocationByIdMetadataArg, + file: UpdateSkillInvocationByIdFileArg, + file_version: Optional[UpdateSkillInvocationByIdFileVersionArg] = None, + usage: Optional[UpdateSkillInvocationByIdUsageArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ An alternative method that can be used to overwrite and update all Box Skill - + metadata cards on a file. :param skill_id: The ID of the skill to apply this metadata for. @@ -231,7 +382,24 @@ def update_skill_invocation_by_id(self, skill_id: str, status: UpdateSkillInvoca """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(status=status, metadata=metadata, file=file, file_version=file_version, usage=usage) + request_body = BaseObject( + status=status, + metadata=metadata, + file=file, + file_version=file_version, + usage=usage, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/skill_invocations/', skill_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/skill_invocations/', skill_id]), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/storage_policies.py b/box_sdk_gen/managers/storage_policies.py index 8d7c0dc1..ebeeadd6 100644 --- a/box_sdk_gen/managers/storage_policies.py +++ b/box_sdk_gen/managers/storage_policies.py @@ -26,17 +26,29 @@ from box_sdk_gen.fetch import FetchResponse + class StoragePoliciesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_storage_policies(self, fields: Optional[str] = None, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> StoragePolicies: + + def get_storage_policies( + self, + fields: Optional[str] = None, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> StoragePolicies: """ Fetches all the storage policies in the enterprise. - + Only a Primary Admin can access this endpoint. The user - + needs to generate a token for an account to authenticate this request. :param fields: A comma-separated list of attributes to include in the @@ -59,11 +71,32 @@ def get_storage_policies(self, fields: Optional[str] = None, marker: Optional[st """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'marker': to_string(marker), + 'limit': to_string(limit), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/storage_policies']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/storage_policies']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return StoragePolicies.from_dict(json.loads(response.text)) - def get_storage_policy_by_id(self, storage_policy_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> StoragePolicy: + + def get_storage_policy_by_id( + self, + storage_policy_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> StoragePolicy: """ Fetches a specific storage policy. Only a Primary Admin can access this endpoint. The user needs to generate a token for an account to authenticate this request. :param storage_policy_id: The ID of the storage policy. @@ -75,5 +108,14 @@ def get_storage_policy_by_id(self, storage_policy_id: str, extra_headers: Option if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/storage_policies/', storage_policy_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return StoragePolicy.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/storage_policies/', storage_policy_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return StoragePolicy.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/storage_policy_assignments.py b/box_sdk_gen/managers/storage_policy_assignments.py index a951a51e..8c832dc4 100644 --- a/box_sdk_gen/managers/storage_policy_assignments.py +++ b/box_sdk_gen/managers/storage_policy_assignments.py @@ -32,15 +32,23 @@ from box_sdk_gen.fetch import FetchResponse + class GetStoragePolicyAssignmentsResolvedForTypeArg(str, Enum): USER = 'user' ENTERPRISE = 'enterprise' + class CreateStoragePolicyAssignmentStoragePolicyArgTypeField(str, Enum): STORAGE_POLICY = 'storage_policy' + class CreateStoragePolicyAssignmentStoragePolicyArg(BaseObject): - def __init__(self, type: CreateStoragePolicyAssignmentStoragePolicyArgTypeField, id: str, **kwargs): + def __init__( + self, + type: CreateStoragePolicyAssignmentStoragePolicyArgTypeField, + id: str, + **kwargs + ): """ :param type: The type to assign. :type type: CreateStoragePolicyAssignmentStoragePolicyArgTypeField @@ -51,12 +59,19 @@ def __init__(self, type: CreateStoragePolicyAssignmentStoragePolicyArgTypeField, self.type = type self.id = id + class CreateStoragePolicyAssignmentAssignedToArgTypeField(str, Enum): USER = 'user' ENTERPRISE = 'enterprise' + class CreateStoragePolicyAssignmentAssignedToArg(BaseObject): - def __init__(self, type: CreateStoragePolicyAssignmentAssignedToArgTypeField, id: str, **kwargs): + def __init__( + self, + type: CreateStoragePolicyAssignmentAssignedToArgTypeField, + id: str, + **kwargs + ): """ :param type: The type to assign the policy to. :type type: CreateStoragePolicyAssignmentAssignedToArgTypeField @@ -67,11 +82,18 @@ def __init__(self, type: CreateStoragePolicyAssignmentAssignedToArgTypeField, id self.type = type self.id = id + class UpdateStoragePolicyAssignmentByIdStoragePolicyArgTypeField(str, Enum): STORAGE_POLICY = 'storage_policy' + class UpdateStoragePolicyAssignmentByIdStoragePolicyArg(BaseObject): - def __init__(self, type: UpdateStoragePolicyAssignmentByIdStoragePolicyArgTypeField, id: str, **kwargs): + def __init__( + self, + type: UpdateStoragePolicyAssignmentByIdStoragePolicyArgTypeField, + id: str, + **kwargs + ): """ :param type: The type to assign. :type type: UpdateStoragePolicyAssignmentByIdStoragePolicyArgTypeField @@ -82,17 +104,29 @@ def __init__(self, type: UpdateStoragePolicyAssignmentByIdStoragePolicyArgTypeFi self.type = type self.id = id + class StoragePolicyAssignmentsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_storage_policy_assignments(self, resolved_for_type: GetStoragePolicyAssignmentsResolvedForTypeArg, resolved_for_id: str, marker: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> StoragePolicyAssignments: + + def get_storage_policy_assignments( + self, + resolved_for_type: GetStoragePolicyAssignmentsResolvedForTypeArg, + resolved_for_id: str, + marker: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> StoragePolicyAssignments: """ Fetches all the storage policy assignment for an enterprise or user. - + Only a Primary Admin can access this endpoint. The user - + needs to generate a token for an account to authenticate this request. :param resolved_for_type: The target type to return assignments for @@ -108,17 +142,39 @@ def get_storage_policy_assignments(self, resolved_for_type: GetStoragePolicyAssi """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'resolved_for_type': to_string(resolved_for_type), 'resolved_for_id': to_string(resolved_for_id)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'marker': to_string(marker), + 'resolved_for_type': to_string(resolved_for_type), + 'resolved_for_id': to_string(resolved_for_id), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/storage_policy_assignments']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/storage_policy_assignments']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return StoragePolicyAssignments.from_dict(json.loads(response.text)) - def create_storage_policy_assignment(self, storage_policy: CreateStoragePolicyAssignmentStoragePolicyArg, assigned_to: CreateStoragePolicyAssignmentAssignedToArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> StoragePolicyAssignment: + + def create_storage_policy_assignment( + self, + storage_policy: CreateStoragePolicyAssignmentStoragePolicyArg, + assigned_to: CreateStoragePolicyAssignmentAssignedToArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> StoragePolicyAssignment: """ Creates a storage policy assignment for an enterprise or user. - + Only a Primary Admin can access this endpoint. The user - + needs to generate a token for an account to authenticate this request. :param storage_policy: The storage policy to assign to the user or @@ -132,11 +188,29 @@ def create_storage_policy_assignment(self, storage_policy: CreateStoragePolicyAs """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(storage_policy=storage_policy, assigned_to=assigned_to) + request_body = BaseObject( + 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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/storage_policy_assignments']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return StoragePolicyAssignment.from_dict(json.loads(response.text)) - def get_storage_policy_assignment_by_id(self, storage_policy_assignment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> StoragePolicyAssignment: + + def get_storage_policy_assignment_by_id( + self, + storage_policy_assignment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> StoragePolicyAssignment: """ Fetches a specific storage policy assignment. Only a Primary Admin can access this endpoint. The user needs to generate a token for an account to authenticate this request. :param storage_policy_assignment_id: The ID of the storage policy assignment. @@ -148,9 +222,29 @@ def get_storage_policy_assignment_by_id(self, storage_policy_assignment_id: str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/storage_policy_assignments/', storage_policy_assignment_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/storage_policy_assignments/', + storage_policy_assignment_id, + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return StoragePolicyAssignment.from_dict(json.loads(response.text)) - def update_storage_policy_assignment_by_id(self, storage_policy_assignment_id: str, storage_policy: UpdateStoragePolicyAssignmentByIdStoragePolicyArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> StoragePolicyAssignment: + + def update_storage_policy_assignment_by_id( + self, + storage_policy_assignment_id: str, + storage_policy: UpdateStoragePolicyAssignmentByIdStoragePolicyArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> StoragePolicyAssignment: """ Updates a specific storage policy assignment. Only a Primary Admin can access this endpoint. The user needs to generate a token for an account to authenticate this request. :param storage_policy_assignment_id: The ID of the storage policy assignment. @@ -164,32 +258,53 @@ def update_storage_policy_assignment_by_id(self, storage_policy_assignment_id: s """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(storage_policy=storage_policy) + request_body = BaseObject(storage_policy=storage_policy) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/storage_policy_assignments/', storage_policy_assignment_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/storage_policy_assignments/', + storage_policy_assignment_id, + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return StoragePolicyAssignment.from_dict(json.loads(response.text)) - def delete_storage_policy_assignment_by_id(self, storage_policy_assignment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_storage_policy_assignment_by_id( + self, + storage_policy_assignment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Delete a storage policy assignment. - + Deleting a storage policy assignment on a user - + will have the user inherit the enterprise's default - + storage policy. - + There is a rate limit for calling this endpoint of only - + twice per user in a 24 hour time frame. - + Only a Primary Admin can access this endpoint. The user - + needs to generate a token for an account to authenticate this request. :param storage_policy_assignment_id: The ID of the storage policy assignment. @@ -201,5 +316,19 @@ def delete_storage_policy_assignment_by_id(self, storage_policy_assignment_id: s if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/storage_policy_assignments/', storage_policy_assignment_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/storage_policy_assignments/', + storage_policy_assignment_id, + ] + ), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/task_assignments.py b/box_sdk_gen/managers/task_assignments.py index f6be9741..0d015c6a 100644 --- a/box_sdk_gen/managers/task_assignments.py +++ b/box_sdk_gen/managers/task_assignments.py @@ -32,9 +32,11 @@ from box_sdk_gen.fetch import FetchResponse + class CreateTaskAssignmentTaskArgTypeField(str, Enum): TASK = 'task' + class CreateTaskAssignmentTaskArg(BaseObject): def __init__(self, id: str, type: CreateTaskAssignmentTaskArgTypeField, **kwargs): """ @@ -47,6 +49,7 @@ def __init__(self, id: str, type: CreateTaskAssignmentTaskArgTypeField, **kwargs self.id = id self.type = type + class CreateTaskAssignmentAssignToArg(BaseObject): def __init__(self, id: Optional[str] = None, login: Optional[str] = None, **kwargs): """ @@ -63,17 +66,26 @@ def __init__(self, id: Optional[str] = None, login: Optional[str] = None, **kwar self.id = id self.login = login + class UpdateTaskAssignmentByIdResolutionStateArg(str, Enum): COMPLETED = 'completed' INCOMPLETE = 'incomplete' APPROVED = 'approved' REJECTED = 'rejected' + class TaskAssignmentsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_task_assignments(self, task_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TaskAssignments: + + def get_task_assignments( + self, task_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> TaskAssignments: """ Lists all of the assignments for a given task. :param task_id: The ID of the task. @@ -85,15 +97,30 @@ def get_task_assignments(self, task_id: str, extra_headers: Optional[Dict[str, O if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/tasks/', task_id, '/assignments']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/tasks/', task_id, '/assignments']), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TaskAssignments.from_dict(json.loads(response.text)) - def create_task_assignment(self, task: CreateTaskAssignmentTaskArg, assign_to: CreateTaskAssignmentAssignToArg, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TaskAssignment: + + def create_task_assignment( + self, + task: CreateTaskAssignmentTaskArg, + assign_to: CreateTaskAssignmentAssignToArg, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TaskAssignment: """ Assigns a task to a user. - + A task can be assigned to more than one user by creating multiple - + assignments. :param task: The task to assign to a user. @@ -105,11 +132,27 @@ def create_task_assignment(self, task: CreateTaskAssignmentTaskArg, assign_to: C """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(task=task, assign_to=assign_to) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/task_assignments']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TaskAssignment.from_dict(json.loads(response.text)) - def get_task_assignment_by_id(self, task_assignment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TaskAssignment: + + def get_task_assignment_by_id( + self, + task_assignment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TaskAssignment: """ Retrieves information about a task assignment. :param task_assignment_id: The ID of the task assignment. @@ -121,12 +164,28 @@ def get_task_assignment_by_id(self, task_assignment_id: str, extra_headers: Opti if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/task_assignments/', task_assignment_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/task_assignments/', task_assignment_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TaskAssignment.from_dict(json.loads(response.text)) - def update_task_assignment_by_id(self, task_assignment_id: str, message: Optional[str] = None, resolution_state: Optional[UpdateTaskAssignmentByIdResolutionStateArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TaskAssignment: + + def update_task_assignment_by_id( + self, + task_assignment_id: str, + message: Optional[str] = None, + resolution_state: Optional[UpdateTaskAssignmentByIdResolutionStateArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TaskAssignment: """ Updates a task assignment. This endpoint can be - + used to update the state of a task assigned to a user. :param task_assignment_id: The ID of the task assignment. @@ -145,11 +204,27 @@ def update_task_assignment_by_id(self, task_assignment_id: str, message: Optiona """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(message=message, resolution_state=resolution_state) + request_body = BaseObject(message=message, resolution_state=resolution_state) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/task_assignments/', task_assignment_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/task_assignments/', task_assignment_id]), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TaskAssignment.from_dict(json.loads(response.text)) - def delete_task_assignment_by_id(self, task_assignment_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_task_assignment_by_id( + self, + task_assignment_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a specific task assignment. :param task_assignment_id: The ID of the task assignment. @@ -161,5 +236,14 @@ def delete_task_assignment_by_id(self, task_assignment_id: str, extra_headers: O if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/task_assignments/', task_assignment_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/task_assignments/', task_assignment_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/tasks.py b/box_sdk_gen/managers/tasks.py index e769516b..81569e64 100644 --- a/box_sdk_gen/managers/tasks.py +++ b/box_sdk_gen/managers/tasks.py @@ -32,11 +32,18 @@ from box_sdk_gen.fetch import FetchResponse + class CreateTaskItemArgTypeField(str, Enum): FILE = 'file' + class CreateTaskItemArg(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CreateTaskItemArgTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CreateTaskItemArgTypeField] = None, + **kwargs + ): """ :param id: The ID of the file :type id: Optional[str], optional @@ -47,30 +54,42 @@ def __init__(self, id: Optional[str] = None, type: Optional[CreateTaskItemArgTyp self.id = id self.type = type + class CreateTaskActionArg(str, Enum): REVIEW = 'review' COMPLETE = 'complete' + class CreateTaskCompletionRuleArg(str, Enum): ALL_ASSIGNEES = 'all_assignees' ANY_ASSIGNEE = 'any_assignee' + class UpdateTaskByIdActionArg(str, Enum): REVIEW = 'review' COMPLETE = 'complete' + class UpdateTaskByIdCompletionRuleArg(str, Enum): ALL_ASSIGNEES = 'all_assignees' ANY_ASSIGNEE = 'any_assignee' + class TasksManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_file_tasks(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Tasks: + + def get_file_tasks( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Tasks: """ Retrieves a list of all the tasks for a file. This - + endpoint does not support pagination. :param file_id: The unique identifier that represents a file. @@ -87,12 +106,30 @@ def get_file_tasks(self, file_id: str, extra_headers: Optional[Dict[str, Optiona if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/tasks']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/tasks']), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Tasks.from_dict(json.loads(response.text)) - def create_task(self, item: CreateTaskItemArg, action: Optional[CreateTaskActionArg] = None, message: Optional[str] = None, due_at: Optional[str] = None, completion_rule: Optional[CreateTaskCompletionRuleArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Task: + + def create_task( + self, + item: CreateTaskItemArg, + action: Optional[CreateTaskActionArg] = None, + message: Optional[str] = None, + due_at: Optional[str] = None, + completion_rule: Optional[CreateTaskCompletionRuleArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Task: """ Creates a single task on a file. This task is not assigned to any user and - + will need to be assigned separately. :param item: The file to attach the task to. @@ -119,11 +156,31 @@ def create_task(self, item: CreateTaskItemArg, action: Optional[CreateTaskAction """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(item=item, action=action, message=message, due_at=due_at, completion_rule=completion_rule) + request_body = BaseObject( + item=item, + action=action, + message=message, + due_at=due_at, + completion_rule=completion_rule, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/tasks']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/tasks']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Task.from_dict(json.loads(response.text)) - def get_task_by_id(self, task_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Task: + + def get_task_by_id( + self, task_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Task: """ Retrieves information about a specific task. :param task_id: The ID of the task. @@ -135,12 +192,30 @@ def get_task_by_id(self, task_id: str, extra_headers: Optional[Dict[str, Optiona if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/tasks/', task_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/tasks/', task_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Task.from_dict(json.loads(response.text)) - def update_task_by_id(self, task_id: str, action: Optional[UpdateTaskByIdActionArg] = None, message: Optional[str] = None, due_at: Optional[str] = None, completion_rule: Optional[UpdateTaskByIdCompletionRuleArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Task: + + def update_task_by_id( + self, + task_id: str, + action: Optional[UpdateTaskByIdActionArg] = None, + message: Optional[str] = None, + due_at: Optional[str] = None, + completion_rule: Optional[UpdateTaskByIdCompletionRuleArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Task: """ Updates a task. This can be used to update a task's configuration, or to - + update its completion state. :param task_id: The ID of the task. @@ -167,11 +242,30 @@ def update_task_by_id(self, task_id: str, action: Optional[UpdateTaskByIdActionA """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(action=action, message=message, due_at=due_at, completion_rule=completion_rule) + request_body = BaseObject( + action=action, + message=message, + due_at=due_at, + completion_rule=completion_rule, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/tasks/', task_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/tasks/', task_id]), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Task.from_dict(json.loads(response.text)) - def delete_task_by_id(self, task_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_task_by_id( + self, task_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Removes a task from a file. :param task_id: The ID of the task. @@ -183,5 +277,14 @@ def delete_task_by_id(self, task_id: str, extra_headers: Optional[Dict[str, Opti if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/tasks/', task_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/tasks/', task_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None 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 f159df9d..e2f64d13 100644 --- a/box_sdk_gen/managers/terms_of_service_user_statuses.py +++ b/box_sdk_gen/managers/terms_of_service_user_statuses.py @@ -32,11 +32,15 @@ from box_sdk_gen.fetch import FetchResponse + class CreateTermOfServiceUserStatusTosArgTypeField(str, Enum): TERMS_OF_SERVICE = 'terms_of_service' + class CreateTermOfServiceUserStatusTosArg(BaseObject): - def __init__(self, type: CreateTermOfServiceUserStatusTosArgTypeField, id: str, **kwargs): + def __init__( + self, type: CreateTermOfServiceUserStatusTosArgTypeField, id: str, **kwargs + ): """ :param type: The type of object. :type type: CreateTermOfServiceUserStatusTosArgTypeField @@ -47,11 +51,15 @@ def __init__(self, type: CreateTermOfServiceUserStatusTosArgTypeField, id: str, self.type = type self.id = id + class CreateTermOfServiceUserStatusUserArgTypeField(str, Enum): USER = 'user' + class CreateTermOfServiceUserStatusUserArg(BaseObject): - def __init__(self, type: CreateTermOfServiceUserStatusUserArgTypeField, id: str, **kwargs): + def __init__( + self, type: CreateTermOfServiceUserStatusUserArgTypeField, id: str, **kwargs + ): """ :param type: The type of object. :type type: CreateTermOfServiceUserStatusUserArgTypeField @@ -62,17 +70,28 @@ def __init__(self, type: CreateTermOfServiceUserStatusUserArgTypeField, id: str, self.type = type self.id = id + class TermsOfServiceUserStatusesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_term_of_service_user_statuses(self, tos_id: str, user_id: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TermsOfServiceUserStatuses: + + def get_term_of_service_user_statuses( + self, + tos_id: str, + user_id: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TermsOfServiceUserStatuses: """ Retrieves an overview of users and their status for a - + terms of service, including Whether they have accepted - + the terms and when. :param tos_id: The ID of the terms of service. @@ -84,11 +103,30 @@ def get_term_of_service_user_statuses(self, tos_id: str, user_id: Optional[str] """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'tos_id': to_string(tos_id), 'user_id': to_string(user_id)}) + query_params_map: Dict[str, str] = prepare_params( + {'tos_id': to_string(tos_id), 'user_id': to_string(user_id)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/terms_of_service_user_statuses']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/terms_of_service_user_statuses']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TermsOfServiceUserStatuses.from_dict(json.loads(response.text)) - def create_term_of_service_user_status(self, tos: CreateTermOfServiceUserStatusTosArg, user: CreateTermOfServiceUserStatusUserArg, is_accepted: bool, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TermsOfServiceUserStatus: + + def create_term_of_service_user_status( + self, + tos: CreateTermOfServiceUserStatusTosArg, + user: CreateTermOfServiceUserStatusUserArg, + is_accepted: bool, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TermsOfServiceUserStatus: """ Sets the status for a terms of service for a user. :param tos: The terms of service to set the status for. @@ -102,11 +140,28 @@ def create_term_of_service_user_status(self, tos: CreateTermOfServiceUserStatusT """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(tos=tos, user=user, is_accepted=is_accepted) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/terms_of_service_user_statuses']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TermsOfServiceUserStatus.from_dict(json.loads(response.text)) - def update_term_of_service_user_status_by_id(self, terms_of_service_user_status_id: str, is_accepted: bool, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TermsOfServiceUserStatus: + + def update_term_of_service_user_status_by_id( + self, + terms_of_service_user_status_id: str, + is_accepted: bool, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TermsOfServiceUserStatus: """ Updates the status for a terms of service for a user. :param terms_of_service_user_status_id: The ID of the terms of service status. @@ -119,7 +174,23 @@ def update_term_of_service_user_status_by_id(self, terms_of_service_user_status_ """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(is_accepted=is_accepted) + request_body = BaseObject(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/', terms_of_service_user_status_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return TermsOfServiceUserStatus.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + [ + 'https://api.box.com/2.0/terms_of_service_user_statuses/', + terms_of_service_user_status_id, + ] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return TermsOfServiceUserStatus.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/terms_of_services.py b/box_sdk_gen/managers/terms_of_services.py index 4faf565d..7f3d0820 100644 --- a/box_sdk_gen/managers/terms_of_services.py +++ b/box_sdk_gen/managers/terms_of_services.py @@ -32,30 +32,44 @@ from box_sdk_gen.fetch import FetchResponse + class GetTermOfServicesTosTypeArg(str, Enum): EXTERNAL = 'external' MANAGED = 'managed' + class CreateTermOfServiceStatusArg(str, Enum): ENABLED = 'enabled' DISABLED = 'disabled' + class CreateTermOfServiceTosTypeArg(str, Enum): EXTERNAL = 'external' MANAGED = 'managed' + class UpdateTermOfServiceByIdStatusArg(str, Enum): ENABLED = 'enabled' DISABLED = 'disabled' + class TermsOfServicesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_term_of_services(self, tos_type: Optional[GetTermOfServicesTosTypeArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TermsOfServices: + + def get_term_of_services( + self, + tos_type: Optional[GetTermOfServicesTosTypeArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TermsOfServices: """ Returns the current terms of service text and settings - + for the enterprise. :param tos_type: Limits the results to the terms of service of the given type. @@ -65,14 +79,33 @@ def get_term_of_services(self, tos_type: Optional[GetTermOfServicesTosTypeArg] = """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'tos_type': to_string(tos_type)}) + query_params_map: Dict[str, str] = prepare_params( + {'tos_type': to_string(tos_type)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/terms_of_services']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/terms_of_services']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TermsOfServices.from_dict(json.loads(response.text)) - def create_term_of_service(self, status: CreateTermOfServiceStatusArg, text: str, tos_type: Optional[CreateTermOfServiceTosTypeArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Task: + + def create_term_of_service( + self, + status: CreateTermOfServiceStatusArg, + text: str, + tos_type: Optional[CreateTermOfServiceTosTypeArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Task: """ Creates a terms of service for a given enterprise - + and type of user. :param status: Whether this terms of service is active. @@ -88,11 +121,27 @@ def create_term_of_service(self, status: CreateTermOfServiceStatusArg, text: str """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(status=status, tos_type=tos_type, text=text) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/terms_of_services']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Task.from_dict(json.loads(response.text)) - def get_term_of_service_by_id(self, terms_of_service_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TermsOfService: + + def get_term_of_service_by_id( + self, + terms_of_service_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TermsOfService: """ Fetches a specific terms of service. :param terms_of_service_id: The ID of the terms of service. @@ -104,9 +153,27 @@ def get_term_of_service_by_id(self, terms_of_service_id: str, extra_headers: Opt if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/terms_of_services/', terms_of_service_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/terms_of_services/', terms_of_service_id] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TermsOfService.from_dict(json.loads(response.text)) - def update_term_of_service_by_id(self, terms_of_service_id: str, status: UpdateTermOfServiceByIdStatusArg, text: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TermsOfService: + + def update_term_of_service_by_id( + self, + terms_of_service_id: str, + status: UpdateTermOfServiceByIdStatusArg, + text: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TermsOfService: """ Updates a specific terms of service. :param terms_of_service_id: The ID of the terms of service. @@ -122,7 +189,20 @@ def update_term_of_service_by_id(self, terms_of_service_id: str, status: UpdateT """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(status=status, text=text) + request_body = BaseObject(status=status, text=text) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/terms_of_services/', terms_of_service_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return TermsOfService.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/terms_of_services/', terms_of_service_id] + ), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return TermsOfService.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/transfer.py b/box_sdk_gen/managers/transfer.py index 72fbb8e2..f23e0d04 100644 --- a/box_sdk_gen/managers/transfer.py +++ b/box_sdk_gen/managers/transfer.py @@ -28,6 +28,7 @@ from box_sdk_gen.fetch import FetchResponse + class TransferOwnedFolderOwnedByArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -38,77 +39,90 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class TransferManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def transfer_owned_folder(self, user_id: str, owned_by: TransferOwnedFolderOwnedByArg, fields: Optional[str] = None, notify: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> FolderFull: + + def transfer_owned_folder( + self, + user_id: str, + owned_by: TransferOwnedFolderOwnedByArg, + fields: Optional[str] = None, + notify: Optional[bool] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> FolderFull: """ Move all of the items (files, folders and workflows) owned by a user into - + another user's account - + Only the root folder (`0`) can be transferred. - + Folders can only be moved across users by users with administrative - + permissions. - + All existing shared links and folder-level collaborations are transferred - + during the operation. Please note that while collaborations at the individual - + file-level are transferred during the operation, the collaborations are - + deleted when the original user is deleted. - + This call will be performed synchronously which might lead to a slow response - + when the source user has a large number of items in all of its folders. - + If the destination path has a metadata cascade policy attached to any of - + the parent folders, a metadata cascade operation will be kicked off - + asynchronously. - + There is currently no way to check for when this operation is finished. - + The destination folder's name will be in the format `{User}'s Files and - + Folders`, where `{User}` is the display name of the user. - + To make this API call your application will need to have the "Read and write - + all files and folders stored in Box" scope enabled. - + Please make sure the destination user has access to `Relay` or `Relay Lite`, - + and has access to the files and folders involved in the workflows being - + transferred. - + Admins will receive an email when the operation is completed. :param user_id: The ID of the user. @@ -133,8 +147,22 @@ def transfer_owned_folder(self, user_id: str, owned_by: TransferOwnedFolderOwned """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(owned_by=owned_by) - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'notify': to_string(notify)}) + request_body = BaseObject(owned_by=owned_by) + query_params_map: Dict[str, str] = prepare_params( + {'fields': to_string(fields), 'notify': to_string(notify)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id, '/folders/0']), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return FolderFull.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id, '/folders/0']), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return FolderFull.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/trashed_files.py b/box_sdk_gen/managers/trashed_files.py index 4d77cea6..92cda6dd 100644 --- a/box_sdk_gen/managers/trashed_files.py +++ b/box_sdk_gen/managers/trashed_files.py @@ -30,6 +30,7 @@ from box_sdk_gen.fetch import FetchResponse + class RestoreFileFromTrashParentArg(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ @@ -39,17 +40,30 @@ def __init__(self, id: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.id = id + class TrashedFilesManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def restore_file_from_trash(self, file_id: str, name: Optional[str] = None, parent: Optional[RestoreFileFromTrashParentArg] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TrashFileRestored: + + def restore_file_from_trash( + self, + file_id: str, + name: Optional[str] = None, + parent: Optional[RestoreFileFromTrashParentArg] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TrashFileRestored: """ Restores a file that has been moved to the trash. - + An optional new parent ID can be provided to restore the file to in case the - + original folder has been deleted. :param file_id: The unique identifier that represents a file. @@ -76,36 +90,54 @@ def restore_file_from_trash(self, file_id: str, name: Optional[str] = None, pare """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, parent=parent) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/files/', file_id]), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id]), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TrashFileRestored.from_dict(json.loads(response.text)) - def get_file_trash(self, file_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TrashFile: + + def get_file_trash( + self, + file_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TrashFile: """ Retrieves a file that has been moved to the trash. - + Please note that only if the file itself has been moved to the - + trash can it be retrieved with this API call. If instead one of - + its parent folders was moved to the trash, only that folder - + can be inspected using the - + [`GET /folders/:id/trash`](e://get_folders_id_trash) API. - + To list all items that have been moved to the trash, please - + use the [`GET /folders/trash/items`](e://get-folders-trash-items/) - + API. :param file_id: The unique identifier that represents a file. @@ -132,12 +164,25 @@ def get_file_trash(self, file_id: str, fields: Optional[str] = None, extra_heade extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/trash']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/trash']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TrashFile.from_dict(json.loads(response.text)) - def delete_file_trash(self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_file_trash( + self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Permanently deletes a file that is in the trash. - + This action cannot be undone. :param file_id: The unique identifier that represents a file. @@ -154,5 +199,14 @@ def delete_file_trash(self, file_id: str, extra_headers: Optional[Dict[str, Opti if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/files/', file_id, '/trash']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/', file_id, '/trash']), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/trashed_folders.py b/box_sdk_gen/managers/trashed_folders.py index 79aacf81..b3bccdda 100644 --- a/box_sdk_gen/managers/trashed_folders.py +++ b/box_sdk_gen/managers/trashed_folders.py @@ -30,6 +30,7 @@ from box_sdk_gen.fetch import FetchResponse + class RestoreFolderFromTrashParentArg(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ @@ -39,35 +40,48 @@ def __init__(self, id: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.id = id + class TrashedFoldersManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def restore_folder_from_trash(self, folder_id: str, name: Optional[str] = None, parent: Optional[RestoreFolderFromTrashParentArg] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TrashFolderRestored: + + def restore_folder_from_trash( + self, + folder_id: str, + name: Optional[str] = None, + parent: Optional[RestoreFolderFromTrashParentArg] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TrashFolderRestored: """ Restores a folder that has been moved to the trash. - + An optional new parent ID can be provided to restore the folder to in case the - + original folder has been deleted. - + # Folder locking - + During this operation, part of the file tree will be locked, mainly - + the source folder and all of its descendants, as well as the destination - + folder. - + For the duration of the operation, no other move, copy, delete, or restore - + operation can performed on any of the locked folders. :param folder_id: The unique identifier that represent a folder. @@ -96,36 +110,54 @@ def restore_folder_from_trash(self, folder_id: str, name: Optional[str] = None, """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, parent=parent) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/folders/', folder_id]), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id]), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TrashFolderRestored.from_dict(json.loads(response.text)) - def get_folder_trash(self, folder_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TrashFolder: + + def get_folder_trash( + self, + folder_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TrashFolder: """ Retrieves a folder that has been moved to the trash. - + Please note that only if the folder itself has been moved to the - + trash can it be retrieved with this API call. If instead one of - + its parent folders was moved to the trash, only that folder - + can be inspected using the - + [`GET /folders/:id/trash`](e://get_folders_id_trash) API. - + To list all items that have been moved to the trash, please - + use the [`GET /folders/trash/items`](e://get-folders-trash-items/) - + API. :param folder_id: The unique identifier that represent a folder. @@ -154,12 +186,25 @@ def get_folder_trash(self, folder_id: str, fields: Optional[str] = None, extra_h extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/trash']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/trash']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TrashFolder.from_dict(json.loads(response.text)) - def delete_folder_trash(self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_folder_trash( + self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Permanently deletes a folder that is in the trash. - + This action cannot be undone. :param folder_id: The unique identifier that represent a folder. @@ -178,5 +223,14 @@ def delete_folder_trash(self, folder_id: str, extra_headers: Optional[Dict[str, if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/', folder_id, '/trash']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/', folder_id, '/trash']), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/trashed_items.py b/box_sdk_gen/managers/trashed_items.py index b032b5c9..b3d4cb6d 100644 --- a/box_sdk_gen/managers/trashed_items.py +++ b/box_sdk_gen/managers/trashed_items.py @@ -26,38 +26,56 @@ from box_sdk_gen.fetch import FetchResponse + class GetFolderTrashItemsDirectionArg(str, Enum): ASC = 'ASC' DESC = 'DESC' + class GetFolderTrashItemsSortArg(str, Enum): NAME = 'name' DATE = 'date' SIZE = 'size' + class TrashedItemsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_folder_trash_items(self, fields: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, usemarker: Optional[bool] = None, marker: Optional[str] = None, direction: Optional[GetFolderTrashItemsDirectionArg] = None, sort: Optional[GetFolderTrashItemsSortArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Items: + + def get_folder_trash_items( + self, + fields: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + usemarker: Optional[bool] = None, + marker: Optional[str] = None, + direction: Optional[GetFolderTrashItemsDirectionArg] = None, + sort: Optional[GetFolderTrashItemsSortArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Items: """ Retrieves the files and folders that have been moved - + to the trash. - + Any attribute in the full files or folders objects can be passed - + in with the `fields` parameter to retrieve those specific - + attributes that are not returned by default. - + This endpoint defaults to use offset-based pagination, yet also supports - + marker-based pagination using the `marker` parameter. :param fields: A comma-separated list of attributes to include in the @@ -102,7 +120,27 @@ def get_folder_trash_items(self, fields: Optional[str] = None, limit: Optional[i """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'limit': to_string(limit), 'offset': to_string(offset), 'usemarker': to_string(usemarker), 'marker': to_string(marker), 'direction': to_string(direction), 'sort': to_string(sort)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'fields': to_string(fields), + 'limit': to_string(limit), + 'offset': to_string(offset), + 'usemarker': to_string(usemarker), + 'marker': to_string(marker), + 'direction': to_string(direction), + 'sort': to_string(sort), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/folders/trash/items']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return Items.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/folders/trash/items']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return Items.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/trashed_web_links.py b/box_sdk_gen/managers/trashed_web_links.py index 64c833ee..e094bc17 100644 --- a/box_sdk_gen/managers/trashed_web_links.py +++ b/box_sdk_gen/managers/trashed_web_links.py @@ -30,6 +30,7 @@ from box_sdk_gen.fetch import FetchResponse + class CreateWebLinkByIdParentArg(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ @@ -39,17 +40,30 @@ def __init__(self, id: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.id = id + class TrashedWebLinksManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def create_web_link_by_id(self, web_link_id: str, name: Optional[str] = None, parent: Optional[CreateWebLinkByIdParentArg] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TrashWebLinkRestored: + + def create_web_link_by_id( + self, + web_link_id: str, + name: Optional[str] = None, + parent: Optional[CreateWebLinkByIdParentArg] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TrashWebLinkRestored: """ 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. :param web_link_id: The ID of the web link. @@ -71,12 +85,30 @@ def create_web_link_by_id(self, web_link_id: str, name: Optional[str] = None, pa """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, parent=parent) + request_body = BaseObject(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(''.join(['https://api.box.com/2.0/web_links/', web_link_id]), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/web_links/', web_link_id]), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TrashWebLinkRestored.from_dict(json.loads(response.text)) - def get_web_link_trash(self, web_link_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> TrashWebLink: + + def get_web_link_trash( + self, + web_link_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> TrashWebLink: """ Retrieves a web link that has been moved to the trash. :param web_link_id: The ID of the web link. @@ -98,12 +130,25 @@ def get_web_link_trash(self, web_link_id: str, fields: Optional[str] = None, ext extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/web_links/', web_link_id, '/trash']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/web_links/', web_link_id, '/trash']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return TrashWebLink.from_dict(json.loads(response.text)) - def delete_web_link_trash(self, web_link_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_web_link_trash( + self, web_link_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Permanently deletes a web link that is in the trash. - + This action cannot be undone. :param web_link_id: The ID of the web link. @@ -115,5 +160,14 @@ def delete_web_link_trash(self, web_link_id: str, extra_headers: Optional[Dict[s if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/web_links/', web_link_id, '/trash']), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/web_links/', web_link_id, '/trash']), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/uploads.py b/box_sdk_gen/managers/uploads.py index 6908f510..4f802b0d 100644 --- a/box_sdk_gen/managers/uploads.py +++ b/box_sdk_gen/managers/uploads.py @@ -34,6 +34,7 @@ from box_sdk_gen.fetch import MultipartItem + class UploadFileVersionAttributesArg(BaseObject): def __init__(self, name: str, content_modified_at: Optional[str] = None, **kwargs): """ @@ -48,6 +49,7 @@ def __init__(self, name: str, content_modified_at: Optional[str] = None, **kwarg self.name = name self.content_modified_at = content_modified_at + class UploadFileAttributesArgParentField(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -58,8 +60,16 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class UploadFileAttributesArg(BaseObject): - def __init__(self, name: str, parent: UploadFileAttributesArgParentField, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, **kwargs): + def __init__( + self, + name: str, + parent: UploadFileAttributesArgParentField, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + **kwargs + ): """ :param name: The name of the file :type name: str @@ -78,6 +88,7 @@ def __init__(self, name: str, parent: UploadFileAttributesArgParentField, conten self.content_created_at = content_created_at self.content_modified_at = content_modified_at + class PreflightFileUploadParentArg(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ @@ -87,29 +98,46 @@ def __init__(self, id: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.id = id + class UploadsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def upload_file_version(self, file_id: str, attributes: UploadFileVersionAttributesArg, file: ByteStream, file_file_name: Optional[str] = None, file_content_type: Optional[str] = None, fields: Optional[str] = None, if_match: Optional[str] = None, content_md_5: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Files: + + def upload_file_version( + self, + file_id: str, + attributes: UploadFileVersionAttributesArg, + file: ByteStream, + file_file_name: Optional[str] = None, + file_content_type: Optional[str] = None, + fields: Optional[str] = None, + if_match: Optional[str] = None, + content_md_5: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Files: """ Update a file's content. For file sizes over 50MB we recommend - + using the Chunk Upload APIs. - + # Request body order - + The `attributes` part of the body must come **before** the - + `file` part. Requests that do not follow this format when - + uploading the file will receive a HTTP `400` error with a - + `metadata_after_file_contents` error code. :param file_id: The unique identifier that represents a file. @@ -162,30 +190,74 @@ def upload_file_version(self, file_id: str, attributes: UploadFileVersionAttribu """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(attributes=attributes, file=file, file_file_name=file_file_name, file_content_type=file_content_type) + request_body = BaseObject( + attributes=attributes, + file=file, + file_file_name=file_file_name, + file_content_type=file_content_type, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) - headers_map: Dict[str, str] = prepare_params({'if-match': to_string(if_match), 'content-md5': to_string(content_md_5), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/', file_id, '/content']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, multipart_data=[MultipartItem(part_name='attributes', body=json.dumps(request_body.attributes.to_dict())), MultipartItem(part_name='file', file_stream=request_body.file, file_name=request_body.file_file_name, content_type=request_body.file_content_type)], content_type='multipart/form-data', response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + { + 'if-match': to_string(if_match), + 'content-md5': to_string(content_md_5), + **extra_headers, + } + ) + response: FetchResponse = fetch( + ''.join(['https://upload.box.com/api/2.0/files/', file_id, '/content']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + multipart_data=[ + MultipartItem( + part_name='attributes', + body=json.dumps(request_body.attributes.to_dict()), + ), + MultipartItem( + part_name='file', + file_stream=request_body.file, + file_name=request_body.file_file_name, + content_type=request_body.file_content_type, + ), + ], + content_type='multipart/form-data', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Files.from_dict(json.loads(response.text)) - def upload_file(self, attributes: UploadFileAttributesArg, file: ByteStream, file_file_name: Optional[str] = None, file_content_type: Optional[str] = None, fields: Optional[str] = None, content_md_5: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Files: + + def upload_file( + self, + attributes: UploadFileAttributesArg, + file: ByteStream, + file_file_name: Optional[str] = None, + file_content_type: Optional[str] = None, + fields: Optional[str] = None, + content_md_5: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Files: """ Uploads a small file to Box. For file sizes over 50MB we recommend - + using the Chunk Upload APIs. - + # Request body order - + The `attributes` part of the body must come **before** the - + `file` part. Requests that do not follow this format when - + uploading the file will receive a HTTP `400` error with a - + `metadata_after_file_contents` error code. :param attributes: The additional attributes of the file being uploaded. Mainly the @@ -223,15 +295,52 @@ def upload_file(self, attributes: UploadFileAttributesArg, file: ByteStream, fil """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(attributes=attributes, file=file, file_file_name=file_file_name, file_content_type=file_content_type) + request_body = BaseObject( + attributes=attributes, + file=file, + file_file_name=file_file_name, + file_content_type=file_content_type, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) - headers_map: Dict[str, str] = prepare_params({'content-md5': to_string(content_md_5), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://upload.box.com/api/2.0/files/content']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, multipart_data=[MultipartItem(part_name='attributes', body=json.dumps(request_body.attributes.to_dict())), MultipartItem(part_name='file', file_stream=request_body.file, file_name=request_body.file_file_name, content_type=request_body.file_content_type)], content_type='multipart/form-data', response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + {'content-md5': to_string(content_md_5), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://upload.box.com/api/2.0/files/content']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + multipart_data=[ + MultipartItem( + part_name='attributes', + body=json.dumps(request_body.attributes.to_dict()), + ), + MultipartItem( + part_name='file', + file_stream=request_body.file, + file_name=request_body.file_file_name, + content_type=request_body.file_content_type, + ), + ], + content_type='multipart/form-data', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Files.from_dict(json.loads(response.text)) - def preflight_file_upload(self, name: Optional[str] = None, size: Optional[int] = None, parent: Optional[PreflightFileUploadParentArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UploadUrl: + + def preflight_file_upload( + self, + name: Optional[str] = None, + size: Optional[int] = None, + parent: Optional[PreflightFileUploadParentArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UploadUrl: """ Performs a check to verify that a file will be accepted by Box - + before you upload the entire file. :param name: The name for the file @@ -243,7 +352,18 @@ def preflight_file_upload(self, name: Optional[str] = None, size: Optional[int] """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, size=size, parent=parent) + request_body = BaseObject(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']), FetchOptions(method='OPTIONS', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return UploadUrl.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/files/content']), + FetchOptions( + method='OPTIONS', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return UploadUrl.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/user_collaborations.py b/box_sdk_gen/managers/user_collaborations.py index a90bc5ae..0893d4b2 100644 --- a/box_sdk_gen/managers/user_collaborations.py +++ b/box_sdk_gen/managers/user_collaborations.py @@ -30,6 +30,7 @@ from box_sdk_gen.fetch import FetchResponse + class UpdateCollaborationByIdRoleArg(str, Enum): EDITOR = 'editor' VIEWER = 'viewer' @@ -40,17 +41,25 @@ class UpdateCollaborationByIdRoleArg(str, Enum): CO_OWNER = 'co-owner' OWNER = 'owner' + class UpdateCollaborationByIdStatusArg(str, Enum): PENDING = 'pending' ACCEPTED = 'accepted' REJECTED = 'rejected' + class CreateCollaborationItemArgTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' + class CreateCollaborationItemArg(BaseObject): - def __init__(self, type: Optional[CreateCollaborationItemArgTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[CreateCollaborationItemArgTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: The type of the item that this collaboration will be granted access to @@ -62,12 +71,20 @@ def __init__(self, type: Optional[CreateCollaborationItemArgTypeField] = None, i self.type = type self.id = id + class CreateCollaborationAccessibleByArgTypeField(str, Enum): USER = 'user' GROUP = 'group' + class CreateCollaborationAccessibleByArg(BaseObject): - def __init__(self, type: CreateCollaborationAccessibleByArgTypeField, id: Optional[str] = None, login: Optional[str] = None, **kwargs): + def __init__( + self, + type: CreateCollaborationAccessibleByArgTypeField, + id: Optional[str] = None, + login: Optional[str] = None, + **kwargs + ): """ :param type: The type of collaborator to invite. :type type: CreateCollaborationAccessibleByArgTypeField @@ -84,6 +101,7 @@ def __init__(self, type: CreateCollaborationAccessibleByArgTypeField, id: Option self.id = id self.login = login + class CreateCollaborationRoleArg(str, Enum): EDITOR = 'editor' VIEWER = 'viewer' @@ -93,11 +111,22 @@ class CreateCollaborationRoleArg(str, Enum): VIEWER_UPLOADER = 'viewer uploader' CO_OWNER = 'co-owner' + class UserCollaborationsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_collaboration_by_id(self, collaboration_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Collaboration: + + def get_collaboration_by_id( + self, + collaboration_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Collaboration: """ Retrieves a single collaboration. :param collaboration_id: The ID of the collaboration @@ -119,15 +148,34 @@ def get_collaboration_by_id(self, collaboration_id: str, fields: Optional[str] = extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaborations/', collaboration_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaborations/', collaboration_id]), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Collaboration.from_dict(json.loads(response.text)) - def update_collaboration_by_id(self, collaboration_id: str, role: UpdateCollaborationByIdRoleArg, status: Optional[UpdateCollaborationByIdStatusArg] = None, expires_at: Optional[str] = None, can_view_path: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Collaboration: + + def update_collaboration_by_id( + self, + collaboration_id: str, + role: UpdateCollaborationByIdRoleArg, + status: Optional[UpdateCollaborationByIdStatusArg] = None, + expires_at: Optional[str] = None, + can_view_path: Optional[bool] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Collaboration: """ Updates a collaboration. - + Can be used to change the owner of an item, or to - + accept collaboration invites. :param collaboration_id: The ID of the collaboration @@ -167,11 +215,29 @@ def update_collaboration_by_id(self, collaboration_id: str, role: UpdateCollabor """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(role=role, status=status, expires_at=expires_at, can_view_path=can_view_path) + request_body = BaseObject( + role=role, status=status, expires_at=expires_at, can_view_path=can_view_path + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaborations/', collaboration_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaborations/', collaboration_id]), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Collaboration.from_dict(json.loads(response.text)) - def delete_collaboration_by_id(self, collaboration_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_collaboration_by_id( + self, + collaboration_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a single collaboration. :param collaboration_id: The ID of the collaboration @@ -183,39 +249,59 @@ def delete_collaboration_by_id(self, collaboration_id: str, extra_headers: Optio if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaborations/', collaboration_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaborations/', collaboration_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) return None - def create_collaboration(self, item: CreateCollaborationItemArg, accessible_by: CreateCollaborationAccessibleByArg, role: CreateCollaborationRoleArg, can_view_path: Optional[bool] = None, expires_at: Optional[str] = None, fields: Optional[str] = None, notify: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Collaboration: + + def create_collaboration( + self, + item: CreateCollaborationItemArg, + accessible_by: CreateCollaborationAccessibleByArg, + role: CreateCollaborationRoleArg, + can_view_path: Optional[bool] = None, + expires_at: Optional[str] = None, + fields: Optional[str] = None, + notify: Optional[bool] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Collaboration: """ Adds a collaboration for a single user or a single group to a file - + or folder. - + Collaborations can be created using email address, user IDs, or a - + group IDs. - + If a collaboration is being created with a group, access to - + this endpoint is dependent on the group's ability to be invited. - + If collaboration is in `pending` status, the following fields - + are redacted: - + - `login` and `name` are hidden if a collaboration was created - + using `user_id`, - + - `name` is hidden if a collaboration was created using `login`. :param item: The item to attach the comment to. @@ -261,8 +347,28 @@ def create_collaboration(self, item: CreateCollaborationItemArg, accessible_by: """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(item=item, accessible_by=accessible_by, role=role, can_view_path=can_view_path, expires_at=expires_at) - query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields), 'notify': to_string(notify)}) + request_body = BaseObject( + item=item, + accessible_by=accessible_by, + role=role, + can_view_path=can_view_path, + expires_at=expires_at, + ) + query_params_map: Dict[str, str] = prepare_params( + {'fields': to_string(fields), 'notify': to_string(notify)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/collaborations']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) - return Collaboration.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/collaborations']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return Collaboration.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/managers/users.py b/box_sdk_gen/managers/users.py index ade4fe0c..d43a742b 100644 --- a/box_sdk_gen/managers/users.py +++ b/box_sdk_gen/managers/users.py @@ -38,31 +38,37 @@ from box_sdk_gen.fetch import FetchResponse + class GetUsersUserTypeArg(str, Enum): ALL = 'all' MANAGED = 'managed' EXTERNAL = 'external' + class CreateUserRoleArg(str, Enum): COADMIN = 'coadmin' USER = 'user' + class CreateUserStatusArg(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' CANNOT_DELETE_EDIT = 'cannot_delete_edit' CANNOT_DELETE_EDIT_UPLOAD = 'cannot_delete_edit_upload' + class UpdateUserByIdRoleArg(str, Enum): COADMIN = 'coadmin' USER = 'user' + class UpdateUserByIdStatusArg(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' CANNOT_DELETE_EDIT = 'cannot_delete_edit' CANNOT_DELETE_EDIT_UPLOAD = 'cannot_delete_edit_upload' + class UpdateUserByIdNotificationEmailArg(BaseObject): def __init__(self, email: Optional[str] = None, **kwargs): """ @@ -72,23 +78,40 @@ def __init__(self, email: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.email = email + class UsersManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_users(self, filter_term: Optional[str] = None, user_type: Optional[GetUsersUserTypeArg] = None, external_app_user_id: Optional[str] = None, fields: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, usemarker: Optional[bool] = None, marker: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Users: + + def get_users( + self, + filter_term: Optional[str] = None, + user_type: Optional[GetUsersUserTypeArg] = None, + external_app_user_id: Optional[str] = None, + fields: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + usemarker: Optional[bool] = None, + marker: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Users: """ Returns a list of all users for the Enterprise along with their `user_id`, - + `public_name`, and `login`. - + The application and the authenticated user need to - + have the permission to look up users in the entire - + enterprise. :param filter_term: Limits the results to only users who's `name` or @@ -148,17 +171,61 @@ def get_users(self, filter_term: Optional[str] = None, user_type: Optional[GetUs """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'filter_term': to_string(filter_term), 'user_type': to_string(user_type), 'external_app_user_id': to_string(external_app_user_id), 'fields': to_string(fields), 'offset': to_string(offset), 'limit': to_string(limit), 'usemarker': to_string(usemarker), 'marker': to_string(marker)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'filter_term': to_string(filter_term), + 'user_type': to_string(user_type), + 'external_app_user_id': to_string(external_app_user_id), + 'fields': to_string(fields), + 'offset': to_string(offset), + 'limit': to_string(limit), + 'usemarker': to_string(usemarker), + 'marker': to_string(marker), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Users.from_dict(json.loads(response.text)) - def create_user(self, name: str, login: Optional[str] = None, is_platform_access_only: Optional[bool] = None, role: Optional[CreateUserRoleArg] = None, language: Optional[str] = None, is_sync_enabled: Optional[bool] = None, job_title: Optional[str] = None, phone: Optional[str] = None, address: Optional[str] = None, space_amount: Optional[int] = None, tracking_codes: Optional[List[TrackingCode]] = None, can_see_managed_users: Optional[bool] = None, timezone: Optional[str] = None, is_external_collab_restricted: Optional[bool] = None, is_exempt_from_device_limits: Optional[bool] = None, is_exempt_from_login_verification: Optional[bool] = None, status: Optional[CreateUserStatusArg] = None, external_app_user_id: Optional[str] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> User: + + def create_user( + self, + name: str, + login: Optional[str] = None, + is_platform_access_only: Optional[bool] = None, + role: Optional[CreateUserRoleArg] = None, + language: Optional[str] = None, + is_sync_enabled: Optional[bool] = None, + job_title: Optional[str] = None, + phone: Optional[str] = None, + address: Optional[str] = None, + space_amount: Optional[int] = None, + tracking_codes: Optional[List[TrackingCode]] = None, + can_see_managed_users: Optional[bool] = None, + timezone: Optional[str] = None, + is_external_collab_restricted: Optional[bool] = None, + is_exempt_from_device_limits: Optional[bool] = None, + is_exempt_from_login_verification: Optional[bool] = None, + status: Optional[CreateUserStatusArg] = None, + external_app_user_id: Optional[str] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> User: """ Creates a new managed user in an enterprise. This endpoint - + is only available to users and applications with the right - + admin permissions. :param name: The name of the user @@ -222,30 +289,66 @@ def create_user(self, name: str, login: Optional[str] = None, is_platform_access """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(name=name, login=login, is_platform_access_only=is_platform_access_only, role=role, language=language, is_sync_enabled=is_sync_enabled, job_title=job_title, phone=phone, address=address, space_amount=space_amount, tracking_codes=tracking_codes, can_see_managed_users=can_see_managed_users, timezone=timezone, is_external_collab_restricted=is_external_collab_restricted, is_exempt_from_device_limits=is_exempt_from_device_limits, is_exempt_from_login_verification=is_exempt_from_login_verification, status=status, external_app_user_id=external_app_user_id) + request_body = BaseObject( + name=name, + login=login, + is_platform_access_only=is_platform_access_only, + role=role, + language=language, + is_sync_enabled=is_sync_enabled, + job_title=job_title, + phone=phone, + address=address, + space_amount=space_amount, + tracking_codes=tracking_codes, + can_see_managed_users=can_see_managed_users, + timezone=timezone, + is_external_collab_restricted=is_external_collab_restricted, + is_exempt_from_device_limits=is_exempt_from_device_limits, + is_exempt_from_login_verification=is_exempt_from_login_verification, + status=status, + external_app_user_id=external_app_user_id, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users']), FetchOptions(method='POST', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users']), + FetchOptions( + method='POST', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return User.from_dict(json.loads(response.text)) - def get_user_me(self, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UserFull: + + def get_user_me( + self, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UserFull: """ Retrieves information about the user who is currently authenticated. - + In the case of a client-side authenticated OAuth 2.0 application - + this will be the user who authorized the app. - + In the case of a JWT, server-side authenticated application - + this will be the service account that belongs to the application - + by default. - + Use the `As-User` header to change who this API call is made on behalf of. :param fields: A comma-separated list of attributes to include in the @@ -264,33 +367,49 @@ def get_user_me(self, fields: Optional[str] = None, extra_headers: Optional[Dict extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/me']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/me']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UserFull.from_dict(json.loads(response.text)) - def get_user_by_id(self, user_id: str, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UserFull: + + def get_user_by_id( + self, + user_id: str, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UserFull: """ Retrieves information about a user in the enterprise. - + The application and the authenticated user need to - + have the permission to look up users in the entire - + enterprise. - + This endpoint also returns a limited set of information - + for external users who are collaborated on content - + owned by the enterprise for authenticated users with the - + right scopes. In this case, disallowed fields will return - + null instead. :param user_id: The ID of the user. @@ -312,15 +431,52 @@ def get_user_by_id(self, user_id: str, fields: Optional[str] = None, extra_heade extra_headers = {} query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id]), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id]), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UserFull.from_dict(json.loads(response.text)) - def update_user_by_id(self, user_id: str, enterprise: Optional[str] = None, notify: Optional[bool] = None, name: Optional[str] = None, login: Optional[str] = None, role: Optional[UpdateUserByIdRoleArg] = None, language: Optional[str] = None, is_sync_enabled: Optional[bool] = None, job_title: Optional[str] = None, phone: Optional[str] = None, address: Optional[str] = None, tracking_codes: Optional[List[TrackingCode]] = None, can_see_managed_users: Optional[bool] = None, timezone: Optional[str] = None, is_external_collab_restricted: Optional[bool] = None, is_exempt_from_device_limits: Optional[bool] = None, is_exempt_from_login_verification: Optional[bool] = None, is_password_reset_required: Optional[bool] = None, status: Optional[UpdateUserByIdStatusArg] = None, space_amount: Optional[int] = None, notification_email: Optional[UpdateUserByIdNotificationEmailArg] = None, external_app_user_id: Optional[str] = None, fields: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> UserFull: + + def update_user_by_id( + self, + user_id: str, + enterprise: Optional[str] = None, + notify: Optional[bool] = None, + name: Optional[str] = None, + login: Optional[str] = None, + role: Optional[UpdateUserByIdRoleArg] = None, + language: Optional[str] = None, + is_sync_enabled: Optional[bool] = None, + job_title: Optional[str] = None, + phone: Optional[str] = None, + address: Optional[str] = None, + tracking_codes: Optional[List[TrackingCode]] = None, + can_see_managed_users: Optional[bool] = None, + timezone: Optional[str] = None, + is_external_collab_restricted: Optional[bool] = None, + is_exempt_from_device_limits: Optional[bool] = None, + is_exempt_from_login_verification: Optional[bool] = None, + is_password_reset_required: Optional[bool] = None, + status: Optional[UpdateUserByIdStatusArg] = None, + space_amount: Optional[int] = None, + notification_email: Optional[UpdateUserByIdNotificationEmailArg] = None, + external_app_user_id: Optional[str] = None, + fields: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> UserFull: """ Updates a managed or app user in an enterprise. This endpoint - + is only available to users and applications with the right - + admin permissions. :param user_id: The ID of the user. @@ -401,21 +557,62 @@ def update_user_by_id(self, user_id: str, enterprise: Optional[str] = None, noti """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(enterprise=enterprise, notify=notify, name=name, login=login, role=role, language=language, is_sync_enabled=is_sync_enabled, job_title=job_title, phone=phone, address=address, tracking_codes=tracking_codes, can_see_managed_users=can_see_managed_users, timezone=timezone, is_external_collab_restricted=is_external_collab_restricted, is_exempt_from_device_limits=is_exempt_from_device_limits, is_exempt_from_login_verification=is_exempt_from_login_verification, is_password_reset_required=is_password_reset_required, status=status, space_amount=space_amount, notification_email=notification_email, external_app_user_id=external_app_user_id) + request_body = BaseObject( + enterprise=enterprise, + notify=notify, + name=name, + login=login, + role=role, + language=language, + is_sync_enabled=is_sync_enabled, + job_title=job_title, + phone=phone, + address=address, + tracking_codes=tracking_codes, + can_see_managed_users=can_see_managed_users, + timezone=timezone, + is_external_collab_restricted=is_external_collab_restricted, + is_exempt_from_device_limits=is_exempt_from_device_limits, + is_exempt_from_login_verification=is_exempt_from_login_verification, + is_password_reset_required=is_password_reset_required, + status=status, + space_amount=space_amount, + notification_email=notification_email, + external_app_user_id=external_app_user_id, + ) query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)}) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id]), FetchOptions(method='PUT', params=query_params_map, headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id]), + FetchOptions( + method='PUT', + params=query_params_map, + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return UserFull.from_dict(json.loads(response.text)) - def delete_user_by_id(self, user_id: str, notify: Optional[bool] = None, force: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_user_by_id( + self, + user_id: str, + notify: Optional[bool] = None, + force: Optional[bool] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Deletes a user. By default this will fail if the user - + still owns any content. Move their owned content first - + before proceeding, or use the `force` field to delete - + the user and their files. :param user_id: The ID of the user. @@ -432,7 +629,19 @@ def delete_user_by_id(self, user_id: str, notify: Optional[bool] = None, force: """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'notify': to_string(notify), 'force': to_string(force)}) + query_params_map: Dict[str, str] = prepare_params( + {'notify': to_string(notify), 'force': to_string(force)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/users/', user_id]), FetchOptions(method='DELETE', params=query_params_map, headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/users/', user_id]), + FetchOptions( + method='DELETE', + params=query_params_map, + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/web_links.py b/box_sdk_gen/managers/web_links.py index 6a2223e0..1b9d03f8 100644 --- a/box_sdk_gen/managers/web_links.py +++ b/box_sdk_gen/managers/web_links.py @@ -30,6 +30,7 @@ from box_sdk_gen.fetch import FetchResponse + class CreateWebLinkParentArg(BaseObject): def __init__(self, id: str, **kwargs): """ @@ -39,6 +40,7 @@ def __init__(self, id: str, **kwargs): super().__init__(**kwargs) self.id = id + class UpdateWebLinkByIdParentArg(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ @@ -48,13 +50,22 @@ def __init__(self, id: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.id = id + class UpdateWebLinkByIdSharedLinkArgAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class UpdateWebLinkByIdSharedLinkArg(BaseObject): - def __init__(self, access: Optional[UpdateWebLinkByIdSharedLinkArgAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, **kwargs): + def __init__( + self, + access: Optional[UpdateWebLinkByIdSharedLinkArgAccessField] = None, + password: Optional[str] = None, + vanity_name: Optional[str] = None, + unshared_at: Optional[str] = None, + **kwargs + ): """ :param access: The level of access for the shared link. This can be restricted to anyone with the link (`open`), only people @@ -92,11 +103,24 @@ def __init__(self, access: Optional[UpdateWebLinkByIdSharedLinkArgAccessField] = self.vanity_name = vanity_name self.unshared_at = unshared_at + class WebLinksManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def create_web_link(self, url: str, parent: CreateWebLinkParentArg, name: Optional[str] = None, description: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> WebLink: + + def create_web_link( + self, + url: str, + parent: CreateWebLinkParentArg, + name: Optional[str] = None, + description: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> WebLink: """ Creates a web link object within a folder. :param url: The URL that this web link links to. Must start with @@ -113,11 +137,30 @@ def create_web_link(self, url: str, parent: CreateWebLinkParentArg, name: Option """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(url=url, parent=parent, name=name, description=description) + request_body = BaseObject( + url=url, parent=parent, name=name, description=description + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/web_links']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/web_links']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return WebLink.from_dict(json.loads(response.text)) - def get_web_link_by_id(self, web_link_id: str, boxapi: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> WebLink: + + def get_web_link_by_id( + self, + web_link_id: str, + boxapi: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> WebLink: """ Retrieve information about a web link. :param web_link_id: The ID of the web link. @@ -136,10 +179,31 @@ def get_web_link_by_id(self, web_link_id: str, boxapi: Optional[str] = None, ext """ if extra_headers is None: extra_headers = {} - headers_map: Dict[str, str] = prepare_params({'boxapi': to_string(boxapi), **extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/web_links/', web_link_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + headers_map: Dict[str, str] = prepare_params( + {'boxapi': to_string(boxapi), **extra_headers} + ) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/web_links/', web_link_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return WebLink.from_dict(json.loads(response.text)) - def update_web_link_by_id(self, web_link_id: str, url: Optional[str] = None, parent: Optional[UpdateWebLinkByIdParentArg] = None, name: Optional[str] = None, description: Optional[str] = None, shared_link: Optional[UpdateWebLinkByIdSharedLinkArg] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> WebLink: + + def update_web_link_by_id( + self, + web_link_id: str, + url: Optional[str] = None, + parent: Optional[UpdateWebLinkByIdParentArg] = None, + name: Optional[str] = None, + description: Optional[str] = None, + shared_link: Optional[UpdateWebLinkByIdSharedLinkArg] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> WebLink: """ Updates a web link object. :param web_link_id: The ID of the web link. @@ -159,11 +223,31 @@ def update_web_link_by_id(self, web_link_id: str, url: Optional[str] = None, par """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(url=url, parent=parent, name=name, description=description, shared_link=shared_link) + request_body = BaseObject( + url=url, + parent=parent, + name=name, + description=description, + shared_link=shared_link, + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/web_links/', web_link_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/web_links/', web_link_id]), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return WebLink.from_dict(json.loads(response.text)) - def delete_web_link_by_id(self, web_link_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_web_link_by_id( + self, web_link_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Deletes a web link. :param web_link_id: The ID of the web link. @@ -175,5 +259,14 @@ def delete_web_link_by_id(self, web_link_id: str, extra_headers: Optional[Dict[s if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/web_links/', web_link_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/web_links/', web_link_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/webhooks.py b/box_sdk_gen/managers/webhooks.py index 1886a2f4..fbfa67aa 100644 --- a/box_sdk_gen/managers/webhooks.py +++ b/box_sdk_gen/managers/webhooks.py @@ -34,12 +34,19 @@ from box_sdk_gen.fetch import FetchResponse + class CreateWebhookTargetArgTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' + class CreateWebhookTargetArg(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CreateWebhookTargetArgTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CreateWebhookTargetArgTypeField] = None, + **kwargs + ): """ :param id: The ID of the item to trigger a webhook :type id: Optional[str], optional @@ -50,6 +57,7 @@ def __init__(self, id: Optional[str] = None, type: Optional[CreateWebhookTargetA self.id = id self.type = type + class CreateWebhookTriggersArg(str, Enum): FILE_UPLOADED = 'FILE.UPLOADED' FILE_PREVIEWED = 'FILE.PREVIEWED' @@ -92,12 +100,19 @@ class CreateWebhookTriggersArg(str, Enum): SIGN_REQUEST_EXPIRED = 'SIGN_REQUEST.EXPIRED' SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED' + class UpdateWebhookByIdTargetArgTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' + class UpdateWebhookByIdTargetArg(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[UpdateWebhookByIdTargetArgTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[UpdateWebhookByIdTargetArgTypeField] = None, + **kwargs + ): """ :param id: The ID of the item to trigger a webhook :type id: Optional[str], optional @@ -108,6 +123,7 @@ def __init__(self, id: Optional[str] = None, type: Optional[UpdateWebhookByIdTar self.id = id self.type = type + class UpdateWebhookByIdTriggersArg(str, Enum): FILE_UPLOADED = 'FILE.UPLOADED' FILE_PREVIEWED = 'FILE.PREVIEWED' @@ -150,23 +166,34 @@ class UpdateWebhookByIdTriggersArg(str, Enum): SIGN_REQUEST_EXPIRED = 'SIGN_REQUEST.EXPIRED' SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED' + class WebhooksManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_webhooks(self, marker: Optional[str] = None, limit: Optional[int] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Webhooks: + + def get_webhooks( + self, + marker: Optional[str] = None, + limit: Optional[int] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Webhooks: """ Returns all defined webhooks for the requesting application. - + This API only returns webhooks that are applied to files or folders that are - + owned by the authenticated user. This means that an admin can not see webhooks - + created by a service account unless the admin has access to those folders, and - + vice versa. :param marker: Defines the position marker at which to begin returning results. This is @@ -180,11 +207,30 @@ def get_webhooks(self, marker: Optional[str] = None, limit: Optional[int] = None """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'marker': to_string(marker), 'limit': to_string(limit)}) + query_params_map: Dict[str, str] = prepare_params( + {'marker': to_string(marker), 'limit': to_string(limit)} + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/webhooks']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/webhooks']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Webhooks.from_dict(json.loads(response.text)) - def create_webhook(self, target: CreateWebhookTargetArg, address: str, triggers: List[CreateWebhookTriggersArg], extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Webhook: + + def create_webhook( + self, + target: CreateWebhookTargetArg, + address: str, + triggers: List[CreateWebhookTriggersArg], + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Webhook: """ Creates a webhook. :param target: The item that will trigger the webhook @@ -199,11 +245,25 @@ def create_webhook(self, target: CreateWebhookTargetArg, address: str, triggers: """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(target=target, address=address, triggers=triggers) + request_body = BaseObject(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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/webhooks']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Webhook.from_dict(json.loads(response.text)) - def get_webhook_by_id(self, webhook_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Webhook: + + def get_webhook_by_id( + self, webhook_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> Webhook: """ Retrieves a specific webhook :param webhook_id: The ID of the webhook. @@ -215,9 +275,26 @@ def get_webhook_by_id(self, webhook_id: str, extra_headers: Optional[Dict[str, O if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/webhooks/', webhook_id]), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/webhooks/', webhook_id]), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Webhook.from_dict(json.loads(response.text)) - def update_webhook_by_id(self, webhook_id: str, target: Optional[UpdateWebhookByIdTargetArg] = None, address: Optional[str] = None, triggers: Optional[List[UpdateWebhookByIdTriggersArg]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Webhook: + + def update_webhook_by_id( + self, + webhook_id: str, + target: Optional[UpdateWebhookByIdTargetArg] = None, + address: Optional[str] = None, + triggers: Optional[List[UpdateWebhookByIdTriggersArg]] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Webhook: """ Updates a webhook. :param webhook_id: The ID of the webhook. @@ -235,11 +312,25 @@ def update_webhook_by_id(self, webhook_id: str, target: Optional[UpdateWebhookBy """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(target=target, address=address, triggers=triggers) + request_body = BaseObject(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/', webhook_id]), FetchOptions(method='PUT', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/webhooks/', webhook_id]), + FetchOptions( + method='PUT', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Webhook.from_dict(json.loads(response.text)) - def delete_webhook_by_id(self, webhook_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def delete_webhook_by_id( + self, webhook_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None + ) -> None: """ Deletes a webhook. :param webhook_id: The ID of the webhook. @@ -251,5 +342,14 @@ def delete_webhook_by_id(self, webhook_id: str, extra_headers: Optional[Dict[str if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/webhooks/', webhook_id]), FetchOptions(method='DELETE', headers=headers_map, response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/webhooks/', webhook_id]), + FetchOptions( + method='DELETE', + headers=headers_map, + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/workflows.py b/box_sdk_gen/managers/workflows.py index cd7bae74..d764161c 100644 --- a/box_sdk_gen/managers/workflows.py +++ b/box_sdk_gen/managers/workflows.py @@ -32,9 +32,11 @@ from box_sdk_gen.fetch import FetchResponse + class CreateWorkflowStartTypeArg(str, Enum): WORKFLOW_PARAMETERS = 'workflow_parameters' + class CreateWorkflowStartFlowArg(BaseObject): def __init__(self, type: Optional[str] = None, id: Optional[str] = None, **kwargs): """ @@ -47,11 +49,18 @@ def __init__(self, type: Optional[str] = None, id: Optional[str] = None, **kwarg self.type = type self.id = id + class CreateWorkflowStartFilesArgTypeField(str, Enum): FILE = 'file' + class CreateWorkflowStartFilesArg(BaseObject): - def __init__(self, type: Optional[CreateWorkflowStartFilesArgTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[CreateWorkflowStartFilesArgTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: The type of the file object :type type: Optional[CreateWorkflowStartFilesArgTypeField], optional @@ -62,11 +71,18 @@ def __init__(self, type: Optional[CreateWorkflowStartFilesArgTypeField] = None, self.type = type self.id = id + class CreateWorkflowStartFolderArgTypeField(str, Enum): FOLDER = 'folder' + class CreateWorkflowStartFolderArg(BaseObject): - def __init__(self, type: Optional[CreateWorkflowStartFolderArgTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[CreateWorkflowStartFolderArgTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: The type of the folder object :type type: Optional[CreateWorkflowStartFolderArgTypeField], optional @@ -77,11 +93,19 @@ def __init__(self, type: Optional[CreateWorkflowStartFolderArgTypeField] = None, self.type = type self.id = id + class CreateWorkflowStartOutcomesArgTypeField(str, Enum): OUTCOME = 'outcome' + class CreateWorkflowStartOutcomesArg(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CreateWorkflowStartOutcomesArgTypeField] = None, parameter: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CreateWorkflowStartOutcomesArgTypeField] = None, + parameter: Optional[str] = None, + **kwargs + ): """ :param id: The id of the outcome :type id: Optional[str], optional @@ -97,20 +121,33 @@ def __init__(self, id: Optional[str] = None, type: Optional[CreateWorkflowStartO self.type = type self.parameter = parameter + class WorkflowsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def get_workflows(self, folder_id: str, trigger_type: Optional[str] = None, limit: Optional[int] = None, marker: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> Workflows: + + def get_workflows( + self, + folder_id: str, + trigger_type: Optional[str] = None, + limit: Optional[int] = None, + marker: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> Workflows: """ Returns list of workflows that act on a given `folder ID`, and - + have a flow with a trigger type of `WORKFLOW_MANUAL_START`. - + You application must be authorized to use the `Manage Box Relay` application - + scope within the developer console in to use this endpoint. :param folder_id: The unique identifier that represent a folder. @@ -135,17 +172,44 @@ def get_workflows(self, folder_id: str, trigger_type: Optional[str] = None, limi """ if extra_headers is None: extra_headers = {} - query_params_map: Dict[str, str] = prepare_params({'folder_id': to_string(folder_id), 'trigger_type': to_string(trigger_type), 'limit': to_string(limit), 'marker': to_string(marker)}) + query_params_map: Dict[str, str] = prepare_params( + { + 'folder_id': to_string(folder_id), + 'trigger_type': to_string(trigger_type), + 'limit': to_string(limit), + 'marker': to_string(marker), + } + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/workflows']), FetchOptions(method='GET', params=query_params_map, headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/workflows']), + FetchOptions( + method='GET', + params=query_params_map, + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return Workflows.from_dict(json.loads(response.text)) - def create_workflow_start(self, workflow_id: str, flow: CreateWorkflowStartFlowArg, files: List[CreateWorkflowStartFilesArg], folder: CreateWorkflowStartFolderArg, type: Optional[CreateWorkflowStartTypeArg] = None, outcomes: Optional[List[CreateWorkflowStartOutcomesArg]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> None: + + def create_workflow_start( + self, + workflow_id: str, + flow: CreateWorkflowStartFlowArg, + files: List[CreateWorkflowStartFilesArg], + folder: CreateWorkflowStartFolderArg, + type: Optional[CreateWorkflowStartTypeArg] = None, + outcomes: Optional[List[CreateWorkflowStartOutcomesArg]] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: """ Initiates a flow with a trigger type of `WORKFLOW_MANUAL_START`. - + You application must be authorized to use the `Manage Box Relay` application - + scope within the developer console. :param workflow_id: The ID of the workflow. @@ -167,7 +231,20 @@ def create_workflow_start(self, workflow_id: str, flow: CreateWorkflowStartFlowA """ if extra_headers is None: extra_headers = {} - request_body: BaseObject = BaseObject(type=type, flow=flow, files=files, folder=folder, outcomes=outcomes) + request_body = BaseObject( + type=type, flow=flow, files=files, folder=folder, outcomes=outcomes + ) headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/workflows/', workflow_id, '/start']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format=None, auth=self.auth, network_session=self.network_session)) - return None \ No newline at end of file + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/workflows/', workflow_id, '/start']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format=None, + auth=self.auth, + network_session=self.network_session, + ), + ) + return None diff --git a/box_sdk_gen/managers/zip_downloads.py b/box_sdk_gen/managers/zip_downloads.py index cc33baf2..16c4439a 100644 --- a/box_sdk_gen/managers/zip_downloads.py +++ b/box_sdk_gen/managers/zip_downloads.py @@ -34,10 +34,12 @@ from box_sdk_gen.fetch import FetchResponse + class CreateZipDownloadItemsArgTypeField(str, Enum): FILE = 'file' FOLDER_ = 'folder.' + class CreateZipDownloadItemsArg(BaseObject): def __init__(self, type: CreateZipDownloadItemsArgTypeField, id: str, **kwargs): """ @@ -51,50 +53,61 @@ def __init__(self, type: CreateZipDownloadItemsArgTypeField, id: str, **kwargs): self.type = type self.id = id + class ZipDownloadsManager: - def __init__(self, auth: Optional[Authentication] = None, network_session: Optional[NetworkSession] = None): + def __init__( + self, + auth: Optional[Authentication] = None, + network_session: Optional[NetworkSession] = None, + ): self.auth = auth self.network_session = network_session - def create_zip_download(self, items: List[CreateZipDownloadItemsArg], download_file_name: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ZipDownload: + + def create_zip_download( + self, + items: List[CreateZipDownloadItemsArg], + download_file_name: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ZipDownload: """ Creates a request to download multiple files and folders as a single `zip` - + archive file. This API does not return the archive but instead performs all - + the checks to ensure that the user has access to all the items, and then - + returns a `download_url` and a `status_url` that can be used to download the - + archive. - + The limit for an archive is either the Account's upload limit or - + 10,000 files, whichever is met first. - + **Note**: Downloading a large file can be - + affected by various - + factors such as distance, network latency, - + bandwidth, and congestion, as well as packet loss - + ratio and current server load. - + For these reasons we recommend that a maximum ZIP archive - + total size does not exceed 25GB. :param items: A list of items to add to the `zip` archive. These can @@ -108,41 +121,59 @@ def create_zip_download(self, items: List[CreateZipDownloadItemsArg], download_f """ if extra_headers is None: extra_headers = {} - request_body: ZipDownloadRequest = ZipDownloadRequest(items=items, download_file_name=download_file_name) + request_body = ZipDownloadRequest( + 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']), FetchOptions(method='POST', headers=headers_map, body=json.dumps(request_body.to_dict()), content_type='application/json', response_format='json', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/2.0/zip_downloads']), + FetchOptions( + method='POST', + headers=headers_map, + body=json.dumps(request_body.to_dict()), + content_type='application/json', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) return ZipDownload.from_dict(json.loads(response.text)) - def get_zip_download_content(self, zip_download_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ByteStream: + + def get_zip_download_content( + self, + zip_download_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ByteStream: """ Returns the contents of a `zip` archive in binary format. This URL does not - + require any form of authentication and could be used in a user's browser to - + download the archive to a user's device. - + By default, this URL is only valid for a few seconds from the creation of - + the request for this archive. Once a download has started it can not be - + stopped and resumed, instead a new request for a zip archive would need to - + be created. - + The URL of this endpoint should not be considered as fixed. Instead, use - + the [Create zip download](e://post_zip_downloads) API to request to create a - + `zip` archive, and then follow the `download_url` field in the response to - + this endpoint. :param zip_download_id: The unique identifier that represent this `zip` archive. @@ -154,36 +185,56 @@ def get_zip_download_content(self, zip_download_id: str, extra_headers: Optional if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://dl.boxcloud.com/2.0/zip_downloads/', zip_download_id, '/content']), FetchOptions(method='GET', headers=headers_map, response_format='binary', auth=self.auth, network_session=self.network_session)) + response: FetchResponse = fetch( + ''.join( + [ + 'https://dl.boxcloud.com/2.0/zip_downloads/', + zip_download_id, + '/content', + ] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='binary', + auth=self.auth, + network_session=self.network_session, + ), + ) return response.content - def get_zip_download_status(self, zip_download_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None) -> ZipDownloadStatus: + + def get_zip_download_status( + self, + zip_download_id: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> ZipDownloadStatus: """ Returns the download status of a `zip` archive, allowing an application to - + inspect the progress of the download as well as the number of items that - + might have been skipped. - + This endpoint can only be accessed once the download has started. - + Subsequently this endpoint is valid for 12 hours from the start of the - + download. - + The URL of this endpoint should not be considered as fixed. Instead, use - + the [Create zip download](e://post_zip_downloads) API to request to create a - + `zip` archive, and then follow the `status_url` field in the response to - + this endpoint. :param zip_download_id: The unique identifier that represent this `zip` archive. @@ -195,5 +246,16 @@ def get_zip_download_status(self, zip_download_id: str, extra_headers: Optional[ if extra_headers is None: extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) - response: FetchResponse = fetch(''.join(['https://api.box.com/2.0/zip_downloads/', zip_download_id, '/status']), FetchOptions(method='GET', headers=headers_map, response_format='json', auth=self.auth, network_session=self.network_session)) - return ZipDownloadStatus.from_dict(json.loads(response.text)) \ No newline at end of file + response: FetchResponse = fetch( + ''.join( + ['https://api.box.com/2.0/zip_downloads/', zip_download_id, '/status'] + ), + FetchOptions( + method='GET', + headers=headers_map, + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return ZipDownloadStatus.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/oauth.py b/box_sdk_gen/oauth.py index 9820c6a1..c242e750 100644 --- a/box_sdk_gen/oauth.py +++ b/box_sdk_gen/oauth.py @@ -3,16 +3,17 @@ from typing import Union, Optional from .auth import Authentication -from .auth_schemas import TokenRequest, TokenRequestGrantType, AccessToken +from .auth_schemas import TokenRequest, TokenRequestGrantType from .fetch import fetch, FetchResponse, FetchOptions from .network import NetworkSession +from .schemas import AccessToken class OAuthConfig: def __init__( - self, - client_id: str, - client_secret: str, + self, + client_id: str, + client_secret: str, ): """ :param client_id: @@ -26,12 +27,12 @@ def __init__( class GetAuthorizeUrlOptions: def __init__( - self, - client_id: Optional[str] = None, - redirect_uri: Optional[str] = None, - response_type: Optional[str] = None, - state: Optional[str] = None, - scope: Optional[str] = None + self, + client_id: Optional[str] = None, + redirect_uri: Optional[str] = None, + response_type: Optional[str] = None, + state: Optional[str] = None, + scope: Optional[str] = None, ): """ :param client_id: The Client ID of the application that is requesting to authenticate the user. @@ -52,7 +53,7 @@ def __init__( class OAuth(Authentication): OAUTH2_AUTHORIZE_URL = 'https://account.box.com/api/oauth2/authorize' - def __init__(self, config: OAuthConfig): + def __init__(self, config: OAuthConfig): """ :param config: Configuration object of OAuth. @@ -60,7 +61,9 @@ def __init__(self, config: OAuthConfig): self.config = config self.token: Union[None, AccessToken] = None - def get_authorize_url(self, options: Optional[GetAuthorizeUrlOptions] = None) -> str: + def get_authorize_url( + self, options: Optional[GetAuthorizeUrlOptions] = None + ) -> str: """ Get the authorization URL for the app user. :param options: Options class for getting authorization url @@ -70,8 +73,18 @@ def get_authorize_url(self, options: Optional[GetAuthorizeUrlOptions] = None) -> options = GetAuthorizeUrlOptions() params = [ - ('client_id', options.client_id if options.client_id is not None else self.config.client_id), - ('response_type', options.response_type if options.response_type is not None else 'code'), + ( + 'client_id', + ( + options.client_id + if options.client_id is not None + else self.config.client_id + ), + ), + ( + 'response_type', + options.response_type if options.response_type is not None else 'code', + ), ] if options.redirect_uri is not None: @@ -83,14 +96,14 @@ def get_authorize_url(self, options: Optional[GetAuthorizeUrlOptions] = None) -> if options.scope is not None: params.append(('scope', options.scope)) - params = [(key.encode('utf-8'), value.encode('utf-8')) for (key, value) in params] + params = [ + (key.encode('utf-8'), value.encode('utf-8')) for (key, value) in params + ] query_string = urlencode(params) return urlunsplit(('', '', self.OAUTH2_AUTHORIZE_URL, query_string, '')) def get_tokens_authorization_code_grant( - self, - authorization_code: str, - network_session: Optional[NetworkSession] = None + self, authorization_code: str, network_session: Optional[NetworkSession] = None ) -> str: """ Send token request and return the access_token @@ -102,23 +115,32 @@ def get_tokens_authorization_code_grant( grant_type=TokenRequestGrantType.AUTHORIZATION_CODE, client_id=self.config.client_id, client_secret=self.config.client_secret, - code=authorization_code + code=authorization_code, ) self.token = self._send_token_request(request_body, network_session) return self.token.access_token - def retrieve_token(self, network_session: Optional[NetworkSession] = None) -> str: + def retrieve_token( + self, network_session: Optional[NetworkSession] = None + ) -> AccessToken: """ Return a current token or get a new one when not available. :param network_session: An object to keep network session state :return: Valid access token """ if self.token is None: - raise Exception("Access and refresh tokens not available. Authenticate before making any API call first.") - return self.token.access_token + raise Exception( + "Access and refresh tokens not available. Authenticate before making" + " any API call first." + ) + return self.token - def refresh(self, network_session: Optional[NetworkSession] = None) -> str: + def refresh_token( + self, + network_session: Optional[NetworkSession] = None, + refresh_token: Optional[str] = None, + ) -> AccessToken: """ Refresh outdated access token with refresh token :param network_session: An object to keep network session state @@ -128,16 +150,15 @@ def refresh(self, network_session: Optional[NetworkSession] = None) -> str: grant_type=TokenRequestGrantType.REFRESH_TOKEN, client_id=self.config.client_id, client_secret=self.config.client_secret, - refresh_token=self.token.refresh_token + refresh_token=refresh_token or self.token.refresh_token, ) self.token = self._send_token_request(request_body, network_session) - return self.token.access_token + return self.token @staticmethod def _send_token_request( - request_body: TokenRequest, - network_session: Optional[NetworkSession] = None + request_body: TokenRequest, network_session: Optional[NetworkSession] = None ) -> AccessToken: response: FetchResponse = fetch( 'https://api.box.com/oauth2/token', @@ -145,8 +166,8 @@ def _send_token_request( method='POST', body=urlencode(request_body.to_dict()), headers={'content-type': 'application/x-www-form-urlencoded'}, - network_session=network_session - ) + network_session=network_session, + ), ) return AccessToken.from_dict(json.loads(response.text)) diff --git a/box_sdk_gen/schemas.py b/box_sdk_gen/schemas.py index 04aeab68..2c07a87e 100644 --- a/box_sdk_gen/schemas.py +++ b/box_sdk_gen/schemas.py @@ -10,25 +10,56 @@ from typing import Union + class PostOAuth2TokenGrantTypeField(str, Enum): AUTHORIZATION_CODE = 'authorization_code' REFRESH_TOKEN = 'refresh_token' CLIENT_CREDENTIALS = 'client_credentials' - URN_IETF_PARAMS_OAUTH_GRANT_TYPE_JWT_BEARER = 'urn:ietf:params:oauth:grant-type:jwt-bearer' - URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE = 'urn:ietf:params:oauth:grant-type:token-exchange' + URN_IETF_PARAMS_OAUTH_GRANT_TYPE_JWT_BEARER = ( + 'urn:ietf:params:oauth:grant-type:jwt-bearer' + ) + URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE = ( + 'urn:ietf:params:oauth:grant-type:token-exchange' + ) + class PostOAuth2TokenSubjectTokenTypeField(str, Enum): - URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN = 'urn:ietf:params:oauth:token-type:access_token' + URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN = ( + 'urn:ietf:params:oauth:token-type:access_token' + ) + class PostOAuth2TokenActorTokenTypeField(str, Enum): - URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ID_TOKEN = 'urn:ietf:params:oauth:token-type:id_token' + URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ID_TOKEN = ( + 'urn:ietf:params:oauth:token-type:id_token' + ) + class PostOAuth2TokenBoxSubjectTypeField(str, Enum): ENTERPRISE = 'enterprise' USER = 'user' + class PostOAuth2Token(BaseObject): - def __init__(self, grant_type: PostOAuth2TokenGrantTypeField, client_id: Optional[str] = None, client_secret: Optional[str] = None, code: Optional[str] = None, refresh_token: Optional[str] = None, assertion: Optional[str] = None, subject_token: Optional[str] = None, subject_token_type: Optional[PostOAuth2TokenSubjectTokenTypeField] = None, actor_token: Optional[str] = None, actor_token_type: Optional[PostOAuth2TokenActorTokenTypeField] = None, scope: Optional[str] = None, resource: Optional[str] = None, box_subject_type: Optional[PostOAuth2TokenBoxSubjectTypeField] = None, box_subject_id: Optional[str] = None, box_shared_link: Optional[str] = None, **kwargs): + def __init__( + self, + grant_type: PostOAuth2TokenGrantTypeField, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + code: Optional[str] = None, + refresh_token: Optional[str] = None, + assertion: Optional[str] = None, + subject_token: Optional[str] = None, + subject_token_type: Optional[PostOAuth2TokenSubjectTokenTypeField] = None, + actor_token: Optional[str] = None, + actor_token_type: Optional[PostOAuth2TokenActorTokenTypeField] = None, + scope: Optional[str] = None, + resource: Optional[str] = None, + box_subject_type: Optional[PostOAuth2TokenBoxSubjectTypeField] = None, + box_subject_id: Optional[str] = None, + box_shared_link: Optional[str] = None, + **kwargs + ): """ :param grant_type: The type of request being made, either using a client-side obtained authorization code, a refresh token, a JWT assertion, client credentials @@ -107,11 +138,20 @@ def __init__(self, grant_type: PostOAuth2TokenGrantTypeField, client_id: Optiona self.box_subject_id = box_subject_id self.box_shared_link = box_shared_link + class PostOAuth2TokenRefreshAccessTokenGrantTypeField(str, Enum): REFRESH_TOKEN = 'refresh_token' + class PostOAuth2TokenRefreshAccessToken(BaseObject): - def __init__(self, grant_type: PostOAuth2TokenRefreshAccessTokenGrantTypeField, client_id: str, client_secret: str, refresh_token: str, **kwargs): + def __init__( + self, + grant_type: PostOAuth2TokenRefreshAccessTokenGrantTypeField, + client_id: str, + client_secret: str, + refresh_token: str, + **kwargs + ): """ :param grant_type: The type of request being made, in this case a refresh request. :type grant_type: PostOAuth2TokenRefreshAccessTokenGrantTypeField @@ -128,8 +168,15 @@ def __init__(self, grant_type: PostOAuth2TokenRefreshAccessTokenGrantTypeField, self.client_secret = client_secret self.refresh_token = refresh_token + class PostOAuth2Revoke(BaseObject): - def __init__(self, client_id: Optional[str] = None, client_secret: Optional[str] = None, token: Optional[str] = None, **kwargs): + def __init__( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + token: Optional[str] = None, + **kwargs + ): """ :param client_id: The Client ID of the application requesting to revoke the access token. @@ -145,10 +192,12 @@ def __init__(self, client_id: Optional[str] = None, client_secret: Optional[str] self.client_secret = client_secret self.token = token + class ZipDownloadRequestItemsFieldTypeField(str, Enum): FILE = 'file' FOLDER_ = 'folder.' + class ZipDownloadRequestItemsField(BaseObject): def __init__(self, type: ZipDownloadRequestItemsFieldTypeField, id: str, **kwargs): """ @@ -162,8 +211,14 @@ def __init__(self, type: ZipDownloadRequestItemsFieldTypeField, id: str, **kwarg self.type = type self.id = id + class ZipDownloadRequest(BaseObject): - def __init__(self, items: List[ZipDownloadRequestItemsField], download_file_name: Optional[str] = None, **kwargs): + def __init__( + self, + items: List[ZipDownloadRequestItemsField], + download_file_name: Optional[str] = None, + **kwargs + ): """ :param items: A list of items to add to the `zip` archive. These can be folders or files. @@ -176,12 +231,19 @@ def __init__(self, items: List[ZipDownloadRequestItemsField], download_file_name self.items = items self.download_file_name = download_file_name + class MetadataQueryOrderByFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class MetadataQueryOrderByField(BaseObject): - def __init__(self, field_key: Optional[str] = None, direction: Optional[MetadataQueryOrderByFieldDirectionField] = None, **kwargs): + def __init__( + self, + field_key: Optional[str] = None, + direction: Optional[MetadataQueryOrderByFieldDirectionField] = None, + **kwargs + ): """ :param field_key: The metadata template field to order by. The `field_key` represents the `key` value of a field from the @@ -196,10 +258,29 @@ def __init__(self, field_key: Optional[str] = None, direction: Optional[Metadata self.field_key = field_key self.direction = direction + class MetadataQuery(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'from_': 'from', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'from': 'from_', **BaseObject._json_to_fields_mapping} - def __init__(self, from_: str, ancestor_folder_id: str, query: Optional[str] = None, query_params: Optional[Dict[str, str]] = None, order_by: Optional[List[MetadataQueryOrderByField]] = None, limit: Optional[int] = None, marker: Optional[str] = None, fields: Optional[List[str]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'from_': 'from', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'from': 'from_', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + from_: str, + ancestor_folder_id: str, + query: Optional[str] = None, + query_params: Optional[Dict[str, str]] = None, + order_by: Optional[List[MetadataQueryOrderByField]] = None, + limit: Optional[int] = None, + marker: Optional[str] = None, + fields: Optional[List[str]] = None, + **kwargs + ): """ :param from_: Specifies the template used in the query. Must be in the form `scope.templateKey`. Not all templates can be used in this field, @@ -259,12 +340,23 @@ def __init__(self, from_: str, ancestor_folder_id: str, query: Optional[str] = N self.marker = marker self.fields = fields + class FileRequestUpdateRequestStatusField(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' + class FileRequestUpdateRequest(BaseObject): - def __init__(self, title: Optional[str] = None, description: Optional[str] = None, status: Optional[FileRequestUpdateRequestStatusField] = None, is_email_required: Optional[bool] = None, is_description_required: Optional[bool] = None, expires_at: Optional[str] = None, **kwargs): + def __init__( + self, + title: Optional[str] = None, + description: Optional[str] = None, + status: Optional[FileRequestUpdateRequestStatusField] = None, + is_email_required: Optional[bool] = None, + is_description_required: Optional[bool] = None, + expires_at: Optional[str] = None, + **kwargs + ): """ :param title: An optional new title for the file request. This can be used to change the title of the file request. @@ -308,11 +400,18 @@ def __init__(self, title: Optional[str] = None, description: Optional[str] = Non self.is_description_required = is_description_required self.expires_at = expires_at + class FileRequestCopyRequestFolderFieldTypeField(str, Enum): FOLDER = 'folder' + class FileRequestCopyRequestFolderField(BaseObject): - def __init__(self, id: str, type: Optional[FileRequestCopyRequestFolderFieldTypeField] = None, **kwargs): + def __init__( + self, + id: str, + type: Optional[FileRequestCopyRequestFolderFieldTypeField] = None, + **kwargs + ): """ :param id: The ID of the folder to associate the new file request to. @@ -324,8 +423,19 @@ def __init__(self, id: str, type: Optional[FileRequestCopyRequestFolderFieldType self.id = id self.type = type + class FileRequestCopyRequest(FileRequestUpdateRequest): - def __init__(self, folder: FileRequestCopyRequestFolderField, title: Optional[str] = None, description: Optional[str] = None, status: Optional[FileRequestUpdateRequestStatusField] = None, is_email_required: Optional[bool] = None, is_description_required: Optional[bool] = None, expires_at: Optional[str] = None, **kwargs): + def __init__( + self, + folder: FileRequestCopyRequestFolderField, + title: Optional[str] = None, + description: Optional[str] = None, + status: Optional[FileRequestUpdateRequestStatusField] = None, + is_email_required: Optional[bool] = None, + is_description_required: Optional[bool] = None, + expires_at: Optional[str] = None, + **kwargs + ): """ :param folder: The folder to associate the new file request to. :type folder: FileRequestCopyRequestFolderField @@ -363,12 +473,22 @@ def __init__(self, folder: FileRequestCopyRequestFolderField, title: Optional[st This will default to the value on the existing file request. :type expires_at: Optional[str], optional """ - super().__init__(title=title, description=description, status=status, is_email_required=is_email_required, is_description_required=is_description_required, expires_at=expires_at, **kwargs) + super().__init__( + title=title, + description=description, + status=status, + is_email_required=is_email_required, + is_description_required=is_description_required, + expires_at=expires_at, + **kwargs + ) self.folder = folder + class ClientErrorTypeField(str, Enum): ERROR = 'error' + class ClientErrorCodeField(str, Enum): CREATED = 'created' ACCEPTED = 'accepted' @@ -388,6 +508,7 @@ class ClientErrorCodeField(str, Enum): ITEM_NAME_INVALID = 'item_name_invalid' INSUFFICIENT_SCOPE = 'insufficient_scope' + class ClientErrorContextInfoField(BaseObject): def __init__(self, message: Optional[str] = None, **kwargs): """ @@ -397,8 +518,19 @@ def __init__(self, message: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.message = message + class ClientError(BaseObject): - def __init__(self, type: Optional[ClientErrorTypeField] = None, status: Optional[int] = None, code: Optional[ClientErrorCodeField] = None, message: Optional[str] = None, context_info: Optional[ClientErrorContextInfoField] = None, help_url: Optional[str] = None, request_id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[ClientErrorTypeField] = None, + status: Optional[int] = None, + code: Optional[ClientErrorCodeField] = None, + message: Optional[str] = None, + context_info: Optional[ClientErrorContextInfoField] = None, + help_url: Optional[str] = None, + request_id: Optional[str] = None, + **kwargs + ): """ :param type: `error` :type type: Optional[ClientErrorTypeField], optional @@ -427,8 +559,14 @@ def __init__(self, type: Optional[ClientErrorTypeField] = None, status: Optional self.help_url = help_url self.request_id = request_id + class OAuth2Error(BaseObject): - def __init__(self, error: Optional[str] = None, error_description: Optional[str] = None, **kwargs): + def __init__( + self, + error: Optional[str] = None, + error_description: Optional[str] = None, + **kwargs + ): """ :param error: The type of the error returned. :type error: Optional[str], optional @@ -439,13 +577,47 @@ def __init__(self, error: Optional[str] = None, error_description: Optional[str] self.error = error self.error_description = error_description + class ClassificationTemplateField(str, Enum): SECURITYCLASSIFICATION_6VMVOCHWUWO = 'securityClassification-6VMVochwUWo' + class Classification(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'box_security_classification_key': 'Box__Security__Classification__Key', 'parent': '$parent', 'template': '$template', 'scope': '$scope', 'version': '$version', 'type': '$type', 'type_version': '$typeVersion', 'can_edit': '$canEdit', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'Box__Security__Classification__Key': 'box_security_classification_key', '$parent': 'parent', '$template': 'template', '$scope': 'scope', '$version': 'version', '$type': 'type', '$typeVersion': 'type_version', '$canEdit': 'can_edit', **BaseObject._json_to_fields_mapping} - def __init__(self, box_security_classification_key: Optional[str] = None, parent: Optional[str] = None, template: Optional[ClassificationTemplateField] = None, scope: Optional[str] = None, version: Optional[int] = None, type: Optional[str] = None, type_version: Optional[int] = None, can_edit: Optional[bool] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'box_security_classification_key': 'Box__Security__Classification__Key', + 'parent': '$parent', + 'template': '$template', + 'scope': '$scope', + 'version': '$version', + 'type': '$type', + 'type_version': '$typeVersion', + 'can_edit': '$canEdit', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'Box__Security__Classification__Key': 'box_security_classification_key', + '$parent': 'parent', + '$template': 'template', + '$scope': 'scope', + '$version': 'version', + '$type': 'type', + '$typeVersion': 'type_version', + '$canEdit': 'can_edit', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + box_security_classification_key: Optional[str] = None, + parent: Optional[str] = None, + template: Optional[ClassificationTemplateField] = None, + scope: Optional[str] = None, + version: Optional[int] = None, + type: Optional[str] = None, + type_version: Optional[int] = None, + can_edit: Optional[bool] = None, + **kwargs + ): """ :param box_security_classification_key: The name of the classification applied to the item. :type box_security_classification_key: Optional[str], optional @@ -482,28 +654,51 @@ def __init__(self, box_security_classification_key: Optional[str] = None, parent self.type_version = type_version self.can_edit = can_edit + class ClassificationTemplateTypeField(str, Enum): METADATA_TEMPLATE = 'metadata_template' + class ClassificationTemplateTemplateKeyField(str, Enum): SECURITYCLASSIFICATION_6VMVOCHWUWO = 'securityClassification-6VMVochwUWo' + class ClassificationTemplateDisplayNameField(str, Enum): CLASSIFICATION = 'Classification' + class ClassificationTemplateFieldsFieldTypeField(str, Enum): ENUM = 'enum' + class ClassificationTemplateFieldsFieldKeyField(str, Enum): BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key' + class ClassificationTemplateFieldsFieldDisplayNameField(str, Enum): CLASSIFICATION = 'Classification' -class ClassificationTemplateFieldsFieldOptionsFieldStaticConfigFieldClassificationField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'classification_definition': 'classificationDefinition', 'color_id': 'colorID', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'classificationDefinition': 'classification_definition', 'colorID': 'color_id', **BaseObject._json_to_fields_mapping} - def __init__(self, classification_definition: Optional[str] = None, color_id: Optional[int] = None, **kwargs): + +class ClassificationTemplateFieldsFieldOptionsFieldStaticConfigFieldClassificationField( + BaseObject +): + _fields_to_json_mapping: Dict[str, str] = { + 'classification_definition': 'classificationDefinition', + 'color_id': 'colorID', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'classificationDefinition': 'classification_definition', + 'colorID': 'color_id', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + classification_definition: Optional[str] = None, + color_id: Optional[int] = None, + **kwargs + ): """ :param classification_definition: A longer description of the classification. :type classification_definition: Optional[str], optional @@ -526,8 +721,15 @@ def __init__(self, classification_definition: Optional[str] = None, color_id: Op self.classification_definition = classification_definition self.color_id = color_id + class ClassificationTemplateFieldsFieldOptionsFieldStaticConfigField(BaseObject): - def __init__(self, classification: Optional[ClassificationTemplateFieldsFieldOptionsFieldStaticConfigFieldClassificationField] = None, **kwargs): + def __init__( + self, + classification: Optional[ + ClassificationTemplateFieldsFieldOptionsFieldStaticConfigFieldClassificationField + ] = None, + **kwargs + ): """ :param classification: Additional information about the classification. This is not an exclusive list of properties, and @@ -540,10 +742,26 @@ def __init__(self, classification: Optional[ClassificationTemplateFieldsFieldOpt super().__init__(**kwargs) self.classification = classification + class ClassificationTemplateFieldsFieldOptionsField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'static_config': 'staticConfig', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'staticConfig': 'static_config', **BaseObject._json_to_fields_mapping} - def __init__(self, id: Optional[str] = None, key: Optional[str] = None, static_config: Optional[ClassificationTemplateFieldsFieldOptionsFieldStaticConfigField] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'static_config': 'staticConfig', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'staticConfig': 'static_config', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + id: Optional[str] = None, + key: Optional[str] = None, + static_config: Optional[ + ClassificationTemplateFieldsFieldOptionsFieldStaticConfigField + ] = None, + **kwargs + ): """ :param id: The unique ID of this classification. :type id: Optional[str], optional @@ -557,10 +775,29 @@ def __init__(self, id: Optional[str] = None, key: Optional[str] = None, static_c self.key = key self.static_config = static_config + class ClassificationTemplateFieldsField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'display_name': 'displayName', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'displayName': 'display_name', **BaseObject._json_to_fields_mapping} - def __init__(self, id: Optional[str] = None, type: Optional[ClassificationTemplateFieldsFieldTypeField] = None, key: Optional[ClassificationTemplateFieldsFieldKeyField] = None, display_name: Optional[ClassificationTemplateFieldsFieldDisplayNameField] = None, hidden: Optional[bool] = None, options: Optional[List[ClassificationTemplateFieldsFieldOptionsField]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'display_name': 'displayName', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'displayName': 'display_name', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + id: Optional[str] = None, + type: Optional[ClassificationTemplateFieldsFieldTypeField] = None, + key: Optional[ClassificationTemplateFieldsFieldKeyField] = None, + display_name: Optional[ + ClassificationTemplateFieldsFieldDisplayNameField + ] = None, + hidden: Optional[bool] = None, + options: Optional[List[ClassificationTemplateFieldsFieldOptionsField]] = None, + **kwargs + ): """ :param id: The unique ID of the field. :type id: Optional[str], optional @@ -583,10 +820,33 @@ def __init__(self, id: Optional[str] = None, type: Optional[ClassificationTempla self.hidden = hidden self.options = options + class ClassificationTemplate(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'template_key': 'templateKey', 'display_name': 'displayName', 'copy_instance_on_item_copy': 'copyInstanceOnItemCopy', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'templateKey': 'template_key', 'displayName': 'display_name', 'copyInstanceOnItemCopy': 'copy_instance_on_item_copy', **BaseObject._json_to_fields_mapping} - def __init__(self, type: ClassificationTemplateTypeField, id: Optional[str] = None, scope: Optional[str] = None, template_key: Optional[ClassificationTemplateTemplateKeyField] = None, display_name: Optional[ClassificationTemplateDisplayNameField] = None, hidden: Optional[bool] = None, copy_instance_on_item_copy: Optional[bool] = None, fields: Optional[List[ClassificationTemplateFieldsField]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'template_key': 'templateKey', + 'display_name': 'displayName', + 'copy_instance_on_item_copy': 'copyInstanceOnItemCopy', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'templateKey': 'template_key', + 'displayName': 'display_name', + 'copyInstanceOnItemCopy': 'copy_instance_on_item_copy', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + type: ClassificationTemplateTypeField, + id: Optional[str] = None, + scope: Optional[str] = None, + template_key: Optional[ClassificationTemplateTemplateKeyField] = None, + display_name: Optional[ClassificationTemplateDisplayNameField] = None, + hidden: Optional[bool] = None, + copy_instance_on_item_copy: Optional[bool] = None, + fields: Optional[List[ClassificationTemplateFieldsField]] = None, + **kwargs + ): """ :param type: `metadata_template` :type type: ClassificationTemplateTypeField @@ -619,19 +879,29 @@ def __init__(self, type: ClassificationTemplateTypeField, id: Optional[str] = No self.copy_instance_on_item_copy = copy_instance_on_item_copy self.fields = fields + class CollaborationAllowlistEntryTypeField(str, Enum): COLLABORATION_WHITELIST_ENTRY = 'collaboration_whitelist_entry' + class CollaborationAllowlistEntryDirectionField(str, Enum): INBOUND = 'inbound' OUTBOUND = 'outbound' BOTH = 'both' + class CollaborationAllowlistEntryEnterpriseFieldTypeField(str, Enum): ENTERPRISE = 'enterprise' + class CollaborationAllowlistEntryEnterpriseField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowlistEntryEnterpriseFieldTypeField] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CollaborationAllowlistEntryEnterpriseFieldTypeField] = None, + name: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this enterprise. :type id: Optional[str], optional @@ -645,8 +915,18 @@ def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowli self.type = type self.name = name + class CollaborationAllowlistEntry(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowlistEntryTypeField] = None, domain: Optional[str] = None, direction: Optional[CollaborationAllowlistEntryDirectionField] = None, enterprise: Optional[CollaborationAllowlistEntryEnterpriseField] = None, created_at: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CollaborationAllowlistEntryTypeField] = None, + domain: Optional[str] = None, + direction: Optional[CollaborationAllowlistEntryDirectionField] = None, + enterprise: Optional[CollaborationAllowlistEntryEnterpriseField] = None, + created_at: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this entry :type id: Optional[str], optional @@ -667,8 +947,16 @@ def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowli self.enterprise = enterprise self.created_at = created_at + class CollaborationAllowlistEntries(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[CollaborationAllowlistEntry]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[CollaborationAllowlistEntry]] = 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 @@ -687,14 +975,25 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class CollaborationAllowlistExemptTargetTypeField(str, Enum): COLLABORATION_WHITELIST = 'collaboration_whitelist' + class CollaborationAllowlistExemptTargetEnterpriseFieldTypeField(str, Enum): ENTERPRISE = 'enterprise' + class CollaborationAllowlistExemptTargetEnterpriseField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowlistExemptTargetEnterpriseFieldTypeField] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ + CollaborationAllowlistExemptTargetEnterpriseFieldTypeField + ] = None, + name: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this enterprise. :type id: Optional[str], optional @@ -708,11 +1007,19 @@ def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowli self.type = type self.name = name + class CollaborationAllowlistExemptTargetUserFieldTypeField(str, Enum): ENTERPRISE = 'enterprise' + class CollaborationAllowlistExemptTargetUserField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowlistExemptTargetUserFieldTypeField] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CollaborationAllowlistExemptTargetUserFieldTypeField] = None, + name: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this enterprise. :type id: Optional[str], optional @@ -726,8 +1033,18 @@ def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowli self.type = type self.name = name + class CollaborationAllowlistExemptTarget(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowlistExemptTargetTypeField] = None, enterprise: Optional[CollaborationAllowlistExemptTargetEnterpriseField] = None, user: Optional[CollaborationAllowlistExemptTargetUserField] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CollaborationAllowlistExemptTargetTypeField] = None, + enterprise: Optional[CollaborationAllowlistExemptTargetEnterpriseField] = None, + user: Optional[CollaborationAllowlistExemptTargetUserField] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this exemption :type id: Optional[str], optional @@ -746,8 +1063,16 @@ def __init__(self, id: Optional[str] = None, type: Optional[CollaborationAllowli self.created_at = created_at self.modified_at = modified_at + class CollaborationAllowlistExemptTargets(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[CollaborationAllowlistExemptTarget]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[CollaborationAllowlistExemptTarget]] = 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 @@ -768,17 +1093,28 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class CollectionTypeField(str, Enum): COLLECTION = 'collection' + class CollectionNameField(str, Enum): FAVORITES = 'Favorites' + class CollectionCollectionTypeField(str, Enum): FAVORITES = 'favorites' + class Collection(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CollectionTypeField] = None, name: Optional[CollectionNameField] = None, collection_type: Optional[CollectionCollectionTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CollectionTypeField] = None, + name: Optional[CollectionNameField] = None, + collection_type: Optional[CollectionCollectionTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this collection. :type id: Optional[str], optional @@ -797,12 +1133,19 @@ def __init__(self, id: Optional[str] = None, type: Optional[CollectionTypeField] self.name = name self.collection_type = collection_type + class CollectionsOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class CollectionsOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[CollectionsOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[CollectionsOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -813,8 +1156,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[CollectionsOrde self.by = by self.direction = direction + class Collections(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[CollectionsOrderField]] = None, entries: Optional[List[Collection]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[CollectionsOrderField]] = None, + entries: Optional[List[Collection]] = None, + **kwargs + ): """ :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 @@ -845,11 +1197,18 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries + class CommentBaseTypeField(str, Enum): COMMENT = 'comment' + class CommentBase(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CommentBaseTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CommentBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this comment. :type id: Optional[str], optional @@ -860,11 +1219,20 @@ def __init__(self, id: Optional[str] = None, type: Optional[CommentBaseTypeField self.id = id self.type = type + class EmailAliasTypeField(str, Enum): EMAIL_ALIAS = 'email_alias' + class EmailAlias(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[EmailAliasTypeField] = None, email: Optional[str] = None, is_confirmed: Optional[bool] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[EmailAliasTypeField] = None, + email: Optional[str] = None, + is_confirmed: Optional[bool] = None, + **kwargs + ): """ :param id: The unique identifier for this object :type id: Optional[str], optional @@ -881,8 +1249,14 @@ def __init__(self, id: Optional[str] = None, type: Optional[EmailAliasTypeField] self.email = email self.is_confirmed = is_confirmed + class EmailAliases(BaseObject): - def __init__(self, total_count: Optional[int] = None, entries: Optional[List[EmailAlias]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + entries: Optional[List[EmailAlias]] = None, + **kwargs + ): """ :param total_count: The number of email aliases. :type total_count: Optional[int], optional @@ -893,11 +1267,18 @@ def __init__(self, total_count: Optional[int] = None, entries: Optional[List[Ema self.total_count = total_count self.entries = entries + class EnterpriseBaseTypeField(str, Enum): ENTERPRISE = 'enterprise' + class EnterpriseBase(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[EnterpriseBaseTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[EnterpriseBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this enterprise :type id: Optional[str], optional @@ -908,11 +1289,15 @@ def __init__(self, id: Optional[str] = None, type: Optional[EnterpriseBaseTypeFi self.id = id self.type = type + class FileBaseTypeField(str, Enum): FILE = 'file' + class FileBase(BaseObject): - def __init__(self, id: str, type: FileBaseTypeField, etag: Optional[str] = None, **kwargs): + def __init__( + self, id: str, type: FileBaseTypeField, etag: Optional[str] = None, **kwargs + ): """ :param id: The unique identifier that represent a file. The ID for any file can be determined @@ -933,9 +1318,11 @@ def __init__(self, id: str, type: FileBaseTypeField, etag: Optional[str] = None, self.type = type self.etag = etag + class FileVersionBaseTypeField(str, Enum): FILE_VERSION = 'file_version' + class FileVersionBase(BaseObject): def __init__(self, id: str, type: FileVersionBaseTypeField, **kwargs): """ @@ -948,10 +1335,24 @@ def __init__(self, id: str, type: FileVersionBaseTypeField, **kwargs): self.id = id self.type = type + class FileVersionMini(FileVersionBase): - _fields_to_json_mapping: Dict[str, str] = {'sha_1': 'sha1', **FileVersionBase._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'sha1': 'sha_1', **FileVersionBase._json_to_fields_mapping} - def __init__(self, id: str, type: FileVersionBaseTypeField, sha_1: Optional[str] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'sha_1': 'sha1', + **FileVersionBase._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'sha1': 'sha_1', + **FileVersionBase._json_to_fields_mapping, + } + + def __init__( + self, + id: str, + type: FileVersionBaseTypeField, + sha_1: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file version. :type id: str @@ -963,10 +1364,28 @@ def __init__(self, id: str, type: FileVersionBaseTypeField, sha_1: Optional[str] super().__init__(id=id, type=type, **kwargs) self.sha_1 = sha_1 + class FileMini(FileBase): - _fields_to_json_mapping: Dict[str, str] = {'sha_1': 'sha1', **FileBase._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'sha1': 'sha_1', **FileBase._json_to_fields_mapping} - def __init__(self, id: str, type: FileBaseTypeField, sequence_id: Optional[str] = None, name: Optional[str] = None, sha_1: Optional[str] = None, file_version: Optional[FileVersionMini] = None, etag: Optional[str] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'sha_1': 'sha1', + **FileBase._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'sha1': 'sha_1', + **FileBase._json_to_fields_mapping, + } + + def __init__( + self, + id: str, + type: FileBaseTypeField, + sequence_id: Optional[str] = None, + name: Optional[str] = None, + sha_1: Optional[str] = None, + file_version: Optional[FileVersionMini] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file. The ID for any file can be determined @@ -993,6 +1412,7 @@ def __init__(self, id: str, type: FileBaseTypeField, sequence_id: Optional[str] self.sha_1 = sha_1 self.file_version = file_version + class FileScopeScopeField(str, Enum): ANNOTATION_EDIT = 'annotation_edit' ANNOTATION_VIEW_ALL = 'annotation_view_all' @@ -1007,8 +1427,14 @@ class FileScopeScopeField(str, Enum): ITEM_RENAME = 'item_rename' ITEM_SHARE = 'item_share' + class FileScope(BaseObject): - def __init__(self, scope: Optional[FileScopeScopeField] = None, object: Optional[FileMini] = None, **kwargs): + def __init__( + self, + scope: Optional[FileScopeScopeField] = None, + object: Optional[FileMini] = None, + **kwargs + ): """ :param scope: The file scopes for the file access :type scope: Optional[FileScopeScopeField], optional @@ -1017,14 +1443,28 @@ def __init__(self, scope: Optional[FileScopeScopeField] = None, object: Optional self.scope = scope self.object = object + class AccessTokenTokenTypeField(str, Enum): BEARER = 'bearer' + class AccessTokenIssuedTokenTypeField(str, Enum): - URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN = 'urn:ietf:params:oauth:token-type:access_token' + URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN = ( + 'urn:ietf:params:oauth:token-type:access_token' + ) + class AccessToken(BaseObject): - def __init__(self, access_token: Optional[str] = None, expires_in: Optional[int] = None, token_type: Optional[AccessTokenTokenTypeField] = None, restricted_to: Optional[List[FileScope]] = None, refresh_token: Optional[str] = None, issued_token_type: Optional[AccessTokenIssuedTokenTypeField] = None, **kwargs): + def __init__( + self, + access_token: Optional[str] = None, + expires_in: Optional[int] = None, + token_type: Optional[AccessTokenTokenTypeField] = None, + restricted_to: Optional[List[FileScope]] = None, + refresh_token: Optional[str] = None, + issued_token_type: Optional[AccessTokenIssuedTokenTypeField] = None, + **kwargs + ): """ :param access_token: The requested access token. :type access_token: Optional[str], optional @@ -1051,8 +1491,16 @@ def __init__(self, access_token: Optional[str] = None, expires_in: Optional[int] self.refresh_token = refresh_token self.issued_token_type = issued_token_type + class FilesUnderRetention(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[FileMini]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = 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 @@ -1071,8 +1519,19 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class FileConflict(FileMini): - def __init__(self, id: str, type: FileBaseTypeField, sequence_id: Optional[str] = None, name: Optional[str] = None, sha_1: Optional[str] = None, file_version: Optional[FileVersionMini] = None, etag: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: FileBaseTypeField, + sequence_id: Optional[str] = None, + name: Optional[str] = None, + sha_1: Optional[str] = None, + file_version: Optional[FileVersionMini] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file. The ID for any file can be determined @@ -1093,7 +1552,17 @@ def __init__(self, id: str, type: FileBaseTypeField, sequence_id: Optional[str] perform changes on the file if (no) changes have happened. :type etag: Optional[str], optional """ - super().__init__(id=id, type=type, sequence_id=sequence_id, name=name, sha_1=sha_1, file_version=file_version, etag=etag, **kwargs) + super().__init__( + id=id, + type=type, + sequence_id=sequence_id, + name=name, + sha_1=sha_1, + file_version=file_version, + etag=etag, + **kwargs + ) + class ConflictErrorContextInfoField(BaseObject): def __init__(self, conflicts: Optional[List[FileConflict]] = None, **kwargs): @@ -1104,8 +1573,19 @@ def __init__(self, conflicts: Optional[List[FileConflict]] = None, **kwargs): super().__init__(**kwargs) self.conflicts = conflicts + class ConflictError(ClientError): - def __init__(self, type: Optional[ClientErrorTypeField] = None, status: Optional[int] = None, code: Optional[ClientErrorCodeField] = None, message: Optional[str] = None, context_info: Optional[ClientErrorContextInfoField] = None, help_url: Optional[str] = None, request_id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[ClientErrorTypeField] = None, + status: Optional[int] = None, + code: Optional[ClientErrorCodeField] = None, + message: Optional[str] = None, + context_info: Optional[ClientErrorContextInfoField] = None, + help_url: Optional[str] = None, + request_id: Optional[str] = None, + **kwargs + ): """ :param type: `error` :type type: Optional[ClientErrorTypeField], optional @@ -1125,13 +1605,26 @@ def __init__(self, type: Optional[ClientErrorTypeField] = None, status: Optional when contacting Box support. :type request_id: Optional[str], optional """ - super().__init__(type=type, status=status, code=code, message=message, context_info=context_info, help_url=help_url, request_id=request_id, **kwargs) + super().__init__( + type=type, + status=status, + code=code, + message=message, + context_info=context_info, + help_url=help_url, + request_id=request_id, + **kwargs + ) + class FolderBaseTypeField(str, Enum): FOLDER = 'folder' + class FolderBase(BaseObject): - def __init__(self, id: str, type: FolderBaseTypeField, etag: Optional[str] = None, **kwargs): + def __init__( + self, id: str, type: FolderBaseTypeField, etag: Optional[str] = None, **kwargs + ): """ :param id: The unique identifier that represent a folder. The ID for any folder can be determined @@ -1152,8 +1645,17 @@ def __init__(self, id: str, type: FolderBaseTypeField, etag: Optional[str] = Non self.type = type self.etag = etag + class FolderMini(FolderBase): - def __init__(self, id: str, type: FolderBaseTypeField, name: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: FolderBaseTypeField, + name: Optional[str] = None, + sequence_id: Optional[str] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a folder. The ID for any folder can be determined @@ -1187,11 +1689,18 @@ def __init__(self, id: str, type: FolderBaseTypeField, name: Optional[str] = Non self.name = name self.sequence_id = sequence_id + class IntegrationMappingBaseIntegrationTypeField(str, Enum): SLACK = 'slack' + class IntegrationMappingBase(BaseObject): - def __init__(self, id: Optional[str] = None, integration_type: Optional[IntegrationMappingBaseIntegrationTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + integration_type: Optional[IntegrationMappingBaseIntegrationTypeField] = None, + **kwargs + ): """ :param id: A unique identifier of a folder mapping (part of a composite key together @@ -1207,14 +1716,26 @@ def __init__(self, id: Optional[str] = None, integration_type: Optional[Integrat self.id = id self.integration_type = integration_type + class IntegrationMappingMiniPartnerItemTypeField(str, Enum): CHANNEL = 'channel' + class IntegrationMappingMiniBoxItemTypeField(str, Enum): FOLDER = 'folder' + class IntegrationMappingMini(IntegrationMappingBase): - def __init__(self, partner_item_id: Optional[str] = None, partner_item_type: Optional[IntegrationMappingMiniPartnerItemTypeField] = None, box_item_id: Optional[str] = None, box_item_type: Optional[IntegrationMappingMiniBoxItemTypeField] = None, id: Optional[str] = None, integration_type: Optional[IntegrationMappingBaseIntegrationTypeField] = None, **kwargs): + def __init__( + self, + partner_item_id: Optional[str] = None, + partner_item_type: Optional[IntegrationMappingMiniPartnerItemTypeField] = None, + box_item_id: Optional[str] = None, + box_item_type: Optional[IntegrationMappingMiniBoxItemTypeField] = None, + id: Optional[str] = None, + integration_type: Optional[IntegrationMappingBaseIntegrationTypeField] = None, + **kwargs + ): """ :param partner_item_id: ID of the mapped partner item :type partner_item_id: Optional[str], optional @@ -1240,11 +1761,18 @@ def __init__(self, partner_item_id: Optional[str] = None, partner_item_type: Opt self.box_item_id = box_item_id self.box_item_type = box_item_type + class GroupBaseTypeField(str, Enum): GROUP = 'group' + class GroupBase(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[GroupBaseTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[GroupBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this object :type id: Optional[str], optional @@ -1255,12 +1783,21 @@ def __init__(self, id: Optional[str] = None, type: Optional[GroupBaseTypeField] self.id = id self.type = type + class GroupMiniGroupTypeField(str, Enum): MANAGED_GROUP = 'managed_group' ALL_USERS_GROUP = 'all_users_group' + class GroupMini(GroupBase): - def __init__(self, name: Optional[str] = None, group_type: Optional[GroupMiniGroupTypeField] = None, id: Optional[str] = None, type: Optional[GroupBaseTypeField] = None, **kwargs): + def __init__( + self, + name: Optional[str] = None, + group_type: Optional[GroupMiniGroupTypeField] = None, + id: Optional[str] = None, + type: Optional[GroupBaseTypeField] = None, + **kwargs + ): """ :param name: The name of the group :type name: Optional[str], optional @@ -1275,12 +1812,19 @@ def __init__(self, name: Optional[str] = None, group_type: Optional[GroupMiniGro self.name = name self.group_type = group_type + class GroupsOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class GroupsOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[GroupsOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[GroupsOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -1291,8 +1835,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[GroupsOrderFiel self.by = by self.direction = direction + class Groups(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[GroupsOrderField]] = None, entries: Optional[List[GroupMini]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[GroupsOrderField]] = None, + entries: Optional[List[GroupMini]] = None, + **kwargs + ): """ :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 @@ -1323,8 +1876,18 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries + class Group(GroupMini): - def __init__(self, created_at: Optional[str] = None, modified_at: Optional[str] = None, name: Optional[str] = None, group_type: Optional[GroupMiniGroupTypeField] = None, id: Optional[str] = None, type: Optional[GroupBaseTypeField] = None, **kwargs): + def __init__( + self, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + name: Optional[str] = None, + group_type: Optional[GroupMiniGroupTypeField] = None, + id: Optional[str] = None, + type: Optional[GroupBaseTypeField] = None, + **kwargs + ): """ :param created_at: When the group object was created :type created_at: Optional[str], optional @@ -1343,16 +1906,19 @@ def __init__(self, created_at: Optional[str] = None, modified_at: Optional[str] self.created_at = created_at self.modified_at = modified_at + class GroupFullInvitabilityLevelField(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' + class GroupFullMemberViewabilityLevelField(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' + class GroupFullPermissionsField(BaseObject): def __init__(self, can_invite_as_collaborator: Optional[bool] = None, **kwargs): """ @@ -1362,8 +1928,24 @@ def __init__(self, can_invite_as_collaborator: Optional[bool] = None, **kwargs): super().__init__(**kwargs) self.can_invite_as_collaborator = can_invite_as_collaborator + class GroupFull(Group): - def __init__(self, provenance: Optional[str] = None, external_sync_identifier: Optional[str] = None, description: Optional[str] = None, invitability_level: Optional[GroupFullInvitabilityLevelField] = None, member_viewability_level: Optional[GroupFullMemberViewabilityLevelField] = None, permissions: Optional[GroupFullPermissionsField] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, name: Optional[str] = None, group_type: Optional[GroupMiniGroupTypeField] = None, id: Optional[str] = None, type: Optional[GroupBaseTypeField] = None, **kwargs): + def __init__( + self, + provenance: Optional[str] = None, + external_sync_identifier: Optional[str] = None, + description: Optional[str] = None, + invitability_level: Optional[GroupFullInvitabilityLevelField] = None, + member_viewability_level: Optional[GroupFullMemberViewabilityLevelField] = None, + permissions: Optional[GroupFullPermissionsField] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + name: Optional[str] = None, + group_type: Optional[GroupMiniGroupTypeField] = None, + id: Optional[str] = None, + type: Optional[GroupBaseTypeField] = None, + **kwargs + ): """ :param provenance: Keeps track of which external source this group is coming from (e.g. "Active Directory", "Google Groups", @@ -1412,7 +1994,15 @@ def __init__(self, provenance: Optional[str] = None, external_sync_identifier: O :param type: `group` :type type: Optional[GroupBaseTypeField], optional """ - super().__init__(created_at=created_at, modified_at=modified_at, name=name, group_type=group_type, id=id, type=type, **kwargs) + super().__init__( + created_at=created_at, + modified_at=modified_at, + name=name, + group_type=group_type, + id=id, + type=type, + **kwargs + ) self.provenance = provenance self.external_sync_identifier = external_sync_identifier self.description = description @@ -1420,11 +2010,18 @@ def __init__(self, provenance: Optional[str] = None, external_sync_identifier: O self.member_viewability_level = member_viewability_level self.permissions = permissions + class LegalHoldPolicyMiniTypeField(str, Enum): LEGAL_HOLD_POLICY = 'legal_hold_policy' + class LegalHoldPolicyMini(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[LegalHoldPolicyMiniTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[LegalHoldPolicyMiniTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this legal hold policy :type id: Optional[str], optional @@ -1435,11 +2032,18 @@ def __init__(self, id: Optional[str] = None, type: Optional[LegalHoldPolicyMiniT self.id = id self.type = type + class LegalHoldPolicyAssignmentBaseTypeField(str, Enum): LEGAL_HOLD_POLICY_ASSIGNMENT = 'legal_hold_policy_assignment' + class LegalHoldPolicyAssignmentBase(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[LegalHoldPolicyAssignmentBaseTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[LegalHoldPolicyAssignmentBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this legal hold assignment :type id: Optional[str], optional @@ -1450,8 +2054,16 @@ def __init__(self, id: Optional[str] = None, type: Optional[LegalHoldPolicyAssig self.id = id self.type = type + class LegalHoldPolicyAssignments(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[LegalHoldPolicyAssignmentBase]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[LegalHoldPolicyAssignmentBase]] = 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 @@ -1471,10 +2083,31 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class MetadataBase(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'parent': '$parent', 'template': '$template', 'scope': '$scope', 'version': '$version', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'$parent': 'parent', '$template': 'template', '$scope': 'scope', '$version': 'version', **BaseObject._json_to_fields_mapping} - def __init__(self, parent: Optional[str] = None, template: Optional[str] = None, scope: Optional[str] = None, version: Optional[int] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'parent': '$parent', + 'template': '$template', + 'scope': '$scope', + 'version': '$version', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + '$parent': 'parent', + '$template': 'template', + '$scope': 'scope', + '$version': 'version', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + parent: Optional[str] = None, + template: Optional[str] = None, + scope: Optional[str] = None, + version: Optional[int] = None, + **kwargs + ): """ :param parent: The identifier of the item that this metadata instance has been attached to. This combines the `type` and the `id` @@ -1497,8 +2130,16 @@ def __init__(self, parent: Optional[str] = None, template: Optional[str] = None, self.scope = scope self.version = version + class Metadata(MetadataBase): - def __init__(self, parent: Optional[str] = None, template: Optional[str] = None, scope: Optional[str] = None, version: Optional[int] = None, **kwargs): + def __init__( + self, + parent: Optional[str] = None, + template: Optional[str] = None, + scope: Optional[str] = None, + version: Optional[int] = None, + **kwargs + ): """ :param parent: The identifier of the item that this metadata instance has been attached to. This combines the `type` and the `id` @@ -1515,10 +2156,18 @@ def __init__(self, parent: Optional[str] = None, template: Optional[str] = None, increases every time a user-defined property is modified. :type version: Optional[int], optional """ - super().__init__(parent=parent, template=template, scope=scope, version=version, **kwargs) + super().__init__( + parent=parent, template=template, scope=scope, version=version, **kwargs + ) + class Metadatas(BaseObject): - def __init__(self, entries: Optional[List[Metadata]] = None, limit: Optional[int] = None, **kwargs): + def __init__( + self, + entries: Optional[List[Metadata]] = None, + limit: Optional[int] = None, + **kwargs + ): """ :param entries: A list of metadata instances, as applied to this file or folder. :type entries: Optional[List[Metadata]], optional @@ -1529,10 +2178,38 @@ def __init__(self, entries: Optional[List[Metadata]] = None, limit: Optional[int self.entries = entries self.limit = limit + class MetadataFull(Metadata): - _fields_to_json_mapping: Dict[str, str] = {'can_edit': '$canEdit', 'id': '$id', 'type': '$type', 'type_version': '$typeVersion', 'extra_data': 'extraData', **Metadata._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'$canEdit': 'can_edit', '$id': 'id', '$type': 'type', '$typeVersion': 'type_version', 'extraData': 'extra_data', **Metadata._json_to_fields_mapping} - def __init__(self, can_edit: Optional[bool] = None, id: Optional[str] = None, type: Optional[str] = None, type_version: Optional[int] = None, extra_data: Optional[Dict[str, str]] = None, parent: Optional[str] = None, template: Optional[str] = None, scope: Optional[str] = None, version: Optional[int] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'can_edit': '$canEdit', + 'id': '$id', + 'type': '$type', + 'type_version': '$typeVersion', + 'extra_data': 'extraData', + **Metadata._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + '$canEdit': 'can_edit', + '$id': 'id', + '$type': 'type', + '$typeVersion': 'type_version', + 'extraData': 'extra_data', + **Metadata._json_to_fields_mapping, + } + + def __init__( + self, + can_edit: Optional[bool] = None, + id: Optional[str] = None, + type: Optional[str] = None, + type_version: Optional[int] = None, + extra_data: Optional[Dict[str, str]] = None, + parent: Optional[str] = None, + template: Optional[str] = None, + scope: Optional[str] = None, + version: Optional[int] = None, + **kwargs + ): """ :param can_edit: Whether the user can edit this metadata instance. :type can_edit: Optional[bool], optional @@ -1561,21 +2238,31 @@ def __init__(self, can_edit: Optional[bool] = None, id: Optional[str] = None, ty increases every time a user-defined property is modified. :type version: Optional[int], optional """ - super().__init__(parent=parent, template=template, scope=scope, version=version, **kwargs) + super().__init__( + parent=parent, template=template, scope=scope, version=version, **kwargs + ) self.can_edit = can_edit self.id = id self.type = type self.type_version = type_version self.extra_data = extra_data + class MetadataCascadePolicyTypeField(str, Enum): METADATA_CASCADE_POLICY = 'metadata_cascade_policy' + class MetadataCascadePolicyOwnerEnterpriseFieldTypeField(str, Enum): ENTERPRISE = 'enterprise' + class MetadataCascadePolicyOwnerEnterpriseField(BaseObject): - def __init__(self, type: Optional[MetadataCascadePolicyOwnerEnterpriseFieldTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[MetadataCascadePolicyOwnerEnterpriseFieldTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `enterprise` :type type: Optional[MetadataCascadePolicyOwnerEnterpriseFieldTypeField], optional @@ -1586,11 +2273,18 @@ def __init__(self, type: Optional[MetadataCascadePolicyOwnerEnterpriseFieldTypeF self.type = type self.id = id + class MetadataCascadePolicyParentFieldTypeField(str, Enum): FOLDER = 'folder' + class MetadataCascadePolicyParentField(BaseObject): - def __init__(self, type: Optional[MetadataCascadePolicyParentFieldTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[MetadataCascadePolicyParentFieldTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `folder` :type type: Optional[MetadataCascadePolicyParentFieldTypeField], optional @@ -1601,14 +2295,32 @@ def __init__(self, type: Optional[MetadataCascadePolicyParentFieldTypeField] = N self.type = type self.id = id + class MetadataCascadePolicyScopeField(str, Enum): GLOBAL = 'global' ENTERPRISE__ = 'enterprise_*' + class MetadataCascadePolicy(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'template_key': 'templateKey', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'templateKey': 'template_key', **BaseObject._json_to_fields_mapping} - def __init__(self, id: Optional[str] = None, type: Optional[MetadataCascadePolicyTypeField] = None, owner_enterprise: Optional[MetadataCascadePolicyOwnerEnterpriseField] = None, parent: Optional[MetadataCascadePolicyParentField] = None, scope: Optional[MetadataCascadePolicyScopeField] = None, template_key: Optional[str] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'template_key': 'templateKey', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'templateKey': 'template_key', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + id: Optional[str] = None, + type: Optional[MetadataCascadePolicyTypeField] = None, + owner_enterprise: Optional[MetadataCascadePolicyOwnerEnterpriseField] = None, + parent: Optional[MetadataCascadePolicyParentField] = None, + scope: Optional[MetadataCascadePolicyScopeField] = None, + template_key: Optional[str] = None, + **kwargs + ): """ :param id: The ID of the metadata cascade policy object :type id: Optional[str], optional @@ -1643,8 +2355,16 @@ def __init__(self, id: Optional[str] = None, type: Optional[MetadataCascadePolic self.scope = scope self.template_key = template_key + class MetadataCascadePolicies(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[MetadataCascadePolicy]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[MetadataCascadePolicy]] = 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 @@ -1663,17 +2383,27 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class MetadataQueryIndexStatusField(str, Enum): BUILDING = 'building' ACTIVE = 'active' DISABLED = 'disabled' + class MetadataQueryIndexFieldsFieldSortDirectionField(str, Enum): ASC = 'asc' DESC = 'desc' + class MetadataQueryIndexFieldsField(BaseObject): - def __init__(self, key: Optional[str] = None, sort_direction: Optional[MetadataQueryIndexFieldsFieldSortDirectionField] = None, **kwargs): + def __init__( + self, + key: Optional[str] = None, + sort_direction: Optional[ + MetadataQueryIndexFieldsFieldSortDirectionField + ] = None, + **kwargs + ): """ :param key: The metadata template field key. :type key: Optional[str], optional @@ -1684,8 +2414,16 @@ def __init__(self, key: Optional[str] = None, sort_direction: Optional[MetadataQ self.key = key self.sort_direction = sort_direction + class MetadataQueryIndex(BaseObject): - def __init__(self, type: str, status: MetadataQueryIndexStatusField, id: Optional[str] = None, fields: Optional[List[MetadataQueryIndexFieldsField]] = None, **kwargs): + def __init__( + self, + type: str, + status: MetadataQueryIndexStatusField, + id: Optional[str] = None, + fields: Optional[List[MetadataQueryIndexFieldsField]] = None, + **kwargs + ): """ :param type: Value is always `metadata_query_index` :type type: str @@ -1702,8 +2440,15 @@ def __init__(self, type: str, status: MetadataQueryIndexStatusField, id: Optiona self.id = id self.fields = fields + class MetadataQueryIndices(BaseObject): - def __init__(self, entries: Optional[List[MetadataQueryIndex]] = None, limit: Optional[int] = None, next_marker: Optional[str] = None, **kwargs): + def __init__( + self, + entries: Optional[List[MetadataQueryIndex]] = None, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + **kwargs + ): """ :param entries: A collection of metadata query indices. :type entries: Optional[List[MetadataQueryIndex]], optional @@ -1717,9 +2462,11 @@ def __init__(self, entries: Optional[List[MetadataQueryIndex]] = None, limit: Op self.limit = limit self.next_marker = next_marker + class MetadataTemplateTypeField(str, Enum): METADATA_TEMPLATE = 'metadata_template' + class MetadataTemplateFieldsFieldTypeField(str, Enum): STRING = 'string' FLOAT = 'float' @@ -1728,6 +2475,7 @@ class MetadataTemplateFieldsFieldTypeField(str, Enum): MULTISELECT = 'multiSelect' INTEGER = 'integer' + class MetadataTemplateFieldsFieldOptionsField(BaseObject): def __init__(self, key: str, id: Optional[str] = None, **kwargs): """ @@ -1741,10 +2489,28 @@ def __init__(self, key: str, id: Optional[str] = None, **kwargs): self.key = key self.id = id + class MetadataTemplateFieldsField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'display_name': 'displayName', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'displayName': 'display_name', **BaseObject._json_to_fields_mapping} - def __init__(self, type: MetadataTemplateFieldsFieldTypeField, key: str, display_name: str, description: Optional[str] = None, hidden: Optional[bool] = None, options: Optional[List[MetadataTemplateFieldsFieldOptionsField]] = None, id: Optional[str] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'display_name': 'displayName', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'displayName': 'display_name', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + type: MetadataTemplateFieldsFieldTypeField, + key: str, + display_name: str, + description: Optional[str] = None, + hidden: Optional[bool] = None, + options: Optional[List[MetadataTemplateFieldsFieldOptionsField]] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: The type of field. The basic fields are a `string` field for text, a `float` field for numbers, and a `date` fields to present the user with a @@ -1782,10 +2548,33 @@ def __init__(self, type: MetadataTemplateFieldsFieldTypeField, key: str, display self.options = options self.id = id + class MetadataTemplate(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'template_key': 'templateKey', 'display_name': 'displayName', 'copy_instance_on_item_copy': 'copyInstanceOnItemCopy', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'templateKey': 'template_key', 'displayName': 'display_name', 'copyInstanceOnItemCopy': 'copy_instance_on_item_copy', **BaseObject._json_to_fields_mapping} - def __init__(self, type: MetadataTemplateTypeField, id: Optional[str] = None, scope: Optional[str] = None, template_key: Optional[str] = None, display_name: Optional[str] = None, hidden: Optional[bool] = None, fields: Optional[List[MetadataTemplateFieldsField]] = None, copy_instance_on_item_copy: Optional[bool] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'template_key': 'templateKey', + 'display_name': 'displayName', + 'copy_instance_on_item_copy': 'copyInstanceOnItemCopy', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'templateKey': 'template_key', + 'displayName': 'display_name', + 'copyInstanceOnItemCopy': 'copy_instance_on_item_copy', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + type: MetadataTemplateTypeField, + id: Optional[str] = None, + scope: Optional[str] = None, + template_key: Optional[str] = None, + display_name: Optional[str] = None, + hidden: Optional[bool] = None, + fields: Optional[List[MetadataTemplateFieldsField]] = None, + copy_instance_on_item_copy: Optional[bool] = None, + **kwargs + ): """ :param type: `metadata_template` :type type: MetadataTemplateTypeField @@ -1824,8 +2613,16 @@ def __init__(self, type: MetadataTemplateTypeField, id: Optional[str] = None, sc self.fields = fields self.copy_instance_on_item_copy = copy_instance_on_item_copy + class MetadataTemplates(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[MetadataTemplate]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[MetadataTemplate]] = 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 @@ -1844,8 +2641,17 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class RealtimeServer(BaseObject): - def __init__(self, type: Optional[str] = None, url: Optional[str] = None, ttl: Optional[int] = None, max_retries: Optional[int] = None, retry_timeout: Optional[int] = None, **kwargs): + def __init__( + self, + type: Optional[str] = None, + url: Optional[str] = None, + ttl: Optional[int] = None, + max_retries: Optional[int] = None, + retry_timeout: Optional[int] = None, + **kwargs + ): """ :param type: `realtime_server` :type type: Optional[str], optional @@ -1871,8 +2677,14 @@ def __init__(self, type: Optional[str] = None, url: Optional[str] = None, ttl: O self.max_retries = max_retries self.retry_timeout = retry_timeout + class RealtimeServers(BaseObject): - def __init__(self, chunk_size: Optional[int] = None, entries: Optional[List[RealtimeServer]] = None, **kwargs): + def __init__( + self, + chunk_size: Optional[int] = None, + entries: Optional[List[RealtimeServer]] = None, + **kwargs + ): """ :param chunk_size: The number of items in this response. :type chunk_size: Optional[int], optional @@ -1883,9 +2695,11 @@ def __init__(self, chunk_size: Optional[int] = None, entries: Optional[List[Real self.chunk_size = chunk_size self.entries = entries + class RetentionPolicyBaseTypeField(str, Enum): RETENTION_POLICY = 'retention_policy' + class RetentionPolicyBase(BaseObject): def __init__(self, id: str, type: RetentionPolicyBaseTypeField, **kwargs): """ @@ -1898,12 +2712,22 @@ def __init__(self, id: str, type: RetentionPolicyBaseTypeField, **kwargs): self.id = id self.type = type + class RetentionPolicyMiniDispositionActionField(str, Enum): PERMANENTLY_DELETE = 'permanently_delete' REMOVE_RETENTION = 'remove_retention' + class RetentionPolicyMini(RetentionPolicyBase): - def __init__(self, id: str, type: RetentionPolicyBaseTypeField, policy_name: Optional[str] = None, retention_length: Optional[str] = None, disposition_action: Optional[RetentionPolicyMiniDispositionActionField] = None, **kwargs): + def __init__( + self, + id: str, + type: RetentionPolicyBaseTypeField, + policy_name: Optional[str] = None, + retention_length: Optional[str] = None, + disposition_action: Optional[RetentionPolicyMiniDispositionActionField] = None, + **kwargs + ): """ :param id: The unique identifier that represents a retention policy. :type id: str @@ -1932,8 +2756,15 @@ def __init__(self, id: str, type: RetentionPolicyBaseTypeField, policy_name: Opt self.retention_length = retention_length self.disposition_action = disposition_action + class RetentionPolicies(BaseObject): - def __init__(self, entries: Optional[List[RetentionPolicyMini]] = None, limit: Optional[int] = None, next_marker: Optional[str] = None, **kwargs): + def __init__( + self, + entries: Optional[List[RetentionPolicyMini]] = None, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + **kwargs + ): """ :param entries: A list in which each entry represents a retention policy object. :type entries: Optional[List[RetentionPolicyMini]], optional @@ -1949,11 +2780,23 @@ def __init__(self, entries: Optional[List[RetentionPolicyMini]] = None, limit: O self.limit = limit self.next_marker = next_marker + class FileVersionRetentionTypeField(str, Enum): FILE_VERSION_RETENTION = 'file_version_retention' + class FileVersionRetention(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[FileVersionRetentionTypeField] = None, file_version: Optional[FileVersionMini] = None, file: Optional[FileMini] = None, applied_at: Optional[str] = None, disposition_at: Optional[str] = None, winning_retention_policy: Optional[RetentionPolicyMini] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[FileVersionRetentionTypeField] = None, + file_version: Optional[FileVersionMini] = None, + file: Optional[FileMini] = None, + applied_at: Optional[str] = None, + disposition_at: Optional[str] = None, + winning_retention_policy: Optional[RetentionPolicyMini] = None, + **kwargs + ): """ :param id: The unique identifier for this file version retention. :type id: Optional[str], optional @@ -1975,8 +2818,16 @@ def __init__(self, id: Optional[str] = None, type: Optional[FileVersionRetention self.disposition_at = disposition_at self.winning_retention_policy = winning_retention_policy + class FileVersionRetentions(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[FileVersionRetention]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[FileVersionRetention]] = 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 @@ -1995,9 +2846,11 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class RetentionPolicyAssignmentBaseTypeField(str, Enum): RETENTION_POLICY_ASSIGNMENT = 'retention_policy_assignment' + class RetentionPolicyAssignmentBase(BaseObject): def __init__(self, id: str, type: RetentionPolicyAssignmentBaseTypeField, **kwargs): """ @@ -2010,8 +2863,15 @@ def __init__(self, id: str, type: RetentionPolicyAssignmentBaseTypeField, **kwar self.id = id self.type = type + class RetentionPolicyAssignments(BaseObject): - def __init__(self, entries: Optional[List[RetentionPolicyAssignmentBase]] = None, limit: Optional[int] = None, next_marker: Optional[str] = None, **kwargs): + def __init__( + self, + entries: Optional[List[RetentionPolicyAssignmentBase]] = None, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + **kwargs + ): """ :param entries: A list of retention policy assignments :type entries: Optional[List[RetentionPolicyAssignmentBase]], optional @@ -2027,11 +2887,18 @@ def __init__(self, entries: Optional[List[RetentionPolicyAssignmentBase]] = None self.limit = limit self.next_marker = next_marker + class ShieldInformationBarrierBaseTypeField(str, Enum): SHIELD_INFORMATION_BARRIER = 'shield_information_barrier' + class ShieldInformationBarrierBase(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBarrierBaseTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ShieldInformationBarrierBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for the shield information barrier :type id: Optional[str], optional @@ -2042,16 +2909,28 @@ def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBar self.id = id self.type = type + class ShieldInformationBarrierReference(BaseObject): - def __init__(self, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, **kwargs): + def __init__( + self, + shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, + **kwargs + ): super().__init__(**kwargs) self.shield_information_barrier = shield_information_barrier + class ShieldInformationBarrierReportBaseTypeField(str, Enum): SHIELD_INFORMATION_BARRIER_REPORT = 'shield_information_barrier_report' + class ShieldInformationBarrierReportBase(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBarrierReportBaseTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ShieldInformationBarrierReportBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for the shield information barrier report :type id: Optional[str], optional @@ -2062,11 +2941,20 @@ def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBar self.id = id self.type = type + class ShieldInformationBarrierSegmentMemberBaseTypeField(str, Enum): - SHIELD_INFORMATION_BARRIER_SEGMENT_MEMBER = 'shield_information_barrier_segment_member' + SHIELD_INFORMATION_BARRIER_SEGMENT_MEMBER = ( + 'shield_information_barrier_segment_member' + ) + class ShieldInformationBarrierSegmentMemberBase(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for the shield information barrier segment member @@ -2078,11 +2966,20 @@ def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBar self.id = id self.type = type + class ShieldInformationBarrierSegmentRestrictionBaseTypeField(str, Enum): - SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION = 'shield_information_barrier_segment_restriction' + SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION = ( + 'shield_information_barrier_segment_restriction' + ) + class ShieldInformationBarrierSegmentRestrictionBase(BaseObject): - def __init__(self, type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: Shield information barrier segment restriction :type type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField], optional @@ -2094,11 +2991,24 @@ def __init__(self, type: Optional[ShieldInformationBarrierSegmentRestrictionBase self.type = type self.id = id -class ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentFieldTypeField(str, Enum): + +class ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentFieldTypeField( + str, Enum +): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' -class ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentFieldTypeField] = None, **kwargs): + +class ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField( + BaseObject +): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ + ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentFieldTypeField + ] = None, + **kwargs + ): """ :param id: The ID reference of the requesting shield information barrier segment. @@ -2110,11 +3020,22 @@ def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBar self.id = id self.type = type -class ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentFieldTypeField(str, Enum): + +class ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentFieldTypeField( + str, Enum +): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' + class ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentFieldTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ + ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentFieldTypeField + ] = None, + **kwargs + ): """ :param id: The ID reference of the restricted shield information barrier segment. @@ -2126,8 +3047,18 @@ def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBar self.id = id self.type = type -class ShieldInformationBarrierSegmentRestrictionMini(ShieldInformationBarrierSegmentRestrictionBase): - def __init__(self, shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField, restricted_segment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField, type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None, id: Optional[str] = None, **kwargs): + +class ShieldInformationBarrierSegmentRestrictionMini( + ShieldInformationBarrierSegmentRestrictionBase +): + def __init__( + self, + shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField, + restricted_segment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField, + type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param shield_information_barrier_segment: The `type` and `id` of the requested shield information barrier segment. @@ -2145,6 +3076,7 @@ def __init__(self, shield_information_barrier_segment: ShieldInformationBarrierS self.shield_information_barrier_segment = shield_information_barrier_segment self.restricted_segment = restricted_segment + class SessionTerminationMessage(BaseObject): def __init__(self, message: Optional[str] = None, **kwargs): """ @@ -2154,11 +3086,18 @@ def __init__(self, message: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.message = message + class StoragePolicyMiniTypeField(str, Enum): STORAGE_POLICY = 'storage_policy' + class StoragePolicyMini(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[StoragePolicyMiniTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[StoragePolicyMiniTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this storage policy :type id: Optional[str], optional @@ -2169,6 +3108,7 @@ def __init__(self, id: Optional[str] = None, type: Optional[StoragePolicyMiniTyp self.id = id self.type = type + class StoragePolicyAssignmentAssignedToField(BaseObject): def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwargs): """ @@ -2181,14 +3121,28 @@ def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwarg self.id = id self.type = type + class StoragePolicyAssignment(BaseObject): - def __init__(self, storage_policy: Optional[StoragePolicyMini] = None, assigned_to: Optional[StoragePolicyAssignmentAssignedToField] = None, **kwargs): + def __init__( + self, + storage_policy: Optional[StoragePolicyMini] = None, + assigned_to: Optional[StoragePolicyAssignmentAssignedToField] = None, + **kwargs + ): super().__init__(**kwargs) self.storage_policy = storage_policy self.assigned_to = assigned_to + class StoragePolicyAssignments(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[StoragePolicyAssignment]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[StoragePolicyAssignment]] = 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 @@ -2207,8 +3161,15 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class StoragePolicy(StoragePolicyMini): - def __init__(self, name: Optional[str] = None, id: Optional[str] = None, type: Optional[StoragePolicyMiniTypeField] = None, **kwargs): + def __init__( + self, + name: Optional[str] = None, + id: Optional[str] = None, + type: Optional[StoragePolicyMiniTypeField] = None, + **kwargs + ): """ :param name: A descriptive name of the region :type name: Optional[str], optional @@ -2220,8 +3181,16 @@ def __init__(self, name: Optional[str] = None, id: Optional[str] = None, type: O super().__init__(id=id, type=type, **kwargs) self.name = name + class StoragePolicies(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[StoragePolicy]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[StoragePolicy]] = 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 @@ -2240,11 +3209,18 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class TermsOfServiceBaseTypeField(str, Enum): TERMS_OF_SERVICE = 'terms_of_service' + class TermsOfServiceBase(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[TermsOfServiceBaseTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[TermsOfServiceBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this terms of service. :type id: Optional[str], optional @@ -2255,15 +3231,24 @@ def __init__(self, id: Optional[str] = None, type: Optional[TermsOfServiceBaseTy self.id = id self.type = type + class TermsOfServiceStatusField(str, Enum): ENABLED = 'enabled' DISABLED = 'disabled' + class TermsOfServiceEnterpriseFieldTypeField(str, Enum): ENTERPRISE = 'enterprise' + class TermsOfServiceEnterpriseField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[TermsOfServiceEnterpriseFieldTypeField] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[TermsOfServiceEnterpriseFieldTypeField] = None, + name: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this enterprise. :type id: Optional[str], optional @@ -2277,12 +3262,25 @@ def __init__(self, id: Optional[str] = None, type: Optional[TermsOfServiceEnterp self.type = type self.name = name + class TermsOfServiceTosTypeField(str, Enum): MANAGED = 'managed' EXTERNAL = 'external' + class TermsOfService(TermsOfServiceBase): - def __init__(self, status: Optional[TermsOfServiceStatusField] = None, enterprise: Optional[TermsOfServiceEnterpriseField] = None, tos_type: Optional[TermsOfServiceTosTypeField] = None, text: Optional[str] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, id: Optional[str] = None, type: Optional[TermsOfServiceBaseTypeField] = None, **kwargs): + def __init__( + self, + status: Optional[TermsOfServiceStatusField] = None, + enterprise: Optional[TermsOfServiceEnterpriseField] = None, + tos_type: Optional[TermsOfServiceTosTypeField] = None, + text: Optional[str] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + id: Optional[str] = None, + type: Optional[TermsOfServiceBaseTypeField] = None, + **kwargs + ): """ :param status: Whether these terms are enabled or not :type status: Optional[TermsOfServiceStatusField], optional @@ -2308,8 +3306,14 @@ def __init__(self, status: Optional[TermsOfServiceStatusField] = None, enterpris self.created_at = created_at self.modified_at = modified_at + class TermsOfServices(BaseObject): - def __init__(self, total_count: Optional[int] = None, entries: Optional[List[TermsOfService]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + entries: Optional[List[TermsOfService]] = None, + **kwargs + ): """ :param total_count: The total number of objects. :type total_count: Optional[int], optional @@ -2320,8 +3324,15 @@ def __init__(self, total_count: Optional[int] = None, entries: Optional[List[Ter self.total_count = total_count self.entries = entries + class SignTemplates(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[str] = None, prev_marker: Optional[str] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + prev_marker: Optional[str] = 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 @@ -2337,8 +3348,15 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[str] = Non self.next_marker = next_marker self.prev_marker = prev_marker + class UploadPartMini(BaseObject): - def __init__(self, part_id: Optional[str] = None, offset: Optional[int] = None, size: Optional[int] = None, **kwargs): + def __init__( + self, + part_id: Optional[str] = None, + offset: Optional[int] = None, + size: Optional[int] = None, + **kwargs + ): """ :param part_id: The unique ID of the chunk. :type part_id: Optional[str], optional @@ -2354,10 +3372,25 @@ def __init__(self, part_id: Optional[str] = None, offset: Optional[int] = None, self.offset = offset self.size = size + class UploadPart(UploadPartMini): - _fields_to_json_mapping: Dict[str, str] = {'sha_1': 'sha1', **UploadPartMini._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'sha1': 'sha_1', **UploadPartMini._json_to_fields_mapping} - def __init__(self, sha_1: Optional[str] = None, part_id: Optional[str] = None, offset: Optional[int] = None, size: Optional[int] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'sha_1': 'sha1', + **UploadPartMini._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'sha1': 'sha_1', + **UploadPartMini._json_to_fields_mapping, + } + + def __init__( + self, + sha_1: Optional[str] = None, + part_id: Optional[str] = None, + offset: Optional[int] = None, + size: Optional[int] = None, + **kwargs + ): """ :param sha_1: The SHA1 hash of the chunk. :type sha_1: Optional[str], optional @@ -2373,12 +3406,19 @@ def __init__(self, sha_1: Optional[str] = None, part_id: Optional[str] = None, o super().__init__(part_id=part_id, offset=offset, size=size, **kwargs) self.sha_1 = sha_1 + class UploadPartsOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class UploadPartsOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[UploadPartsOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[UploadPartsOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -2389,8 +3429,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[UploadPartsOrde self.by = by self.direction = direction + class UploadParts(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[UploadPartsOrderField]] = None, entries: Optional[List[UploadPart]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[UploadPartsOrderField]] = None, + entries: Optional[List[UploadPart]] = None, + **kwargs + ): """ :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 @@ -2422,16 +3471,28 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries + class UploadedPart(BaseObject): def __init__(self, part: Optional[UploadPart] = None, **kwargs): super().__init__(**kwargs) self.part = part + class UploadSessionTypeField(str, Enum): UPLOAD_SESSION = 'upload_session' + class UploadSessionSessionEndpointsField(BaseObject): - def __init__(self, upload_part: Optional[str] = None, commit: Optional[str] = None, abort: Optional[str] = None, list_parts: Optional[str] = None, status: Optional[str] = None, log_event: Optional[str] = None, **kwargs): + def __init__( + self, + upload_part: Optional[str] = None, + commit: Optional[str] = None, + abort: Optional[str] = None, + list_parts: Optional[str] = None, + status: Optional[str] = None, + log_event: Optional[str] = None, + **kwargs + ): """ :param upload_part: The URL to upload parts to :type upload_part: Optional[str], optional @@ -2454,8 +3515,19 @@ def __init__(self, upload_part: Optional[str] = None, commit: Optional[str] = No self.status = status self.log_event = log_event + class UploadSession(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[UploadSessionTypeField] = None, session_expires_at: Optional[str] = None, part_size: Optional[int] = None, total_parts: Optional[int] = None, num_parts_processed: Optional[int] = None, session_endpoints: Optional[UploadSessionSessionEndpointsField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[UploadSessionTypeField] = None, + session_expires_at: Optional[str] = None, + part_size: Optional[int] = None, + total_parts: Optional[int] = None, + num_parts_processed: Optional[int] = None, + session_endpoints: Optional[UploadSessionSessionEndpointsField] = None, + **kwargs + ): """ :param id: The unique identifier for this session :type id: Optional[str], optional @@ -2485,8 +3557,14 @@ def __init__(self, id: Optional[str] = None, type: Optional[UploadSessionTypeFie self.num_parts_processed = num_parts_processed self.session_endpoints = session_endpoints + class UploadUrl(BaseObject): - def __init__(self, upload_url: Optional[str] = None, upload_token: Optional[str] = None, **kwargs): + def __init__( + self, + upload_url: Optional[str] = None, + upload_token: Optional[str] = None, + **kwargs + ): """ :param upload_url: A URL for an upload session that can be used to upload the file. @@ -2498,8 +3576,15 @@ def __init__(self, upload_url: Optional[str] = None, upload_token: Optional[str] self.upload_url = upload_url self.upload_token = upload_token + class UserAvatarPicUrlsField(BaseObject): - def __init__(self, small: Optional[str] = None, large: Optional[str] = None, preview: Optional[str] = None, **kwargs): + def __init__( + self, + small: Optional[str] = None, + large: Optional[str] = None, + preview: Optional[str] = None, + **kwargs + ): """ :param small: The location of a small-sized avatar. :type small: Optional[str], optional @@ -2513,6 +3598,7 @@ def __init__(self, small: Optional[str] = None, large: Optional[str] = None, pre self.large = large self.preview = preview + class UserAvatar(BaseObject): def __init__(self, pic_urls: Optional[UserAvatarPicUrlsField] = None, **kwargs): """ @@ -2522,9 +3608,11 @@ def __init__(self, pic_urls: Optional[UserAvatarPicUrlsField] = None, **kwargs): super().__init__(**kwargs) self.pic_urls = pic_urls + class UserBaseTypeField(str, Enum): USER = 'user' + class UserBase(BaseObject): def __init__(self, type: UserBaseTypeField, id: Optional[str] = None, **kwargs): """ @@ -2537,8 +3625,16 @@ def __init__(self, type: UserBaseTypeField, id: Optional[str] = None, **kwargs): self.type = type self.id = id + class UserIntegrationMappings(UserBase): - def __init__(self, type: UserBaseTypeField, name: Optional[str] = None, login: Optional[str] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: UserBaseTypeField, + name: Optional[str] = None, + login: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `user` :type type: UserBaseTypeField @@ -2553,8 +3649,16 @@ def __init__(self, type: UserBaseTypeField, name: Optional[str] = None, login: O self.name = name self.login = login + class UserCollaborations(UserBase): - def __init__(self, type: UserBaseTypeField, name: Optional[str] = None, login: Optional[str] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: UserBaseTypeField, + name: Optional[str] = None, + login: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `user` :type type: UserBaseTypeField @@ -2569,8 +3673,16 @@ def __init__(self, type: UserBaseTypeField, name: Optional[str] = None, login: O self.name = name self.login = login + class UserMini(UserBase): - def __init__(self, type: UserBaseTypeField, name: Optional[str] = None, login: Optional[str] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: UserBaseTypeField, + name: Optional[str] = None, + login: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `user` :type type: UserBaseTypeField @@ -2585,10 +3697,12 @@ def __init__(self, type: UserBaseTypeField, name: Optional[str] = None, login: O self.name = name self.login = login + class EventSourceItemTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' + class EventSourceClassificationField(BaseObject): def __init__(self, name: Optional[str] = None, **kwargs): """ @@ -2598,8 +3712,18 @@ def __init__(self, name: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.name = name + class EventSource(BaseObject): - def __init__(self, item_type: EventSourceItemTypeField, item_id: str, item_name: str, classification: Optional[EventSourceClassificationField] = None, parent: Optional[FolderMini] = None, owned_by: Optional[UserMini] = None, **kwargs): + def __init__( + self, + item_type: EventSourceItemTypeField, + item_id: str, + item_name: str, + classification: Optional[EventSourceClassificationField] = None, + parent: Optional[FolderMini] = None, + owned_by: Optional[UserMini] = None, + **kwargs + ): """ :param item_type: The type of the item that the event represents. Can be `file` or `folder`. @@ -2622,14 +3746,18 @@ def __init__(self, item_type: EventSourceItemTypeField, item_id: str, item_name: self.parent = parent self.owned_by = owned_by + class UserStatusField(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' CANNOT_DELETE_EDIT = 'cannot_delete_edit' CANNOT_DELETE_EDIT_UPLOAD = 'cannot_delete_edit_upload' + class UserNotificationEmailField(BaseObject): - def __init__(self, email: Optional[str] = None, is_confirmed: Optional[bool] = None, **kwargs): + def __init__( + self, email: Optional[str] = None, is_confirmed: Optional[bool] = None, **kwargs + ): """ :param email: The email address to send the notifications to. :type email: Optional[str], optional @@ -2640,8 +3768,29 @@ def __init__(self, email: Optional[str] = None, is_confirmed: Optional[bool] = N self.email = email self.is_confirmed = is_confirmed + class User(UserMini): - def __init__(self, type: UserBaseTypeField, created_at: Optional[str] = None, modified_at: Optional[str] = None, language: Optional[str] = None, timezone: Optional[str] = None, space_amount: Optional[int] = None, space_used: Optional[int] = None, max_upload_size: Optional[int] = None, status: Optional[UserStatusField] = None, job_title: Optional[str] = None, phone: Optional[str] = None, address: Optional[str] = None, avatar_url: Optional[str] = None, notification_email: Optional[UserNotificationEmailField] = None, name: Optional[str] = None, login: Optional[str] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: UserBaseTypeField, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + language: Optional[str] = None, + timezone: Optional[str] = None, + space_amount: Optional[int] = None, + space_used: Optional[int] = None, + max_upload_size: Optional[int] = None, + status: Optional[UserStatusField] = None, + job_title: Optional[str] = None, + phone: Optional[str] = None, + address: Optional[str] = None, + avatar_url: Optional[str] = None, + notification_email: Optional[UserNotificationEmailField] = None, + name: Optional[str] = None, + login: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `user` :type type: UserBaseTypeField @@ -2697,12 +3846,19 @@ def __init__(self, type: UserBaseTypeField, created_at: Optional[str] = None, mo self.avatar_url = avatar_url self.notification_email = notification_email + class UsersOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class UsersOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[UsersOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[UsersOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -2713,8 +3869,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[UsersOrderField self.by = by self.direction = direction + class Users(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[UsersOrderField]] = None, entries: Optional[List[User]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[UsersOrderField]] = None, + entries: Optional[List[User]] = None, + **kwargs + ): """ :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 @@ -2745,9 +3910,11 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries + class TrashWebLinkRestoredTypeField(str, Enum): WEB_LINK = 'web_link' + class TrashWebLinkRestoredPathCollectionField(BaseObject): def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): """ @@ -2760,13 +3927,36 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.total_count = total_count self.entries = entries + class TrashWebLinkRestoredItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class TrashWebLinkRestored(BaseObject): - def __init__(self, sequence_id: str, path_collection: TrashWebLinkRestoredPathCollectionField, type: Optional[TrashWebLinkRestoredTypeField] = None, id: Optional[str] = None, etag: Optional[str] = None, name: Optional[str] = None, url: Optional[str] = None, parent: Optional[FolderMini] = None, description: Optional[str] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, created_by: Optional[UserMini] = None, modified_by: Optional[UserMini] = None, owned_by: Optional[UserMini] = None, shared_link: Optional[str] = None, item_status: Optional[TrashWebLinkRestoredItemStatusField] = None, **kwargs): + def __init__( + self, + sequence_id: str, + path_collection: TrashWebLinkRestoredPathCollectionField, + type: Optional[TrashWebLinkRestoredTypeField] = None, + id: Optional[str] = None, + etag: Optional[str] = None, + name: Optional[str] = None, + url: Optional[str] = None, + parent: Optional[FolderMini] = None, + description: Optional[str] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + created_by: Optional[UserMini] = None, + modified_by: Optional[UserMini] = None, + owned_by: Optional[UserMini] = None, + shared_link: Optional[str] = None, + item_status: Optional[TrashWebLinkRestoredItemStatusField] = None, + **kwargs + ): """ :param type: `web_link` :type type: Optional[TrashWebLinkRestoredTypeField], optional @@ -2822,9 +4012,11 @@ def __init__(self, sequence_id: str, path_collection: TrashWebLinkRestoredPathCo self.shared_link = shared_link self.item_status = item_status + class TrashFolderRestoredTypeField(str, Enum): FOLDER = 'folder' + class TrashFolderRestoredPathCollectionField(BaseObject): def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): """ @@ -2837,13 +4029,39 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.total_count = total_count self.entries = entries + class TrashFolderRestoredItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class TrashFolderRestored(BaseObject): - def __init__(self, id: Optional[str] = None, etag: Optional[str] = None, type: Optional[TrashFolderRestoredTypeField] = None, sequence_id: Optional[str] = None, name: Optional[str] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, description: Optional[str] = None, size: Optional[int] = None, path_collection: Optional[TrashFolderRestoredPathCollectionField] = None, created_by: Optional[UserMini] = None, modified_by: Optional[UserMini] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, owned_by: Optional[UserMini] = None, shared_link: Optional[str] = None, folder_upload_email: Optional[str] = None, parent: Optional[FolderMini] = None, item_status: Optional[TrashFolderRestoredItemStatusField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + etag: Optional[str] = None, + type: Optional[TrashFolderRestoredTypeField] = None, + sequence_id: Optional[str] = None, + name: Optional[str] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + description: Optional[str] = None, + size: Optional[int] = None, + path_collection: Optional[TrashFolderRestoredPathCollectionField] = None, + created_by: Optional[UserMini] = None, + modified_by: Optional[UserMini] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + owned_by: Optional[UserMini] = None, + shared_link: Optional[str] = None, + folder_upload_email: Optional[str] = None, + parent: Optional[FolderMini] = None, + item_status: Optional[TrashFolderRestoredItemStatusField] = None, + **kwargs + ): """ :param id: The unique identifier that represent a folder. The ID for any folder can be determined @@ -2920,9 +4138,11 @@ def __init__(self, id: Optional[str] = None, etag: Optional[str] = None, type: O self.parent = parent self.item_status = item_status + class TrashFileRestoredTypeField(str, Enum): FILE = 'file' + class TrashFileRestoredPathCollectionField(BaseObject): def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): """ @@ -2935,15 +4155,49 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.total_count = total_count self.entries = entries + class TrashFileRestoredItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class TrashFileRestored(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'sha_1': 'sha1', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'sha1': 'sha_1', **BaseObject._json_to_fields_mapping} - def __init__(self, id: str, type: TrashFileRestoredTypeField, sequence_id: str, sha_1: str, description: str, size: int, path_collection: TrashFileRestoredPathCollectionField, created_at: str, modified_at: str, modified_by: UserMini, owned_by: UserMini, item_status: TrashFileRestoredItemStatusField, etag: Optional[str] = None, name: Optional[str] = None, file_version: Optional[FileVersionMini] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, created_by: Optional[UserMini] = None, shared_link: Optional[str] = None, parent: Optional[FolderMini] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'sha_1': 'sha1', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'sha1': 'sha_1', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + id: str, + type: TrashFileRestoredTypeField, + sequence_id: str, + sha_1: str, + description: str, + size: int, + path_collection: TrashFileRestoredPathCollectionField, + created_at: str, + modified_at: str, + modified_by: UserMini, + owned_by: UserMini, + item_status: TrashFileRestoredItemStatusField, + etag: Optional[str] = None, + name: Optional[str] = None, + file_version: Optional[FileVersionMini] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + created_by: Optional[UserMini] = None, + shared_link: Optional[str] = None, + parent: Optional[FolderMini] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file. The ID for any file can be determined @@ -3018,14 +4272,25 @@ def __init__(self, id: str, type: TrashFileRestoredTypeField, sequence_id: str, self.shared_link = shared_link self.parent = parent + class TrashWebLinkTypeField(str, Enum): WEB_LINK = 'web_link' + class TrashWebLinkPathCollectionFieldEntriesFieldTypeField(str, Enum): FOLDER = 'folder' + class TrashWebLinkPathCollectionFieldEntriesField(BaseObject): - def __init__(self, type: Optional[TrashWebLinkPathCollectionFieldEntriesFieldTypeField] = None, id: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[TrashWebLinkPathCollectionFieldEntriesFieldTypeField] = None, + id: Optional[str] = None, + sequence_id: Optional[str] = None, + etag: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): """ :param type: `folder` :type type: Optional[TrashWebLinkPathCollectionFieldEntriesFieldTypeField], optional @@ -3045,8 +4310,14 @@ def __init__(self, type: Optional[TrashWebLinkPathCollectionFieldEntriesFieldTyp self.etag = etag self.name = name + class TrashWebLinkPathCollectionField(BaseObject): - def __init__(self, total_count: int, entries: List[TrashWebLinkPathCollectionFieldEntriesField], **kwargs): + def __init__( + self, + total_count: int, + entries: List[TrashWebLinkPathCollectionFieldEntriesField], + **kwargs + ): """ :param total_count: The number of folders in this list. :type total_count: int @@ -3057,13 +4328,36 @@ def __init__(self, total_count: int, entries: List[TrashWebLinkPathCollectionFie self.total_count = total_count self.entries = entries + class TrashWebLinkItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class TrashWebLink(BaseObject): - def __init__(self, type: Optional[TrashWebLinkTypeField] = None, id: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, name: Optional[str] = None, url: Optional[str] = None, parent: Optional[FolderMini] = None, description: Optional[str] = None, path_collection: Optional[TrashWebLinkPathCollectionField] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, created_by: Optional[UserMini] = None, modified_by: Optional[UserMini] = None, owned_by: Optional[UserMini] = None, shared_link: Optional[str] = None, item_status: Optional[TrashWebLinkItemStatusField] = None, **kwargs): + def __init__( + self, + type: Optional[TrashWebLinkTypeField] = None, + id: Optional[str] = None, + sequence_id: Optional[str] = None, + etag: Optional[str] = None, + name: Optional[str] = None, + url: Optional[str] = None, + parent: Optional[FolderMini] = None, + description: Optional[str] = None, + path_collection: Optional[TrashWebLinkPathCollectionField] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + created_by: Optional[UserMini] = None, + modified_by: Optional[UserMini] = None, + owned_by: Optional[UserMini] = None, + shared_link: Optional[str] = None, + item_status: Optional[TrashWebLinkItemStatusField] = None, + **kwargs + ): """ :param type: `web_link` :type type: Optional[TrashWebLinkTypeField], optional @@ -3117,14 +4411,25 @@ def __init__(self, type: Optional[TrashWebLinkTypeField] = None, id: Optional[st self.shared_link = shared_link self.item_status = item_status + class TrashFolderTypeField(str, Enum): FOLDER = 'folder' + class TrashFolderPathCollectionFieldEntriesFieldTypeField(str, Enum): FOLDER = 'folder' + class TrashFolderPathCollectionFieldEntriesField(BaseObject): - def __init__(self, type: Optional[TrashFolderPathCollectionFieldEntriesFieldTypeField] = None, id: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[TrashFolderPathCollectionFieldEntriesFieldTypeField] = None, + id: Optional[str] = None, + sequence_id: Optional[str] = None, + etag: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): """ :param type: `folder` :type type: Optional[TrashFolderPathCollectionFieldEntriesFieldTypeField], optional @@ -3144,8 +4449,14 @@ def __init__(self, type: Optional[TrashFolderPathCollectionFieldEntriesFieldType self.etag = etag self.name = name + class TrashFolderPathCollectionField(BaseObject): - def __init__(self, total_count: int, entries: List[TrashFolderPathCollectionFieldEntriesField], **kwargs): + def __init__( + self, + total_count: int, + entries: List[TrashFolderPathCollectionFieldEntriesField], + **kwargs + ): """ :param total_count: The number of folders in this list. :type total_count: int @@ -3156,13 +4467,39 @@ def __init__(self, total_count: int, entries: List[TrashFolderPathCollectionFiel self.total_count = total_count self.entries = entries + class TrashFolderItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class TrashFolder(BaseObject): - def __init__(self, id: str, type: TrashFolderTypeField, name: str, description: str, size: int, path_collection: TrashFolderPathCollectionField, created_by: UserMini, modified_by: UserMini, owned_by: UserMini, item_status: TrashFolderItemStatusField, etag: Optional[str] = None, sequence_id: Optional[str] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, shared_link: Optional[str] = None, folder_upload_email: Optional[str] = None, parent: Optional[FolderMini] = None, **kwargs): + def __init__( + self, + id: str, + type: TrashFolderTypeField, + name: str, + description: str, + size: int, + path_collection: TrashFolderPathCollectionField, + created_by: UserMini, + modified_by: UserMini, + owned_by: UserMini, + item_status: TrashFolderItemStatusField, + etag: Optional[str] = None, + sequence_id: Optional[str] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + shared_link: Optional[str] = None, + folder_upload_email: Optional[str] = None, + parent: Optional[FolderMini] = None, + **kwargs + ): """ :param id: The unique identifier that represent a folder. The ID for any folder can be determined @@ -3238,14 +4575,25 @@ def __init__(self, id: str, type: TrashFolderTypeField, name: str, description: self.folder_upload_email = folder_upload_email self.parent = parent + class TrashFileTypeField(str, Enum): FILE = 'file' + class TrashFilePathCollectionFieldEntriesFieldTypeField(str, Enum): FOLDER = 'folder' + class TrashFilePathCollectionFieldEntriesField(BaseObject): - def __init__(self, type: Optional[TrashFilePathCollectionFieldEntriesFieldTypeField] = None, id: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[TrashFilePathCollectionFieldEntriesFieldTypeField] = None, + id: Optional[str] = None, + sequence_id: Optional[str] = None, + etag: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): """ :param type: `folder` :type type: Optional[TrashFilePathCollectionFieldEntriesFieldTypeField], optional @@ -3265,8 +4613,14 @@ def __init__(self, type: Optional[TrashFilePathCollectionFieldEntriesFieldTypeFi self.etag = etag self.name = name + class TrashFilePathCollectionField(BaseObject): - def __init__(self, total_count: int, entries: List[TrashFilePathCollectionFieldEntriesField], **kwargs): + def __init__( + self, + total_count: int, + entries: List[TrashFilePathCollectionFieldEntriesField], + **kwargs + ): """ :param total_count: The number of folders in this list. :type total_count: int @@ -3277,15 +4631,49 @@ def __init__(self, total_count: int, entries: List[TrashFilePathCollectionFieldE self.total_count = total_count self.entries = entries + class TrashFileItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class TrashFile(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'sha_1': 'sha1', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'sha1': 'sha_1', **BaseObject._json_to_fields_mapping} - def __init__(self, id: str, type: TrashFileTypeField, sequence_id: str, sha_1: str, description: str, size: int, path_collection: TrashFilePathCollectionField, created_at: str, modified_at: str, modified_by: UserMini, owned_by: UserMini, item_status: TrashFileItemStatusField, etag: Optional[str] = None, name: Optional[str] = None, file_version: Optional[FileVersionMini] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, created_by: Optional[UserMini] = None, shared_link: Optional[str] = None, parent: Optional[FolderMini] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'sha_1': 'sha1', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'sha1': 'sha_1', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + id: str, + type: TrashFileTypeField, + sequence_id: str, + sha_1: str, + description: str, + size: int, + path_collection: TrashFilePathCollectionField, + created_at: str, + modified_at: str, + modified_by: UserMini, + owned_by: UserMini, + item_status: TrashFileItemStatusField, + etag: Optional[str] = None, + name: Optional[str] = None, + file_version: Optional[FileVersionMini] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + created_by: Optional[UserMini] = None, + shared_link: Optional[str] = None, + parent: Optional[FolderMini] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file. The ID for any file can be determined @@ -3359,11 +4747,23 @@ def __init__(self, id: str, type: TrashFileTypeField, sequence_id: str, sha_1: s self.shared_link = shared_link self.parent = parent + class TermsOfServiceUserStatusTypeField(str, Enum): TERMS_OF_SERVICE_USER_STATUS = 'terms_of_service_user_status' + class TermsOfServiceUserStatus(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[TermsOfServiceUserStatusTypeField] = None, tos: Optional[TermsOfServiceBase] = None, user: Optional[UserMini] = None, is_accepted: Optional[bool] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[TermsOfServiceUserStatusTypeField] = None, + tos: Optional[TermsOfServiceBase] = None, + user: Optional[UserMini] = None, + is_accepted: Optional[bool] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this terms of service user status :type id: Optional[str], optional @@ -3385,8 +4785,14 @@ def __init__(self, id: Optional[str] = None, type: Optional[TermsOfServiceUserSt self.created_at = created_at self.modified_at = modified_at + class TermsOfServiceUserStatuses(BaseObject): - def __init__(self, total_count: Optional[int] = None, entries: Optional[List[TermsOfServiceUserStatus]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + entries: Optional[List[TermsOfServiceUserStatus]] = None, + **kwargs + ): """ :param total_count: The total number of objects. :type total_count: Optional[int], optional @@ -3397,17 +4803,33 @@ def __init__(self, total_count: Optional[int] = None, entries: Optional[List[Ter self.total_count = total_count self.entries = entries + class TaskAssignmentTypeField(str, Enum): TASK_ASSIGNMENT = 'task_assignment' + class TaskAssignmentResolutionStateField(str, Enum): COMPLETED = 'completed' INCOMPLETE = 'incomplete' APPROVED = 'approved' REJECTED = 'rejected' + class TaskAssignment(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[TaskAssignmentTypeField] = None, item: Optional[FileMini] = None, assigned_to: Optional[UserMini] = None, message: Optional[str] = None, completed_at: Optional[str] = None, assigned_at: Optional[str] = None, reminded_at: Optional[str] = None, resolution_state: Optional[TaskAssignmentResolutionStateField] = None, assigned_by: Optional[UserMini] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[TaskAssignmentTypeField] = None, + item: Optional[FileMini] = None, + assigned_to: Optional[UserMini] = None, + message: Optional[str] = None, + completed_at: Optional[str] = None, + assigned_at: Optional[str] = None, + reminded_at: Optional[str] = None, + resolution_state: Optional[TaskAssignmentResolutionStateField] = None, + assigned_by: Optional[UserMini] = None, + **kwargs + ): """ :param id: The unique identifier for this task assignment :type id: Optional[str], optional @@ -3441,8 +4863,14 @@ def __init__(self, id: Optional[str] = None, type: Optional[TaskAssignmentTypeFi self.resolution_state = resolution_state self.assigned_by = assigned_by + class TaskAssignments(BaseObject): - def __init__(self, total_count: Optional[int] = None, entries: Optional[List[TaskAssignment]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + entries: Optional[List[TaskAssignment]] = None, + **kwargs + ): """ :param total_count: The total number of items in this collection. :type total_count: Optional[int], optional @@ -3453,19 +4881,37 @@ def __init__(self, total_count: Optional[int] = None, entries: Optional[List[Tas self.total_count = total_count self.entries = entries + class TaskTypeField(str, Enum): TASK = 'task' + class TaskActionField(str, Enum): REVIEW = 'review' COMPLETE = 'complete' + class TaskCompletionRuleField(str, Enum): ALL_ASSIGNEES = 'all_assignees' ANY_ASSIGNEE = 'any_assignee' + class Task(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[TaskTypeField] = None, item: Optional[FileMini] = None, due_at: Optional[str] = None, action: Optional[TaskActionField] = None, message: Optional[str] = None, task_assignment_collection: Optional[TaskAssignments] = None, is_completed: Optional[bool] = None, created_by: Optional[UserMini] = None, created_at: Optional[str] = None, completion_rule: Optional[TaskCompletionRuleField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[TaskTypeField] = None, + item: Optional[FileMini] = None, + due_at: Optional[str] = None, + action: Optional[TaskActionField] = None, + message: Optional[str] = None, + task_assignment_collection: Optional[TaskAssignments] = None, + is_completed: Optional[bool] = None, + created_by: Optional[UserMini] = None, + created_at: Optional[str] = None, + completion_rule: Optional[TaskCompletionRuleField] = None, + **kwargs + ): """ :param id: The unique identifier for this task :type id: Optional[str], optional @@ -3503,8 +4949,14 @@ def __init__(self, id: Optional[str] = None, type: Optional[TaskTypeField] = Non self.created_at = created_at self.completion_rule = completion_rule + class Tasks(BaseObject): - def __init__(self, total_count: Optional[int] = None, entries: Optional[List[Task]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + entries: Optional[List[Task]] = None, + **kwargs + ): """ :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 @@ -3517,16 +4969,24 @@ def __init__(self, total_count: Optional[int] = None, entries: Optional[List[Tas self.total_count = total_count self.entries = entries + class RetentionPolicyAssignmentTypeField(str, Enum): RETENTION_POLICY_ASSIGNMENT = 'retention_policy_assignment' + class RetentionPolicyAssignmentAssignedToFieldTypeField(str, Enum): FOLDER = 'folder' ENTERPRISE = 'enterprise' METADATA_TEMPLATE = 'metadata_template' + class RetentionPolicyAssignmentAssignedToField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[RetentionPolicyAssignmentAssignedToFieldTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[RetentionPolicyAssignmentAssignedToFieldTypeField] = None, + **kwargs + ): """ :param id: The ID of the folder, enterprise, or metadata template the policy is assigned to. @@ -3538,8 +4998,11 @@ def __init__(self, id: Optional[str] = None, type: Optional[RetentionPolicyAssig self.id = id self.type = type + class RetentionPolicyAssignmentFilterFieldsField(BaseObject): - def __init__(self, field: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__( + self, field: Optional[str] = None, value: Optional[str] = None, **kwargs + ): """ :param field: The metadata attribute key id. :type field: Optional[str], optional @@ -3551,8 +5014,22 @@ def __init__(self, field: Optional[str] = None, value: Optional[str] = None, **k self.field = field self.value = value + class RetentionPolicyAssignment(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[RetentionPolicyAssignmentTypeField] = None, retention_policy: Optional[RetentionPolicyMini] = None, assigned_to: Optional[RetentionPolicyAssignmentAssignedToField] = None, filter_fields: Optional[List[RetentionPolicyAssignmentFilterFieldsField]] = None, assigned_by: Optional[UserMini] = None, assigned_at: Optional[str] = None, start_date_field: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[RetentionPolicyAssignmentTypeField] = None, + retention_policy: Optional[RetentionPolicyMini] = None, + assigned_to: Optional[RetentionPolicyAssignmentAssignedToField] = None, + filter_fields: Optional[ + List[RetentionPolicyAssignmentFilterFieldsField] + ] = None, + assigned_by: Optional[UserMini] = None, + assigned_at: Optional[str] = None, + start_date_field: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for a retention policy assignment. :type id: Optional[str], optional @@ -3583,20 +5060,30 @@ def __init__(self, id: Optional[str] = None, type: Optional[RetentionPolicyAssig self.assigned_at = assigned_at self.start_date_field = start_date_field + class RetentionPolicyPolicyTypeField(str, Enum): FINITE = 'finite' INDEFINITE = 'indefinite' + class RetentionPolicyRetentionTypeField(str, Enum): MODIFIABLE = 'modifiable' NON_MODIFIABLE = 'non-modifiable' + class RetentionPolicyStatusField(str, Enum): ACTIVE = 'active' RETIRED = 'retired' + class RetentionPolicyAssignmentCountsField(BaseObject): - def __init__(self, enterprise: Optional[int] = None, folder: Optional[int] = None, metadata_template: Optional[int] = None, **kwargs): + def __init__( + self, + enterprise: Optional[int] = None, + folder: Optional[int] = None, + metadata_template: Optional[int] = None, + **kwargs + ): """ :param enterprise: The number of enterprise assignments this policy has. The maximum value is 1. :type enterprise: Optional[int], optional @@ -3610,8 +5097,28 @@ def __init__(self, enterprise: Optional[int] = None, folder: Optional[int] = Non self.folder = folder self.metadata_template = metadata_template + class RetentionPolicy(RetentionPolicyMini): - def __init__(self, id: str, type: RetentionPolicyBaseTypeField, description: Optional[str] = None, policy_type: Optional[RetentionPolicyPolicyTypeField] = None, retention_type: Optional[RetentionPolicyRetentionTypeField] = None, status: Optional[RetentionPolicyStatusField] = None, created_by: Optional[UserMini] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, can_owner_extend_retention: Optional[bool] = None, are_owners_notified: Optional[bool] = None, custom_notification_recipients: Optional[List[UserMini]] = None, assignment_counts: Optional[RetentionPolicyAssignmentCountsField] = None, policy_name: Optional[str] = None, retention_length: Optional[str] = None, disposition_action: Optional[RetentionPolicyMiniDispositionActionField] = None, **kwargs): + def __init__( + self, + id: str, + type: RetentionPolicyBaseTypeField, + description: Optional[str] = None, + policy_type: Optional[RetentionPolicyPolicyTypeField] = None, + retention_type: Optional[RetentionPolicyRetentionTypeField] = None, + status: Optional[RetentionPolicyStatusField] = None, + created_by: Optional[UserMini] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + can_owner_extend_retention: Optional[bool] = None, + are_owners_notified: Optional[bool] = None, + custom_notification_recipients: Optional[List[UserMini]] = None, + assignment_counts: Optional[RetentionPolicyAssignmentCountsField] = None, + policy_name: Optional[str] = None, + retention_length: Optional[str] = None, + disposition_action: Optional[RetentionPolicyMiniDispositionActionField] = None, + **kwargs + ): """ :param id: The unique identifier that represents a retention policy. :type id: str @@ -3679,7 +5186,14 @@ def __init__(self, id: str, type: RetentionPolicyBaseTypeField, description: Opt once the retention policy has expired. :type disposition_action: Optional[RetentionPolicyMiniDispositionActionField], optional """ - super().__init__(id=id, type=type, policy_name=policy_name, retention_length=retention_length, disposition_action=disposition_action, **kwargs) + super().__init__( + id=id, + type=type, + policy_name=policy_name, + retention_length=retention_length, + disposition_action=disposition_action, + **kwargs + ) self.description = description self.policy_type = policy_type self.retention_type = retention_type @@ -3692,14 +5206,23 @@ def __init__(self, id: str, type: RetentionPolicyBaseTypeField, description: Opt self.custom_notification_recipients = custom_notification_recipients self.assignment_counts = assignment_counts + class LegalHoldPolicyStatusField(str, Enum): ACTIVE = 'active' APPLYING = 'applying' RELEASING = 'releasing' RELEASED = 'released' + class LegalHoldPolicyAssignmentCountsField(BaseObject): - def __init__(self, user: Optional[int] = None, folder: Optional[int] = None, file: Optional[int] = None, file_version: Optional[int] = None, **kwargs): + def __init__( + self, + user: Optional[int] = None, + folder: Optional[int] = None, + file: Optional[int] = None, + file_version: Optional[int] = None, + **kwargs + ): """ :param user: The number of users this policy is applied to :type user: Optional[int], optional @@ -3716,8 +5239,25 @@ def __init__(self, user: Optional[int] = None, folder: Optional[int] = None, fil self.file = file self.file_version = file_version + class LegalHoldPolicy(LegalHoldPolicyMini): - def __init__(self, policy_name: Optional[str] = None, description: Optional[str] = None, status: Optional[LegalHoldPolicyStatusField] = None, assignment_counts: Optional[LegalHoldPolicyAssignmentCountsField] = None, created_by: Optional[UserMini] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, deleted_at: Optional[str] = None, filter_started_at: Optional[str] = None, filter_ended_at: Optional[str] = None, release_notes: Optional[str] = None, id: Optional[str] = None, type: Optional[LegalHoldPolicyMiniTypeField] = None, **kwargs): + def __init__( + self, + policy_name: Optional[str] = None, + description: Optional[str] = None, + status: Optional[LegalHoldPolicyStatusField] = None, + assignment_counts: Optional[LegalHoldPolicyAssignmentCountsField] = None, + created_by: Optional[UserMini] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + deleted_at: Optional[str] = None, + filter_started_at: Optional[str] = None, + filter_ended_at: Optional[str] = None, + release_notes: Optional[str] = None, + id: Optional[str] = None, + type: Optional[LegalHoldPolicyMiniTypeField] = None, + **kwargs + ): """ :param policy_name: Name of the legal hold policy. :type policy_name: Optional[str], optional @@ -3769,8 +5309,16 @@ def __init__(self, policy_name: Optional[str] = None, description: Optional[str] self.filter_ended_at = filter_ended_at self.release_notes = release_notes + class LegalHoldPolicies(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[LegalHoldPolicy]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[LegalHoldPolicy]] = 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 @@ -3789,14 +5337,23 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class InviteTypeField(str, Enum): INVITE = 'invite' + class InviteInvitedToFieldTypeField(str, Enum): ENTERPRISE = 'enterprise' + class InviteInvitedToField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[InviteInvitedToFieldTypeField] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[InviteInvitedToFieldTypeField] = None, + name: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this enterprise. :type id: Optional[str], optional @@ -3810,8 +5367,20 @@ def __init__(self, id: Optional[str] = None, type: Optional[InviteInvitedToField self.type = type self.name = name + class Invite(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[InviteTypeField] = None, invited_to: Optional[InviteInvitedToField] = None, actionable_by: Optional[UserMini] = None, invited_by: Optional[UserMini] = None, status: Optional[str] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[InviteTypeField] = None, + invited_to: Optional[InviteInvitedToField] = None, + actionable_by: Optional[UserMini] = None, + invited_by: Optional[UserMini] = None, + status: Optional[str] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this invite :type id: Optional[str], optional @@ -3836,15 +5405,28 @@ def __init__(self, id: Optional[str] = None, type: Optional[InviteTypeField] = N self.created_at = created_at self.modified_at = modified_at + class GroupMembershipTypeField(str, Enum): GROUP_MEMBERSHIP = 'group_membership' + class GroupMembershipRoleField(str, Enum): MEMBER = 'member' ADMIN = 'admin' + class GroupMembership(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[GroupMembershipTypeField] = None, user: Optional[UserMini] = None, group: Optional[GroupMini] = None, role: Optional[GroupMembershipRoleField] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[GroupMembershipTypeField] = None, + user: Optional[UserMini] = None, + group: Optional[GroupMini] = None, + role: Optional[GroupMembershipRoleField] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this group membership :type id: Optional[str], optional @@ -3866,12 +5448,19 @@ def __init__(self, id: Optional[str] = None, type: Optional[GroupMembershipTypeF self.created_at = created_at self.modified_at = modified_at + class GroupMembershipsOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class GroupMembershipsOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[GroupMembershipsOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[GroupMembershipsOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -3882,8 +5471,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[GroupMembership self.by = by self.direction = direction + class GroupMemberships(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[GroupMembershipsOrderField]] = None, entries: Optional[List[GroupMembership]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[GroupMembershipsOrderField]] = None, + entries: Optional[List[GroupMembership]] = None, + **kwargs + ): """ :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 @@ -3914,8 +5512,26 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries + class FileVersion(FileVersionMini): - def __init__(self, id: str, type: FileVersionBaseTypeField, name: Optional[str] = None, size: Optional[int] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, modified_by: Optional[UserMini] = None, trashed_at: Optional[str] = None, trashed_by: Optional[UserMini] = None, restored_at: Optional[str] = None, restored_by: Optional[UserMini] = None, purged_at: Optional[str] = None, uploader_display_name: Optional[str] = None, sha_1: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: FileVersionBaseTypeField, + name: Optional[str] = None, + size: Optional[int] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + modified_by: Optional[UserMini] = None, + trashed_at: Optional[str] = None, + trashed_by: Optional[UserMini] = None, + restored_at: Optional[str] = None, + restored_by: Optional[UserMini] = None, + purged_at: Optional[str] = None, + uploader_display_name: Optional[str] = None, + sha_1: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file version. :type id: str @@ -3951,12 +5567,19 @@ def __init__(self, id: str, type: FileVersionBaseTypeField, name: Optional[str] self.purged_at = purged_at self.uploader_display_name = uploader_display_name + class FileVersionsOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class FileVersionsOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[FileVersionsOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[FileVersionsOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -3967,8 +5590,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[FileVersionsOrd self.by = by self.direction = direction + class FileVersions(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[FileVersionsOrderField]] = None, entries: Optional[List[FileVersion]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[FileVersionsOrderField]] = None, + entries: Optional[List[FileVersion]] = None, + **kwargs + ): """ :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 @@ -3999,8 +5631,27 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries + class FileVersionFull(FileVersion): - def __init__(self, id: str, type: FileVersionBaseTypeField, version_number: Optional[str] = None, name: Optional[str] = None, size: Optional[int] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, modified_by: Optional[UserMini] = None, trashed_at: Optional[str] = None, trashed_by: Optional[UserMini] = None, restored_at: Optional[str] = None, restored_by: Optional[UserMini] = None, purged_at: Optional[str] = None, uploader_display_name: Optional[str] = None, sha_1: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: FileVersionBaseTypeField, + version_number: Optional[str] = None, + name: Optional[str] = None, + size: Optional[int] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + modified_by: Optional[UserMini] = None, + trashed_at: Optional[str] = None, + trashed_by: Optional[UserMini] = None, + restored_at: Optional[str] = None, + restored_by: Optional[UserMini] = None, + purged_at: Optional[str] = None, + uploader_display_name: Optional[str] = None, + sha_1: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file version. :type id: str @@ -4025,18 +5676,55 @@ def __init__(self, id: str, type: FileVersionBaseTypeField, version_number: Opti :param sha_1: The SHA1 hash of this version of the file. :type sha_1: Optional[str], optional """ - super().__init__(id=id, type=type, name=name, size=size, created_at=created_at, modified_at=modified_at, modified_by=modified_by, trashed_at=trashed_at, trashed_by=trashed_by, restored_at=restored_at, restored_by=restored_by, purged_at=purged_at, uploader_display_name=uploader_display_name, sha_1=sha_1, **kwargs) + super().__init__( + id=id, + type=type, + name=name, + size=size, + created_at=created_at, + modified_at=modified_at, + modified_by=modified_by, + trashed_at=trashed_at, + trashed_by=trashed_by, + restored_at=restored_at, + restored_by=restored_by, + purged_at=purged_at, + uploader_display_name=uploader_display_name, + sha_1=sha_1, + **kwargs + ) self.version_number = version_number + class FileRequestTypeField(str, Enum): FILE_REQUEST = 'file_request' + class FileRequestStatusField(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' + class FileRequest(BaseObject): - def __init__(self, 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, is_email_required: Optional[bool] = None, is_description_required: Optional[bool] = None, expires_at: Optional[str] = None, url: Optional[str] = None, etag: Optional[str] = None, created_by: Optional[UserMini] = None, updated_by: Optional[UserMini] = None, **kwargs): + def __init__( + self, + 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, + is_email_required: Optional[bool] = None, + is_description_required: Optional[bool] = None, + expires_at: Optional[str] = None, + url: Optional[str] = None, + etag: Optional[str] = None, + created_by: Optional[UserMini] = None, + updated_by: Optional[UserMini] = None, + **kwargs + ): """ :param created_at: The date and time when the file request was created. :type created_at: str @@ -4111,6 +5799,7 @@ def __init__(self, folder: FolderMini, created_at: str, updated_at: str, id: Opt self.created_by = created_by self.updated_by = updated_by + class FilePathCollectionField(BaseObject): def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): """ @@ -4123,22 +5812,26 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.total_count = total_count self.entries = entries + class FileSharedLinkFieldAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class FileSharedLinkFieldEffectiveAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class FileSharedLinkFieldEffectivePermissionField(str, Enum): CAN_EDIT = 'can_edit' CAN_DOWNLOAD = 'can_download' CAN_PREVIEW = 'can_preview' NO_ACCESS = 'no_access' + class FileSharedLinkFieldPermissionsField(BaseObject): def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwargs): """ @@ -4161,8 +5854,24 @@ def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwar self.can_preview = can_preview self.can_edit = can_edit + class FileSharedLinkField(BaseObject): - def __init__(self, url: str, effective_access: FileSharedLinkFieldEffectiveAccessField, effective_permission: FileSharedLinkFieldEffectivePermissionField, is_password_enabled: bool, download_count: int, preview_count: int, download_url: Optional[str] = None, vanity_url: Optional[str] = None, vanity_name: Optional[str] = None, access: Optional[FileSharedLinkFieldAccessField] = None, unshared_at: Optional[str] = None, permissions: Optional[FileSharedLinkFieldPermissionsField] = None, **kwargs): + def __init__( + self, + url: str, + effective_access: FileSharedLinkFieldEffectiveAccessField, + effective_permission: FileSharedLinkFieldEffectivePermissionField, + is_password_enabled: bool, + download_count: int, + preview_count: int, + download_url: Optional[str] = None, + vanity_url: Optional[str] = None, + vanity_name: Optional[str] = None, + access: Optional[FileSharedLinkFieldAccessField] = None, + unshared_at: Optional[str] = None, + permissions: Optional[FileSharedLinkFieldPermissionsField] = None, + **kwargs + ): """ :param url: The URL that can be used to access the item on Box. This URL will display the item in Box's preview UI where the file @@ -4226,13 +5935,40 @@ def __init__(self, url: str, effective_access: FileSharedLinkFieldEffectiveAcces self.unshared_at = unshared_at self.permissions = permissions + class FileItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class File(FileMini): - def __init__(self, id: str, type: FileBaseTypeField, description: Optional[str] = None, size: Optional[int] = None, path_collection: Optional[FilePathCollectionField] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, created_by: Optional[UserMini] = None, modified_by: Optional[UserMini] = None, owned_by: Optional[UserMini] = None, shared_link: Optional[FileSharedLinkField] = None, parent: Optional[FolderMini] = None, item_status: Optional[FileItemStatusField] = None, sequence_id: Optional[str] = None, name: Optional[str] = None, sha_1: Optional[str] = None, file_version: Optional[FileVersionMini] = None, etag: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: FileBaseTypeField, + description: Optional[str] = None, + size: Optional[int] = None, + path_collection: Optional[FilePathCollectionField] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + created_by: Optional[UserMini] = None, + modified_by: Optional[UserMini] = None, + owned_by: Optional[UserMini] = None, + shared_link: Optional[FileSharedLinkField] = None, + parent: Optional[FolderMini] = None, + item_status: Optional[FileItemStatusField] = None, + sequence_id: Optional[str] = None, + name: Optional[str] = None, + sha_1: Optional[str] = None, + file_version: Optional[FileVersionMini] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file. The ID for any file can be determined @@ -4278,7 +6014,16 @@ def __init__(self, id: str, type: FileBaseTypeField, description: Optional[str] perform changes on the file if (no) changes have happened. :type etag: Optional[str], optional """ - super().__init__(id=id, type=type, sequence_id=sequence_id, name=name, sha_1=sha_1, file_version=file_version, etag=etag, **kwargs) + super().__init__( + id=id, + type=type, + sequence_id=sequence_id, + name=name, + sha_1=sha_1, + file_version=file_version, + etag=etag, + **kwargs + ) self.description = description self.size = size self.path_collection = path_collection @@ -4295,8 +6040,24 @@ def __init__(self, id: str, type: FileBaseTypeField, description: Optional[str] self.parent = parent self.item_status = item_status + class FileFullPermissionsField(BaseObject): - def __init__(self, can_delete: bool, can_download: bool, can_invite_collaborator: bool, can_rename: bool, can_set_share_access: bool, can_share: bool, can_annotate: Optional[bool] = None, can_comment: Optional[bool] = None, can_preview: Optional[bool] = None, can_upload: Optional[bool] = None, can_view_annotations_all: Optional[bool] = None, can_view_annotations_self: Optional[bool] = None, **kwargs): + def __init__( + self, + can_delete: bool, + can_download: bool, + can_invite_collaborator: bool, + can_rename: bool, + can_set_share_access: bool, + can_share: bool, + can_annotate: Optional[bool] = None, + can_comment: Optional[bool] = None, + can_preview: Optional[bool] = None, + can_upload: Optional[bool] = None, + can_view_annotations_all: Optional[bool] = None, + can_view_annotations_self: Optional[bool] = None, + **kwargs + ): """ :param can_delete: Specifies if the current user can delete this item. :type can_delete: bool @@ -4342,17 +6103,30 @@ def __init__(self, can_delete: bool, can_download: bool, can_invite_collaborator self.can_view_annotations_all = can_view_annotations_all self.can_view_annotations_self = can_view_annotations_self + class FileFullLockFieldTypeField(str, Enum): LOCK = 'lock' + class FileFullLockFieldAppTypeField(str, Enum): GSUITE = 'gsuite' OFFICE_WOPI = 'office_wopi' OFFICE_WOPIPLUS = 'office_wopiplus' OTHER = 'other' + class FileFullLockField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[FileFullLockFieldTypeField] = None, created_by: Optional[UserMini] = None, created_at: Optional[str] = None, expired_at: Optional[str] = None, is_download_prevented: Optional[bool] = None, app_type: Optional[FileFullLockFieldAppTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[FileFullLockFieldTypeField] = None, + created_by: Optional[UserMini] = None, + created_at: Optional[str] = None, + expired_at: Optional[str] = None, + is_download_prevented: Optional[bool] = None, + app_type: Optional[FileFullLockFieldAppTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for this lock :type id: Optional[str], optional @@ -4379,11 +6153,21 @@ def __init__(self, id: Optional[str] = None, type: Optional[FileFullLockFieldTyp self.is_download_prevented = is_download_prevented self.app_type = app_type + class FileFullExpiringEmbedLinkFieldTokenTypeField(str, Enum): BEARER = 'bearer' + class FileFullExpiringEmbedLinkField(BaseObject): - def __init__(self, access_token: Optional[str] = None, expires_in: Optional[int] = None, token_type: Optional[FileFullExpiringEmbedLinkFieldTokenTypeField] = None, restricted_to: Optional[List[FileScope]] = None, url: Optional[str] = None, **kwargs): + def __init__( + self, + access_token: Optional[str] = None, + expires_in: Optional[int] = None, + token_type: Optional[FileFullExpiringEmbedLinkFieldTokenTypeField] = None, + restricted_to: Optional[List[FileScope]] = None, + url: Optional[str] = None, + **kwargs + ): """ :param access_token: The requested access token. :type access_token: Optional[str], optional @@ -4406,6 +6190,7 @@ def __init__(self, access_token: Optional[str] = None, expires_in: Optional[int] self.restricted_to = restricted_to self.url = url + class FileFullWatermarkInfoField(BaseObject): def __init__(self, is_watermarked: Optional[bool] = None, **kwargs): """ @@ -4415,6 +6200,7 @@ def __init__(self, is_watermarked: Optional[bool] = None, **kwargs): super().__init__(**kwargs) self.is_watermarked = is_watermarked + class FileFullAllowedInviteeRolesField(str, Enum): EDITOR = 'editor' VIEWER = 'viewer' @@ -4424,13 +6210,24 @@ class FileFullAllowedInviteeRolesField(str, Enum): VIEWER_UPLOADER = 'viewer uploader' CO_OWNER = 'co-owner' + class FileFullMetadataField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'extra_data': 'extraData', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'extraData': 'extra_data', **BaseObject._json_to_fields_mapping} - def __init__(self, extra_data: Optional[Dict[str, Dict[str, Metadata]]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'extra_data': 'extraData', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'extraData': 'extra_data', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, extra_data: Optional[Dict[str, Dict[str, Metadata]]] = None, **kwargs + ): super().__init__(**kwargs) self.extra_data = extra_data + class FileFullRepresentationsFieldEntriesFieldContentField(BaseObject): def __init__(self, url_template: Optional[str] = None, **kwargs): """ @@ -4459,6 +6256,7 @@ def __init__(self, url_template: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.url_template = url_template + class FileFullRepresentationsFieldEntriesFieldInfoField(BaseObject): def __init__(self, url: Optional[str] = None, **kwargs): """ @@ -4470,8 +6268,15 @@ def __init__(self, url: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.url = url + class FileFullRepresentationsFieldEntriesFieldPropertiesField(BaseObject): - def __init__(self, dimensions: Optional[str] = None, paged: Optional[bool] = None, thumb: Optional[bool] = None, **kwargs): + def __init__( + self, + dimensions: Optional[str] = None, + paged: Optional[bool] = None, + thumb: Optional[bool] = None, + **kwargs + ): """ :param dimensions: The width by height size of this representation in pixels. :type dimensions: Optional[str], optional @@ -4487,14 +6292,22 @@ def __init__(self, dimensions: Optional[str] = None, paged: Optional[bool] = Non self.paged = paged self.thumb = thumb + class FileFullRepresentationsFieldEntriesFieldStatusFieldStateField(str, Enum): SUCCESS = 'success' VIEWABLE = 'viewable' PENDING = 'pending' NONE = 'none' + class FileFullRepresentationsFieldEntriesFieldStatusField(BaseObject): - def __init__(self, state: Optional[FileFullRepresentationsFieldEntriesFieldStatusFieldStateField] = None, **kwargs): + def __init__( + self, + state: Optional[ + FileFullRepresentationsFieldEntriesFieldStatusFieldStateField + ] = None, + **kwargs + ): """ :param state: The status of the representation. * `success` defines the representation as ready to be viewed. @@ -4509,8 +6322,19 @@ def __init__(self, state: Optional[FileFullRepresentationsFieldEntriesFieldStatu super().__init__(**kwargs) self.state = state + class FileFullRepresentationsFieldEntriesField(BaseObject): - def __init__(self, content: Optional[FileFullRepresentationsFieldEntriesFieldContentField] = None, info: Optional[FileFullRepresentationsFieldEntriesFieldInfoField] = None, properties: Optional[FileFullRepresentationsFieldEntriesFieldPropertiesField] = None, representation: Optional[str] = None, status: Optional[FileFullRepresentationsFieldEntriesFieldStatusField] = None, **kwargs): + def __init__( + self, + content: Optional[FileFullRepresentationsFieldEntriesFieldContentField] = None, + info: Optional[FileFullRepresentationsFieldEntriesFieldInfoField] = None, + properties: Optional[ + FileFullRepresentationsFieldEntriesFieldPropertiesField + ] = None, + representation: Optional[str] = None, + status: Optional[FileFullRepresentationsFieldEntriesFieldStatusField] = None, + **kwargs + ): """ :param content: An object containing the URL that can be used to actually fetch the representation. @@ -4532,8 +6356,13 @@ def __init__(self, content: Optional[FileFullRepresentationsFieldEntriesFieldCon self.representation = representation self.status = status + class FileFullRepresentationsField(BaseObject): - def __init__(self, entries: Optional[List[FileFullRepresentationsFieldEntriesField]] = None, **kwargs): + def __init__( + self, + entries: Optional[List[FileFullRepresentationsFieldEntriesField]] = None, + **kwargs + ): """ :param entries: A list of files :type entries: Optional[List[FileFullRepresentationsFieldEntriesField]], optional @@ -4541,8 +6370,15 @@ def __init__(self, entries: Optional[List[FileFullRepresentationsFieldEntriesFie super().__init__(**kwargs) self.entries = entries + class FileFullClassificationField(BaseObject): - def __init__(self, name: Optional[str] = None, definition: Optional[str] = None, color: Optional[str] = None, **kwargs): + def __init__( + self, + name: Optional[str] = None, + definition: Optional[str] = None, + color: Optional[str] = None, + **kwargs + ): """ :param name: The name of the classification :type name: Optional[str], optional @@ -4558,13 +6394,62 @@ def __init__(self, name: Optional[str] = None, definition: Optional[str] = None, self.definition = definition self.color = color + class FileFullSharedLinkPermissionOptionsField(str, Enum): CAN_PREVIEW = 'can_preview' CAN_DOWNLOAD = 'can_download' CAN_EDIT = 'can_edit' + class FileFull(File): - def __init__(self, id: str, type: FileBaseTypeField, version_number: Optional[str] = None, comment_count: Optional[int] = None, permissions: Optional[FileFullPermissionsField] = None, tags: Optional[List[str]] = None, lock: Optional[FileFullLockField] = None, extension: Optional[str] = None, is_package: Optional[bool] = None, expiring_embed_link: Optional[FileFullExpiringEmbedLinkField] = None, watermark_info: Optional[FileFullWatermarkInfoField] = None, is_accessible_via_shared_link: Optional[bool] = None, allowed_invitee_roles: Optional[List[FileFullAllowedInviteeRolesField]] = None, is_externally_owned: Optional[bool] = None, has_collaborations: Optional[bool] = None, metadata: Optional[FileFullMetadataField] = None, expires_at: Optional[str] = None, representations: Optional[FileFullRepresentationsField] = None, classification: Optional[FileFullClassificationField] = None, uploader_display_name: Optional[str] = None, disposition_at: Optional[str] = None, shared_link_permission_options: Optional[List[FileFullSharedLinkPermissionOptionsField]] = None, description: Optional[str] = None, size: Optional[int] = None, path_collection: Optional[FilePathCollectionField] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, created_by: Optional[UserMini] = None, modified_by: Optional[UserMini] = None, owned_by: Optional[UserMini] = None, shared_link: Optional[FileSharedLinkField] = None, parent: Optional[FolderMini] = None, item_status: Optional[FileItemStatusField] = None, sequence_id: Optional[str] = None, name: Optional[str] = None, sha_1: Optional[str] = None, file_version: Optional[FileVersionMini] = None, etag: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: FileBaseTypeField, + version_number: Optional[str] = None, + comment_count: Optional[int] = None, + permissions: Optional[FileFullPermissionsField] = None, + tags: Optional[List[str]] = None, + lock: Optional[FileFullLockField] = None, + extension: Optional[str] = None, + is_package: Optional[bool] = None, + expiring_embed_link: Optional[FileFullExpiringEmbedLinkField] = None, + watermark_info: Optional[FileFullWatermarkInfoField] = None, + is_accessible_via_shared_link: Optional[bool] = None, + allowed_invitee_roles: Optional[List[FileFullAllowedInviteeRolesField]] = None, + is_externally_owned: Optional[bool] = None, + has_collaborations: Optional[bool] = None, + metadata: Optional[FileFullMetadataField] = None, + expires_at: Optional[str] = None, + representations: Optional[FileFullRepresentationsField] = None, + classification: Optional[FileFullClassificationField] = None, + uploader_display_name: Optional[str] = None, + disposition_at: Optional[str] = None, + shared_link_permission_options: Optional[ + List[FileFullSharedLinkPermissionOptionsField] + ] = None, + description: Optional[str] = None, + size: Optional[int] = None, + path_collection: Optional[FilePathCollectionField] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + created_by: Optional[UserMini] = None, + modified_by: Optional[UserMini] = None, + owned_by: Optional[UserMini] = None, + shared_link: Optional[FileSharedLinkField] = None, + parent: Optional[FolderMini] = None, + item_status: Optional[FileItemStatusField] = None, + sequence_id: Optional[str] = None, + name: Optional[str] = None, + sha_1: Optional[str] = None, + file_version: Optional[FileVersionMini] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a file. The ID for any file can be determined @@ -4639,7 +6524,31 @@ def __init__(self, id: str, type: FileBaseTypeField, version_number: Optional[st perform changes on the file if (no) changes have happened. :type etag: Optional[str], optional """ - super().__init__(id=id, type=type, description=description, size=size, path_collection=path_collection, created_at=created_at, modified_at=modified_at, trashed_at=trashed_at, purged_at=purged_at, content_created_at=content_created_at, content_modified_at=content_modified_at, created_by=created_by, modified_by=modified_by, owned_by=owned_by, shared_link=shared_link, parent=parent, item_status=item_status, sequence_id=sequence_id, name=name, sha_1=sha_1, file_version=file_version, etag=etag, **kwargs) + super().__init__( + id=id, + type=type, + description=description, + size=size, + path_collection=path_collection, + created_at=created_at, + modified_at=modified_at, + trashed_at=trashed_at, + purged_at=purged_at, + content_created_at=content_created_at, + content_modified_at=content_modified_at, + created_by=created_by, + modified_by=modified_by, + owned_by=owned_by, + shared_link=shared_link, + parent=parent, + item_status=item_status, + sequence_id=sequence_id, + name=name, + sha_1=sha_1, + file_version=file_version, + etag=etag, + **kwargs + ) self.version_number = version_number self.comment_count = comment_count self.permissions = permissions @@ -4661,8 +6570,14 @@ def __init__(self, id: str, type: FileBaseTypeField, version_number: Optional[st self.disposition_at = disposition_at self.shared_link_permission_options = shared_link_permission_options + class Files(BaseObject): - def __init__(self, total_count: Optional[int] = None, entries: Optional[List[File]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + entries: Optional[List[File]] = None, + **kwargs + ): """ :param total_count: The number of files. :type total_count: Optional[int], optional @@ -4673,11 +6588,20 @@ def __init__(self, total_count: Optional[int] = None, entries: Optional[List[Fil self.total_count = total_count self.entries = entries + class DevicePinnerTypeField(str, Enum): DEVICE_PINNER = 'device_pinner' + class DevicePinner(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[DevicePinnerTypeField] = None, owned_by: Optional[UserMini] = None, product_name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[DevicePinnerTypeField] = None, + owned_by: Optional[UserMini] = None, + product_name: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this device pin. :type id: Optional[str], optional @@ -4692,15 +6616,23 @@ def __init__(self, id: Optional[str] = None, type: Optional[DevicePinnerTypeFiel self.owned_by = owned_by self.product_name = product_name + class DevicePinnersOrderFieldByField(str, Enum): ID = 'id' + class DevicePinnersOrderFieldDirectionField(str, Enum): ASC = 'asc' DESC = 'desc' + class DevicePinnersOrderField(BaseObject): - def __init__(self, by: Optional[DevicePinnersOrderFieldByField] = None, direction: Optional[DevicePinnersOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[DevicePinnersOrderFieldByField] = None, + direction: Optional[DevicePinnersOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field that is ordered by :type by: Optional[DevicePinnersOrderFieldByField], optional @@ -4711,8 +6643,16 @@ def __init__(self, by: Optional[DevicePinnersOrderFieldByField] = None, directio self.by = by self.direction = direction + class DevicePinners(BaseObject): - def __init__(self, entries: Optional[List[DevicePinner]] = None, limit: Optional[int] = None, next_marker: Optional[int] = None, order: Optional[List[DevicePinnersOrderField]] = None, **kwargs): + def __init__( + self, + entries: Optional[List[DevicePinner]] = None, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + order: Optional[List[DevicePinnersOrderField]] = None, + **kwargs + ): """ :param entries: A list of device pins :type entries: Optional[List[DevicePinner]], optional @@ -4731,6 +6671,7 @@ def __init__(self, entries: Optional[List[DevicePinner]] = None, limit: Optional self.next_marker = next_marker self.order = order + class CommentItemField(BaseObject): def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwargs): """ @@ -4743,8 +6684,20 @@ def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwarg self.id = id self.type = type + class Comment(CommentBase): - def __init__(self, is_reply_comment: Optional[bool] = None, message: Optional[str] = None, created_by: Optional[UserMini] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, item: Optional[CommentItemField] = None, id: Optional[str] = None, type: Optional[CommentBaseTypeField] = None, **kwargs): + def __init__( + self, + is_reply_comment: Optional[bool] = None, + message: Optional[str] = None, + created_by: Optional[UserMini] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + item: Optional[CommentItemField] = None, + id: Optional[str] = None, + type: Optional[CommentBaseTypeField] = None, + **kwargs + ): """ :param is_reply_comment: Whether or not this comment is a reply to another comment @@ -4768,8 +6721,21 @@ def __init__(self, is_reply_comment: Optional[bool] = None, message: Optional[st self.modified_at = modified_at self.item = item + class CommentFull(Comment): - def __init__(self, tagged_message: Optional[str] = None, is_reply_comment: Optional[bool] = None, message: Optional[str] = None, created_by: Optional[UserMini] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, item: Optional[CommentItemField] = None, id: Optional[str] = None, type: Optional[CommentBaseTypeField] = None, **kwargs): + def __init__( + self, + tagged_message: Optional[str] = None, + is_reply_comment: Optional[bool] = None, + message: Optional[str] = None, + created_by: Optional[UserMini] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + item: Optional[CommentItemField] = None, + id: Optional[str] = None, + type: Optional[CommentBaseTypeField] = None, + **kwargs + ): """ :param tagged_message: The string representing the comment text with @mentions included. @mention format is @[id:username] @@ -4790,15 +6756,32 @@ def __init__(self, tagged_message: Optional[str] = None, is_reply_comment: Optio :param type: `comment` :type type: Optional[CommentBaseTypeField], optional """ - super().__init__(is_reply_comment=is_reply_comment, message=message, created_by=created_by, created_at=created_at, modified_at=modified_at, item=item, id=id, type=type, **kwargs) + super().__init__( + is_reply_comment=is_reply_comment, + message=message, + created_by=created_by, + created_at=created_at, + modified_at=modified_at, + item=item, + id=id, + type=type, + **kwargs + ) self.tagged_message = tagged_message + class CommentsOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class CommentsOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[CommentsOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[CommentsOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -4809,8 +6792,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[CommentsOrderFi self.by = by self.direction = direction + class Comments(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[CommentsOrderField]] = None, entries: Optional[List[Comment]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[CommentsOrderField]] = None, + entries: Optional[List[Comment]] = None, + **kwargs + ): """ :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 @@ -4841,8 +6833,23 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries -class ShieldInformationBarrierSegmentRestriction(ShieldInformationBarrierSegmentRestrictionMini): - def __init__(self, shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField, restricted_segment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, created_at: Optional[str] = None, created_by: Optional[UserBase] = None, updated_at: Optional[str] = None, updated_by: Optional[UserBase] = None, type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None, id: Optional[str] = None, **kwargs): + +class ShieldInformationBarrierSegmentRestriction( + ShieldInformationBarrierSegmentRestrictionMini +): + def __init__( + self, + shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField, + restricted_segment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField, + shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, + created_at: Optional[str] = None, + created_by: Optional[UserBase] = None, + updated_at: Optional[str] = None, + updated_by: Optional[UserBase] = None, + type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None, + id: Optional[str] = None, + **kwargs + ): """ :param shield_information_barrier_segment: The `type` and `id` of the requested shield information barrier segment. @@ -4864,15 +6871,30 @@ def __init__(self, shield_information_barrier_segment: ShieldInformationBarrierS shield information barrier segment restriction. :type id: Optional[str], optional """ - super().__init__(shield_information_barrier_segment=shield_information_barrier_segment, restricted_segment=restricted_segment, type=type, id=id, **kwargs) + super().__init__( + shield_information_barrier_segment=shield_information_barrier_segment, + restricted_segment=restricted_segment, + type=type, + id=id, + **kwargs + ) self.shield_information_barrier = shield_information_barrier self.created_at = created_at self.created_by = created_by self.updated_at = updated_at self.updated_by = updated_by -class ShieldInformationBarrierSegmentMemberMini(ShieldInformationBarrierSegmentMemberBase): - def __init__(self, user: Optional[UserBase] = None, id: Optional[str] = None, type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None, **kwargs): + +class ShieldInformationBarrierSegmentMemberMini( + ShieldInformationBarrierSegmentMemberBase +): + def __init__( + self, + user: Optional[UserBase] = None, + id: Optional[str] = None, + type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None, + **kwargs + ): """ :param id: The unique identifier for the shield information barrier segment member @@ -4883,11 +6905,24 @@ def __init__(self, user: Optional[UserBase] = None, id: Optional[str] = None, ty super().__init__(id=id, type=type, **kwargs) self.user = user -class ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentFieldTypeField(str, Enum): + +class ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentFieldTypeField( + str, Enum +): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' -class ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentFieldTypeField] = None, **kwargs): + +class ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField( + BaseObject +): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ + ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentFieldTypeField + ] = None, + **kwargs + ): """ :param id: The ID reference of the requesting shield information barrier segment. @@ -4899,8 +6934,23 @@ def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBar self.id = id self.type = type + class ShieldInformationBarrierSegmentMember(ShieldInformationBarrierSegmentMemberMini): - def __init__(self, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, shield_information_barrier_segment: Optional[ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField] = None, created_at: Optional[str] = None, created_by: Optional[UserBase] = None, updated_at: Optional[str] = None, updated_by: Optional[UserBase] = None, user: Optional[UserBase] = None, id: Optional[str] = None, type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None, **kwargs): + def __init__( + self, + shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, + shield_information_barrier_segment: Optional[ + ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField + ] = None, + created_at: Optional[str] = None, + created_by: Optional[UserBase] = None, + updated_at: Optional[str] = None, + updated_by: Optional[UserBase] = None, + user: Optional[UserBase] = None, + id: Optional[str] = None, + type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None, + **kwargs + ): """ :param shield_information_barrier_segment: The `type` and `id` of the requested shield information barrier segment. @@ -4925,11 +6975,25 @@ def __init__(self, shield_information_barrier: Optional[ShieldInformationBarrier self.updated_at = updated_at self.updated_by = updated_by + class ShieldInformationBarrierSegmentTypeField(str, Enum): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' + class ShieldInformationBarrierSegment(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBarrierSegmentTypeField] = None, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, name: Optional[str] = None, description: Optional[str] = None, created_at: Optional[str] = None, created_by: Optional[UserBase] = None, updated_at: Optional[str] = None, updated_by: Optional[UserBase] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ShieldInformationBarrierSegmentTypeField] = None, + shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, + name: Optional[str] = None, + description: Optional[str] = None, + created_at: Optional[str] = None, + created_by: Optional[UserBase] = None, + updated_at: Optional[str] = None, + updated_by: Optional[UserBase] = None, + **kwargs + ): """ :param id: The unique identifier for the shield information barrier segment :type id: Optional[str], optional @@ -4957,9 +7021,11 @@ def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBar self.updated_at = updated_at self.updated_by = updated_by + class ShieldInformationBarrierTypeField(str, Enum): SHIELD_INFORMATION_BARRIER = 'shield_information_barrier' + class ShieldInformationBarrierStatusField(str, Enum): DRAFT = 'draft' PENDING = 'pending' @@ -4967,8 +7033,22 @@ class ShieldInformationBarrierStatusField(str, Enum): ENABLED = 'enabled' INVALID = 'invalid' + class ShieldInformationBarrier(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBarrierTypeField] = None, enterprise: Optional[EnterpriseBase] = None, status: Optional[ShieldInformationBarrierStatusField] = None, created_at: Optional[str] = None, created_by: Optional[UserBase] = None, updated_at: Optional[str] = None, updated_by: Optional[UserBase] = None, enabled_at: Optional[str] = None, enabled_by: Optional[UserBase] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ShieldInformationBarrierTypeField] = None, + enterprise: Optional[EnterpriseBase] = None, + status: Optional[ShieldInformationBarrierStatusField] = None, + created_at: Optional[str] = None, + created_by: Optional[UserBase] = None, + updated_at: Optional[str] = None, + updated_by: Optional[UserBase] = None, + enabled_at: Optional[str] = None, + enabled_by: Optional[UserBase] = None, + **kwargs + ): """ :param id: The unique identifier for the shield information barrier :type id: Optional[str], optional @@ -4996,6 +7076,7 @@ def __init__(self, id: Optional[str] = None, type: Optional[ShieldInformationBar self.enabled_at = enabled_at self.enabled_by = enabled_by + class FolderLockLockedOperationsField(BaseObject): def __init__(self, move: bool, delete: bool, **kwargs): """ @@ -5008,8 +7089,19 @@ def __init__(self, move: bool, delete: bool, **kwargs): self.move = move self.delete = delete + class FolderLock(BaseObject): - def __init__(self, folder: Optional[FolderMini] = None, id: Optional[str] = None, type: Optional[str] = None, created_by: Optional[UserBase] = None, created_at: Optional[str] = None, locked_operations: Optional[FolderLockLockedOperationsField] = None, lock_type: Optional[str] = None, **kwargs): + def __init__( + self, + folder: Optional[FolderMini] = None, + id: Optional[str] = None, + type: Optional[str] = None, + created_by: Optional[UserBase] = None, + created_at: Optional[str] = None, + locked_operations: Optional[FolderLockLockedOperationsField] = None, + lock_type: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this folder lock. :type id: Optional[str], optional @@ -5033,8 +7125,16 @@ def __init__(self, folder: Optional[FolderMini] = None, id: Optional[str] = None self.locked_operations = locked_operations self.lock_type = lock_type + class FolderLocks(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[FolderLock]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[FolderLock]] = 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 @@ -5053,8 +7153,14 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class WatermarkWatermarkField(BaseObject): - def __init__(self, created_at: Optional[str] = None, modified_at: Optional[str] = None, **kwargs): + def __init__( + self, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + **kwargs + ): """ :param created_at: When this watermark was created :type created_at: Optional[str], optional @@ -5065,20 +7171,29 @@ def __init__(self, created_at: Optional[str] = None, modified_at: Optional[str] self.created_at = created_at self.modified_at = modified_at + class Watermark(BaseObject): def __init__(self, watermark: Optional[WatermarkWatermarkField] = None, **kwargs): super().__init__(**kwargs) self.watermark = watermark + class WebhookMiniTypeField(str, Enum): WEBHOOK = 'webhook' + class WebhookMiniTargetFieldTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' + class WebhookMiniTargetField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[WebhookMiniTargetFieldTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[WebhookMiniTargetFieldTypeField] = None, + **kwargs + ): """ :param id: The ID of the item to trigger a webhook :type id: Optional[str], optional @@ -5089,8 +7204,15 @@ def __init__(self, id: Optional[str] = None, type: Optional[WebhookMiniTargetFie self.id = id self.type = type + class WebhookMini(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[WebhookMiniTypeField] = None, target: Optional[WebhookMiniTargetField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[WebhookMiniTypeField] = None, + target: Optional[WebhookMiniTargetField] = None, + **kwargs + ): """ :param id: The unique identifier for this webhook. :type id: Optional[str], optional @@ -5104,8 +7226,16 @@ def __init__(self, id: Optional[str] = None, type: Optional[WebhookMiniTypeField self.type = type self.target = target + class Webhooks(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[WebhookMini]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[WebhookMini]] = 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 @@ -5124,6 +7254,7 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class WebhookTriggersField(str, Enum): FILE_UPLOADED = 'FILE.UPLOADED' FILE_PREVIEWED = 'FILE.PREVIEWED' @@ -5166,8 +7297,19 @@ class WebhookTriggersField(str, Enum): SIGN_REQUEST_EXPIRED = 'SIGN_REQUEST.EXPIRED' SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED' + class Webhook(WebhookMini): - def __init__(self, created_by: Optional[UserMini] = None, created_at: Optional[str] = None, address: Optional[str] = None, triggers: Optional[List[WebhookTriggersField]] = None, id: Optional[str] = None, type: Optional[WebhookMiniTypeField] = None, target: Optional[WebhookMiniTargetField] = None, **kwargs): + def __init__( + self, + created_by: Optional[UserMini] = None, + created_at: Optional[str] = None, + address: Optional[str] = None, + triggers: Optional[List[WebhookTriggersField]] = None, + id: Optional[str] = None, + type: Optional[WebhookMiniTypeField] = None, + target: Optional[WebhookMiniTargetField] = None, + **kwargs + ): """ :param created_at: A timestamp identifying the time that the webhook was created. @@ -5190,11 +7332,15 @@ def __init__(self, created_by: Optional[UserMini] = None, created_at: Optional[s self.address = address self.triggers = triggers + class WebLinkBaseTypeField(str, Enum): WEB_LINK = 'web_link' + class WebLinkBase(BaseObject): - def __init__(self, id: str, type: WebLinkBaseTypeField, etag: Optional[str] = None, **kwargs): + def __init__( + self, id: str, type: WebLinkBaseTypeField, etag: Optional[str] = None, **kwargs + ): """ :param id: The unique identifier for this web link :type id: str @@ -5209,8 +7355,18 @@ def __init__(self, id: str, type: WebLinkBaseTypeField, etag: Optional[str] = No self.type = type self.etag = etag + class WebLinkMini(WebLinkBase): - def __init__(self, id: str, type: WebLinkBaseTypeField, url: Optional[str] = None, sequence_id: Optional[str] = None, name: Optional[str] = None, etag: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: WebLinkBaseTypeField, + url: Optional[str] = None, + sequence_id: Optional[str] = None, + name: Optional[str] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this web link :type id: str @@ -5229,6 +7385,7 @@ def __init__(self, id: str, type: WebLinkBaseTypeField, url: Optional[str] = Non self.sequence_id = sequence_id self.name = name + class WebLinkPathCollectionField(BaseObject): def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): """ @@ -5241,22 +7398,26 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.total_count = total_count self.entries = entries + class WebLinkSharedLinkFieldAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class WebLinkSharedLinkFieldEffectiveAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class WebLinkSharedLinkFieldEffectivePermissionField(str, Enum): CAN_EDIT = 'can_edit' CAN_DOWNLOAD = 'can_download' CAN_PREVIEW = 'can_preview' NO_ACCESS = 'no_access' + class WebLinkSharedLinkFieldPermissionsField(BaseObject): def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwargs): """ @@ -5279,8 +7440,24 @@ def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwar self.can_preview = can_preview self.can_edit = can_edit + class WebLinkSharedLinkField(BaseObject): - def __init__(self, url: str, effective_access: WebLinkSharedLinkFieldEffectiveAccessField, effective_permission: WebLinkSharedLinkFieldEffectivePermissionField, is_password_enabled: bool, download_count: int, preview_count: int, download_url: Optional[str] = None, vanity_url: Optional[str] = None, vanity_name: Optional[str] = None, access: Optional[WebLinkSharedLinkFieldAccessField] = None, unshared_at: Optional[str] = None, permissions: Optional[WebLinkSharedLinkFieldPermissionsField] = None, **kwargs): + def __init__( + self, + url: str, + effective_access: WebLinkSharedLinkFieldEffectiveAccessField, + effective_permission: WebLinkSharedLinkFieldEffectivePermissionField, + is_password_enabled: bool, + download_count: int, + preview_count: int, + download_url: Optional[str] = None, + vanity_url: Optional[str] = None, + vanity_name: Optional[str] = None, + access: Optional[WebLinkSharedLinkFieldAccessField] = None, + unshared_at: Optional[str] = None, + permissions: Optional[WebLinkSharedLinkFieldPermissionsField] = None, + **kwargs + ): """ :param url: The URL that can be used to access the item on Box. This URL will display the item in Box's preview UI where the file @@ -5344,13 +7521,36 @@ def __init__(self, url: str, effective_access: WebLinkSharedLinkFieldEffectiveAc self.unshared_at = unshared_at self.permissions = permissions + class WebLinkItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class WebLink(WebLinkMini): - def __init__(self, id: str, type: WebLinkBaseTypeField, parent: Optional[FolderMini] = None, description: Optional[str] = None, path_collection: Optional[WebLinkPathCollectionField] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, created_by: Optional[UserMini] = None, modified_by: Optional[UserMini] = None, owned_by: Optional[UserMini] = None, shared_link: Optional[WebLinkSharedLinkField] = None, item_status: Optional[WebLinkItemStatusField] = None, url: Optional[str] = None, sequence_id: Optional[str] = None, name: Optional[str] = None, etag: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: WebLinkBaseTypeField, + parent: Optional[FolderMini] = None, + description: Optional[str] = None, + path_collection: Optional[WebLinkPathCollectionField] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + created_by: Optional[UserMini] = None, + modified_by: Optional[UserMini] = None, + owned_by: Optional[UserMini] = None, + shared_link: Optional[WebLinkSharedLinkField] = None, + item_status: Optional[WebLinkItemStatusField] = None, + url: Optional[str] = None, + sequence_id: Optional[str] = None, + name: Optional[str] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this web link :type id: str @@ -5380,7 +7580,15 @@ def __init__(self, id: str, type: WebLinkBaseTypeField, parent: Optional[FolderM headers. :type etag: Optional[str], optional """ - super().__init__(id=id, type=type, url=url, sequence_id=sequence_id, name=name, etag=etag, **kwargs) + super().__init__( + id=id, + type=type, + url=url, + sequence_id=sequence_id, + name=name, + etag=etag, + **kwargs + ) self.parent = parent self.description = description self.path_collection = path_collection @@ -5394,12 +7602,19 @@ def __init__(self, id: str, type: WebLinkBaseTypeField, parent: Optional[FolderM self.shared_link = shared_link self.item_status = item_status + class ItemsOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class ItemsOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[ItemsOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[ItemsOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -5410,8 +7625,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[ItemsOrderField self.by = by self.direction = direction + class Items(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[ItemsOrderField]] = None, entries: Optional[List[Union[FileMini, FolderMini, WebLinkMini]]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[ItemsOrderField]] = None, + entries: Optional[List[Union[FileMini, FolderMini, WebLinkMini]]] = None, + **kwargs + ): """ :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 @@ -5442,6 +7666,7 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries + class FolderPathCollectionField(BaseObject): def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): """ @@ -5454,22 +7679,26 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.total_count = total_count self.entries = entries + class FolderSharedLinkFieldAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class FolderSharedLinkFieldEffectiveAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class FolderSharedLinkFieldEffectivePermissionField(str, Enum): CAN_EDIT = 'can_edit' CAN_DOWNLOAD = 'can_download' CAN_PREVIEW = 'can_preview' NO_ACCESS = 'no_access' + class FolderSharedLinkFieldPermissionsField(BaseObject): def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwargs): """ @@ -5492,8 +7721,24 @@ def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwar self.can_preview = can_preview self.can_edit = can_edit + class FolderSharedLinkField(BaseObject): - def __init__(self, url: str, effective_access: FolderSharedLinkFieldEffectiveAccessField, effective_permission: FolderSharedLinkFieldEffectivePermissionField, is_password_enabled: bool, download_count: int, preview_count: int, download_url: Optional[str] = None, vanity_url: Optional[str] = None, vanity_name: Optional[str] = None, access: Optional[FolderSharedLinkFieldAccessField] = None, unshared_at: Optional[str] = None, permissions: Optional[FolderSharedLinkFieldPermissionsField] = None, **kwargs): + def __init__( + self, + url: str, + effective_access: FolderSharedLinkFieldEffectiveAccessField, + effective_permission: FolderSharedLinkFieldEffectivePermissionField, + is_password_enabled: bool, + download_count: int, + preview_count: int, + download_url: Optional[str] = None, + vanity_url: Optional[str] = None, + vanity_name: Optional[str] = None, + access: Optional[FolderSharedLinkFieldAccessField] = None, + unshared_at: Optional[str] = None, + permissions: Optional[FolderSharedLinkFieldPermissionsField] = None, + **kwargs + ): """ :param url: The URL that can be used to access the item on Box. This URL will display the item in Box's preview UI where the file @@ -5557,12 +7802,19 @@ def __init__(self, url: str, effective_access: FolderSharedLinkFieldEffectiveAcc self.unshared_at = unshared_at self.permissions = permissions + class FolderFolderUploadEmailFieldAccessField(str, Enum): OPEN = 'open' COLLABORATORS = 'collaborators' + class FolderFolderUploadEmailField(BaseObject): - def __init__(self, access: Optional[FolderFolderUploadEmailFieldAccessField] = None, email: Optional[str] = None, **kwargs): + def __init__( + self, + access: Optional[FolderFolderUploadEmailFieldAccessField] = None, + email: Optional[str] = None, + **kwargs + ): """ :param access: When this parameter has been set, users can email files to the email address that has been automatically @@ -5582,13 +7834,40 @@ def __init__(self, access: Optional[FolderFolderUploadEmailFieldAccessField] = N self.access = access self.email = email + class FolderItemStatusField(str, Enum): ACTIVE = 'active' TRASHED = 'trashed' DELETED = 'deleted' + class Folder(FolderMini): - def __init__(self, id: str, type: FolderBaseTypeField, created_at: Optional[str] = None, modified_at: Optional[str] = None, description: Optional[str] = None, size: Optional[int] = None, path_collection: Optional[FolderPathCollectionField] = None, created_by: Optional[UserMini] = None, modified_by: Optional[UserMini] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, owned_by: Optional[UserMini] = None, shared_link: Optional[FolderSharedLinkField] = None, folder_upload_email: Optional[FolderFolderUploadEmailField] = None, parent: Optional[FolderMini] = None, item_status: Optional[FolderItemStatusField] = None, item_collection: Optional[Items] = None, name: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: FolderBaseTypeField, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + description: Optional[str] = None, + size: Optional[int] = None, + path_collection: Optional[FolderPathCollectionField] = None, + created_by: Optional[UserMini] = None, + modified_by: Optional[UserMini] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + owned_by: Optional[UserMini] = None, + shared_link: Optional[FolderSharedLinkField] = None, + folder_upload_email: Optional[FolderFolderUploadEmailField] = None, + parent: Optional[FolderMini] = None, + item_status: Optional[FolderItemStatusField] = None, + item_collection: Optional[Items] = None, + name: Optional[str] = None, + sequence_id: Optional[str] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a folder. The ID for any folder can be determined @@ -5645,7 +7924,9 @@ def __init__(self, id: str, type: FolderBaseTypeField, created_at: Optional[str] perform changes on the folder if (no) changes have happened. :type etag: Optional[str], optional """ - super().__init__(id=id, type=type, name=name, sequence_id=sequence_id, etag=etag, **kwargs) + super().__init__( + id=id, type=type, name=name, sequence_id=sequence_id, etag=etag, **kwargs + ) self.created_at = created_at self.modified_at = modified_at self.description = description @@ -5664,8 +7945,15 @@ def __init__(self, id: str, type: FolderBaseTypeField, created_at: Optional[str] self.item_status = item_status self.item_collection = item_collection + class SearchResultWithSharedLink(BaseObject): - def __init__(self, accessible_via_shared_link: Optional[str] = None, item: Optional[Union[File, Folder, WebLink]] = None, type: Optional[str] = None, **kwargs): + def __init__( + self, + accessible_via_shared_link: Optional[str] = None, + item: Optional[Union[File, Folder, WebLink]] = None, + type: Optional[str] = None, + **kwargs + ): """ :param accessible_via_shared_link: The optional shared link through which the user has access to this item. This value is only returned for items for which the user has @@ -5680,11 +7968,21 @@ def __init__(self, accessible_via_shared_link: Optional[str] = None, item: Optio self.item = item self.type = type + class SearchResultsWithSharedLinksTypeField(str, Enum): SEARCH_RESULTS_WITH_SHARED_LINKS = 'search_results_with_shared_links' + class SearchResultsWithSharedLinks(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, type: Optional[SearchResultsWithSharedLinksTypeField] = None, entries: Optional[List[SearchResultWithSharedLink]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + type: Optional[SearchResultsWithSharedLinksTypeField] = None, + entries: Optional[List[SearchResultWithSharedLink]] = None, + **kwargs + ): """ :param total_count: One greater than the offset of the last entry in the search results. The total number of entries in the collection may be less than @@ -5711,11 +8009,21 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.type = type self.entries = entries + class SearchResultsTypeField(str, Enum): SEARCH_RESULTS_ITEMS = 'search_results_items' + class SearchResults(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, type: Optional[SearchResultsTypeField] = None, entries: Optional[List[Union[File, Folder, WebLink]]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + type: Optional[SearchResultsTypeField] = None, + entries: Optional[List[Union[File, Folder, WebLink]]] = None, + **kwargs + ): """ :param total_count: One greater than the offset of the last entry in the search results. The total number of entries in the collection may be less than @@ -5740,6 +8048,7 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.type = type self.entries = entries + class RecentItemInteractionTypeField(str, Enum): ITEM_PREVIEW = 'item_preview' ITEM_UPLOAD = 'item_upload' @@ -5747,8 +8056,17 @@ class RecentItemInteractionTypeField(str, Enum): ITEM_OPEN = 'item_open' ITEM_MODIFY = 'item_modify' + class RecentItem(BaseObject): - def __init__(self, type: Optional[str] = None, item: Optional[Union[File, Folder, WebLink]] = None, interaction_type: Optional[RecentItemInteractionTypeField] = None, interacted_at: Optional[str] = None, interaction_shared_link: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[str] = None, + item: Optional[Union[File, Folder, WebLink]] = None, + interaction_type: Optional[RecentItemInteractionTypeField] = None, + interacted_at: Optional[str] = None, + interaction_shared_link: Optional[str] = None, + **kwargs + ): """ :param type: `recent_item` :type type: Optional[str], optional @@ -5768,8 +8086,16 @@ def __init__(self, type: Optional[str] = None, item: Optional[Union[File, Folder self.interacted_at = interacted_at self.interaction_shared_link = interaction_shared_link + class RecentItems(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[RecentItem]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[RecentItem]] = 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 @@ -5788,8 +8114,15 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class MetadataQueryResults(BaseObject): - def __init__(self, entries: Optional[List[Union[File, Folder]]] = None, limit: Optional[int] = None, next_marker: Optional[str] = None, **kwargs): + def __init__( + self, + entries: Optional[List[Union[File, Folder]]] = None, + limit: Optional[int] = None, + next_marker: Optional[str] = None, + **kwargs + ): """ :param entries: The mini representation of the files and folders that match the search terms. @@ -5809,8 +8142,19 @@ def __init__(self, entries: Optional[List[Union[File, Folder]]] = None, limit: O self.limit = limit self.next_marker = next_marker + class LegalHoldPolicyAssignment(LegalHoldPolicyAssignmentBase): - def __init__(self, legal_hold_policy: Optional[LegalHoldPolicyMini] = None, assigned_to: Optional[Union[File, Folder, WebLink]] = None, assigned_by: Optional[UserMini] = None, assigned_at: Optional[str] = None, deleted_at: Optional[str] = None, id: Optional[str] = None, type: Optional[LegalHoldPolicyAssignmentBaseTypeField] = None, **kwargs): + def __init__( + self, + legal_hold_policy: Optional[LegalHoldPolicyMini] = None, + assigned_to: Optional[Union[File, Folder, WebLink]] = None, + assigned_by: Optional[UserMini] = None, + assigned_at: Optional[str] = None, + deleted_at: Optional[str] = None, + id: Optional[str] = None, + type: Optional[LegalHoldPolicyAssignmentBaseTypeField] = None, + **kwargs + ): """ :param assigned_at: When the legal hold policy assignment object was created @@ -5833,11 +8177,22 @@ def __init__(self, legal_hold_policy: Optional[LegalHoldPolicyMini] = None, assi self.assigned_at = assigned_at self.deleted_at = deleted_at + class FileVersionLegalHoldTypeField(str, Enum): FILE_VERSION_LEGAL_HOLD = 'file_version_legal_hold' + class FileVersionLegalHold(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[FileVersionLegalHoldTypeField] = None, file_version: Optional[FileVersionMini] = None, file: Optional[FileMini] = None, legal_hold_policy_assignments: Optional[List[LegalHoldPolicyAssignment]] = None, deleted_at: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[FileVersionLegalHoldTypeField] = None, + file_version: Optional[FileVersionMini] = None, + file: Optional[FileMini] = None, + legal_hold_policy_assignments: Optional[List[LegalHoldPolicyAssignment]] = None, + deleted_at: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this file version legal hold :type id: Optional[str], optional @@ -5857,8 +8212,16 @@ def __init__(self, id: Optional[str] = None, type: Optional[FileVersionLegalHold self.legal_hold_policy_assignments = legal_hold_policy_assignments self.deleted_at = deleted_at + class FileVersionLegalHolds(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[FileVersionLegalHold]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[FileVersionLegalHold]] = 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 @@ -5877,13 +8240,25 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class FolderFullSyncStateField(str, Enum): SYNCED = 'synced' NOT_SYNCED = 'not_synced' PARTIALLY_SYNCED = 'partially_synced' + class FolderFullPermissionsField(BaseObject): - def __init__(self, can_delete: bool, can_download: bool, can_invite_collaborator: bool, can_rename: bool, can_set_share_access: bool, can_share: bool, can_upload: Optional[bool] = None, **kwargs): + def __init__( + self, + can_delete: bool, + can_download: bool, + can_invite_collaborator: bool, + can_rename: bool, + can_set_share_access: bool, + can_share: bool, + can_upload: Optional[bool] = None, + **kwargs + ): """ :param can_delete: Specifies if the current user can delete this item. :type can_delete: bool @@ -5913,18 +8288,30 @@ def __init__(self, can_delete: bool, can_download: bool, can_invite_collaborator self.can_share = can_share self.can_upload = can_upload + class FolderFullMetadataField(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'extra_data': 'extraData', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'extraData': 'extra_data', **BaseObject._json_to_fields_mapping} - def __init__(self, extra_data: Optional[Dict[str, Dict[str, Metadata]]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'extra_data': 'extraData', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'extraData': 'extra_data', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, extra_data: Optional[Dict[str, Dict[str, Metadata]]] = None, **kwargs + ): super().__init__(**kwargs) self.extra_data = extra_data + class FolderFullAllowedSharedLinkAccessLevelsField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' + class FolderFullAllowedInviteeRolesField(str, Enum): EDITOR = 'editor' VIEWER = 'viewer' @@ -5934,6 +8321,7 @@ class FolderFullAllowedInviteeRolesField(str, Enum): VIEWER_UPLOADER = 'viewer uploader' CO_OWNER = 'co-owner' + class FolderFullWatermarkInfoField(BaseObject): def __init__(self, is_watermarked: Optional[bool] = None, **kwargs): """ @@ -5943,8 +8331,15 @@ def __init__(self, is_watermarked: Optional[bool] = None, **kwargs): super().__init__(**kwargs) self.is_watermarked = is_watermarked + class FolderFullClassificationField(BaseObject): - def __init__(self, name: Optional[str] = None, definition: Optional[str] = None, color: Optional[str] = None, **kwargs): + def __init__( + self, + name: Optional[str] = None, + definition: Optional[str] = None, + color: Optional[str] = None, + **kwargs + ): """ :param name: The name of the classification :type name: Optional[str], optional @@ -5960,8 +8355,52 @@ def __init__(self, name: Optional[str] = None, definition: Optional[str] = None, self.definition = definition self.color = color + class FolderFull(Folder): - def __init__(self, id: str, type: FolderBaseTypeField, sync_state: Optional[FolderFullSyncStateField] = None, has_collaborations: Optional[bool] = None, permissions: Optional[FolderFullPermissionsField] = None, tags: Optional[List[str]] = None, can_non_owners_invite: Optional[bool] = None, is_externally_owned: Optional[bool] = None, metadata: Optional[FolderFullMetadataField] = None, is_collaboration_restricted_to_enterprise: Optional[bool] = None, allowed_shared_link_access_levels: Optional[List[FolderFullAllowedSharedLinkAccessLevelsField]] = None, allowed_invitee_roles: Optional[List[FolderFullAllowedInviteeRolesField]] = None, watermark_info: Optional[FolderFullWatermarkInfoField] = None, is_accessible_via_shared_link: Optional[bool] = None, can_non_owners_view_collaborators: Optional[bool] = None, classification: Optional[FolderFullClassificationField] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, description: Optional[str] = None, size: Optional[int] = None, path_collection: Optional[FolderPathCollectionField] = None, created_by: Optional[UserMini] = None, modified_by: Optional[UserMini] = None, trashed_at: Optional[str] = None, purged_at: Optional[str] = None, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, owned_by: Optional[UserMini] = None, shared_link: Optional[FolderSharedLinkField] = None, folder_upload_email: Optional[FolderFolderUploadEmailField] = None, parent: Optional[FolderMini] = None, item_status: Optional[FolderItemStatusField] = None, item_collection: Optional[Items] = None, name: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, **kwargs): + def __init__( + self, + id: str, + type: FolderBaseTypeField, + sync_state: Optional[FolderFullSyncStateField] = None, + has_collaborations: Optional[bool] = None, + permissions: Optional[FolderFullPermissionsField] = None, + tags: Optional[List[str]] = None, + can_non_owners_invite: Optional[bool] = None, + is_externally_owned: Optional[bool] = None, + metadata: Optional[FolderFullMetadataField] = None, + is_collaboration_restricted_to_enterprise: Optional[bool] = None, + allowed_shared_link_access_levels: Optional[ + List[FolderFullAllowedSharedLinkAccessLevelsField] + ] = None, + allowed_invitee_roles: Optional[ + List[FolderFullAllowedInviteeRolesField] + ] = None, + watermark_info: Optional[FolderFullWatermarkInfoField] = None, + is_accessible_via_shared_link: Optional[bool] = None, + can_non_owners_view_collaborators: Optional[bool] = None, + classification: Optional[FolderFullClassificationField] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + description: Optional[str] = None, + size: Optional[int] = None, + path_collection: Optional[FolderPathCollectionField] = None, + created_by: Optional[UserMini] = None, + modified_by: Optional[UserMini] = None, + trashed_at: Optional[str] = None, + purged_at: Optional[str] = None, + content_created_at: Optional[str] = None, + content_modified_at: Optional[str] = None, + owned_by: Optional[UserMini] = None, + shared_link: Optional[FolderSharedLinkField] = None, + folder_upload_email: Optional[FolderFolderUploadEmailField] = None, + parent: Optional[FolderMini] = None, + item_status: Optional[FolderItemStatusField] = None, + item_collection: Optional[Items] = None, + name: Optional[str] = None, + sequence_id: Optional[str] = None, + etag: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier that represent a folder. The ID for any folder can be determined @@ -6041,7 +8480,31 @@ def __init__(self, id: str, type: FolderBaseTypeField, sync_state: Optional[Fold perform changes on the folder if (no) changes have happened. :type etag: Optional[str], optional """ - super().__init__(id=id, type=type, created_at=created_at, modified_at=modified_at, description=description, size=size, path_collection=path_collection, created_by=created_by, modified_by=modified_by, trashed_at=trashed_at, purged_at=purged_at, content_created_at=content_created_at, content_modified_at=content_modified_at, owned_by=owned_by, shared_link=shared_link, folder_upload_email=folder_upload_email, parent=parent, item_status=item_status, item_collection=item_collection, name=name, sequence_id=sequence_id, etag=etag, **kwargs) + super().__init__( + id=id, + type=type, + created_at=created_at, + modified_at=modified_at, + description=description, + size=size, + path_collection=path_collection, + created_by=created_by, + modified_by=modified_by, + trashed_at=trashed_at, + purged_at=purged_at, + content_created_at=content_created_at, + content_modified_at=content_modified_at, + owned_by=owned_by, + shared_link=shared_link, + folder_upload_email=folder_upload_email, + parent=parent, + item_status=item_status, + item_collection=item_collection, + name=name, + sequence_id=sequence_id, + etag=etag, + **kwargs + ) self.sync_state = sync_state self.has_collaborations = has_collaborations self.permissions = permissions @@ -6049,7 +8512,9 @@ def __init__(self, id: str, type: FolderBaseTypeField, sync_state: Optional[Fold self.can_non_owners_invite = can_non_owners_invite self.is_externally_owned = is_externally_owned self.metadata = metadata - self.is_collaboration_restricted_to_enterprise = is_collaboration_restricted_to_enterprise + self.is_collaboration_restricted_to_enterprise = ( + is_collaboration_restricted_to_enterprise + ) self.allowed_shared_link_access_levels = allowed_shared_link_access_levels self.allowed_invitee_roles = allowed_invitee_roles self.watermark_info = watermark_info @@ -6057,6 +8522,7 @@ def __init__(self, id: str, type: FolderBaseTypeField, sync_state: Optional[Fold self.can_non_owners_view_collaborators = can_non_owners_view_collaborators self.classification = classification + class EventEventTypeField(str, Enum): ACCESS_GRANTED = 'ACCESS_GRANTED' ACCESS_REVOKED = 'ACCESS_REVOKED' @@ -6080,12 +8546,18 @@ class EventEventTypeField(str, Enum): COMMENT_CREATE = 'COMMENT_CREATE' COMMENT_DELETE = 'COMMENT_DELETE' CONTENT_ACCESS = 'CONTENT_ACCESS' - CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY = 'CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY' + CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY = ( + 'CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY' + ) CONTENT_WORKFLOW_AUTOMATION_ADD = 'CONTENT_WORKFLOW_AUTOMATION_ADD' CONTENT_WORKFLOW_AUTOMATION_DELETE = 'CONTENT_WORKFLOW_AUTOMATION_DELETE' CONTENT_WORKFLOW_POLICY_ADD = 'CONTENT_WORKFLOW_POLICY_ADD' - CONTENT_WORKFLOW_SHARING_POLICY_VIOLATION = 'CONTENT_WORKFLOW_SHARING_POLICY_VIOLATION' - CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION = 'CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION' + CONTENT_WORKFLOW_SHARING_POLICY_VIOLATION = ( + 'CONTENT_WORKFLOW_SHARING_POLICY_VIOLATION' + ) + CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION = ( + 'CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION' + ) COPY = 'COPY' DATA_RETENTION_CREATE_RETENTION = 'DATA_RETENTION_CREATE_RETENTION' DATA_RETENTION_REMOVE_RETENTION = 'DATA_RETENTION_REMOVE_RETENTION' @@ -6155,13 +8627,21 @@ class EventEventTypeField(str, Enum): SHARE_EXPIRATION = 'SHARE_EXPIRATION' SHIELD_ALERT = 'SHIELD_ALERT' SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED = 'SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED' - SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED_MISSING_JUSTIFICATION = 'SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED_MISSING_JUSTIFICATION' + SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED_MISSING_JUSTIFICATION = ( + 'SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED_MISSING_JUSTIFICATION' + ) SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED = 'SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED' - SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED_MISSING_JUSTIFICATION = 'SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED_MISSING_JUSTIFICATION' + SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED_MISSING_JUSTIFICATION = ( + 'SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED_MISSING_JUSTIFICATION' + ) SHIELD_JUSTIFICATION_APPROVAL = 'SHIELD_JUSTIFICATION_APPROVAL' SHIELD_SHARED_LINK_ACCESS_BLOCKED = 'SHIELD_SHARED_LINK_ACCESS_BLOCKED' - SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_CREATE = 'SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_CREATE' - SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_UPDATE = 'SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_UPDATE' + SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_CREATE = ( + 'SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_CREATE' + ) + SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_UPDATE = ( + 'SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_UPDATE' + ) SIGN_DOCUMENT_ASSIGNED = 'SIGN_DOCUMENT_ASSIGNED' SIGN_DOCUMENT_CANCELLED = 'SIGN_DOCUMENT_CANCELLED' SIGN_DOCUMENT_COMPLETED = 'SIGN_DOCUMENT_COMPLETED' @@ -6188,16 +8668,32 @@ class EventEventTypeField(str, Enum): UPDATE_COLLABORATION_EXPIRATION = 'UPDATE_COLLABORATION_EXPIRATION' UPDATE_SHARE_EXPIRATION = 'UPDATE_SHARE_EXPIRATION' UPLOAD = 'UPLOAD' - USER_AUTHENTICATE_OAUTH2_ACCESS_TOKEN_CREATE = 'USER_AUTHENTICATE_OAUTH2_ACCESS_TOKEN_CREATE' + USER_AUTHENTICATE_OAUTH2_ACCESS_TOKEN_CREATE = ( + 'USER_AUTHENTICATE_OAUTH2_ACCESS_TOKEN_CREATE' + ) WATERMARK_LABEL_CREATE = 'WATERMARK_LABEL_CREATE' WATERMARK_LABEL_DELETE = 'WATERMARK_LABEL_DELETE' + class EventAdditionalDetailsField(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) + class Event(BaseObject): - def __init__(self, type: Optional[str] = None, created_at: Optional[str] = None, recorded_at: Optional[str] = None, event_id: Optional[str] = None, created_by: Optional[UserMini] = None, event_type: Optional[EventEventTypeField] = None, session_id: Optional[str] = None, source: Optional[Union[User, EventSource, File, Folder]] = None, additional_details: Optional[EventAdditionalDetailsField] = None, **kwargs): + def __init__( + self, + type: Optional[str] = None, + created_at: Optional[str] = None, + recorded_at: Optional[str] = None, + event_id: Optional[str] = None, + created_by: Optional[UserMini] = None, + event_type: Optional[EventEventTypeField] = None, + session_id: Optional[str] = None, + source: Optional[Union[User, EventSource, File, Folder]] = None, + additional_details: Optional[EventAdditionalDetailsField] = None, + **kwargs + ): """ :param type: `event` :type type: Optional[str], optional @@ -6228,8 +8724,15 @@ def __init__(self, type: Optional[str] = None, created_at: Optional[str] = None, self.source = source self.additional_details = additional_details + class Events(BaseObject): - def __init__(self, chunk_size: Optional[int] = None, next_stream_position: Optional[str] = None, entries: Optional[List[Event]] = None, **kwargs): + def __init__( + self, + chunk_size: Optional[int] = None, + next_stream_position: Optional[str] = None, + entries: Optional[List[Event]] = None, + **kwargs + ): """ :param chunk_size: The number of events returned in this response. :type chunk_size: Optional[int], optional @@ -6244,14 +8747,24 @@ def __init__(self, chunk_size: Optional[int] = None, next_stream_position: Optio self.next_stream_position = next_stream_position self.entries = entries + class SkillInvocationTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' + class SkillInvocationSkillFieldTypeField(str, Enum): SKILL = 'skill' + class SkillInvocationSkillField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[SkillInvocationSkillFieldTypeField] = None, name: Optional[str] = None, api_key: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[SkillInvocationSkillFieldTypeField] = None, + name: Optional[str] = None, + api_key: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this skill :type id: Optional[str], optional @@ -6268,11 +8781,20 @@ def __init__(self, id: Optional[str] = None, type: Optional[SkillInvocationSkill self.name = name self.api_key = api_key + class SkillInvocationTokenFieldReadFieldTokenTypeField(str, Enum): BEARER = 'bearer' + class SkillInvocationTokenFieldReadField(BaseObject): - def __init__(self, access_token: Optional[str] = None, expires_in: Optional[int] = None, token_type: Optional[SkillInvocationTokenFieldReadFieldTokenTypeField] = None, restricted_to: Optional[str] = None, **kwargs): + def __init__( + self, + access_token: Optional[str] = None, + expires_in: Optional[int] = None, + token_type: Optional[SkillInvocationTokenFieldReadFieldTokenTypeField] = None, + restricted_to: Optional[str] = None, + **kwargs + ): """ :param access_token: The requested access token. :type access_token: Optional[str], optional @@ -6291,11 +8813,20 @@ def __init__(self, access_token: Optional[str] = None, expires_in: Optional[int] self.token_type = token_type self.restricted_to = restricted_to + class SkillInvocationTokenFieldWriteFieldTokenTypeField(str, Enum): BEARER = 'bearer' + class SkillInvocationTokenFieldWriteField(BaseObject): - def __init__(self, access_token: Optional[str] = None, expires_in: Optional[int] = None, token_type: Optional[SkillInvocationTokenFieldWriteFieldTokenTypeField] = None, restricted_to: Optional[str] = None, **kwargs): + def __init__( + self, + access_token: Optional[str] = None, + expires_in: Optional[int] = None, + token_type: Optional[SkillInvocationTokenFieldWriteFieldTokenTypeField] = None, + restricted_to: Optional[str] = None, + **kwargs + ): """ :param access_token: The requested access token. :type access_token: Optional[str], optional @@ -6314,8 +8845,14 @@ def __init__(self, access_token: Optional[str] = None, expires_in: Optional[int] self.token_type = token_type self.restricted_to = restricted_to + class SkillInvocationTokenField(BaseObject): - def __init__(self, read: Optional[SkillInvocationTokenFieldReadField] = None, write: Optional[SkillInvocationTokenFieldWriteField] = None, **kwargs): + def __init__( + self, + read: Optional[SkillInvocationTokenFieldReadField] = None, + write: Optional[SkillInvocationTokenFieldWriteField] = None, + **kwargs + ): """ :param read: The basics of an access token :type read: Optional[SkillInvocationTokenFieldReadField], optional @@ -6326,6 +8863,7 @@ def __init__(self, read: Optional[SkillInvocationTokenFieldReadField] = None, wr self.read = read self.write = write + class SkillInvocationStatusFieldStateField(str, Enum): INVOKED = 'invoked' PROCESSING = 'processing' @@ -6333,8 +8871,16 @@ class SkillInvocationStatusFieldStateField(str, Enum): TRANSIENT_FAILURE = 'transient_failure' PERMANENT_FAILURE = 'permanent_failure' + class SkillInvocationStatusField(BaseObject): - def __init__(self, state: Optional[SkillInvocationStatusFieldStateField] = None, message: Optional[str] = None, error_code: Optional[str] = None, additional_info: Optional[str] = None, **kwargs): + def __init__( + self, + state: Optional[SkillInvocationStatusFieldStateField] = None, + message: Optional[str] = None, + error_code: Optional[str] = None, + additional_info: Optional[str] = None, + **kwargs + ): """ :param state: The state of this event. * `invoked` - Triggered the skill with event details to start @@ -6359,11 +8905,19 @@ def __init__(self, state: Optional[SkillInvocationStatusFieldStateField] = None, self.error_code = error_code self.additional_info = additional_info + class SkillInvocationEnterpriseFieldTypeField(str, Enum): ENTERPRISE = 'enterprise' + class SkillInvocationEnterpriseField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[SkillInvocationEnterpriseFieldTypeField] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[SkillInvocationEnterpriseFieldTypeField] = None, + name: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this enterprise. :type id: Optional[str], optional @@ -6377,8 +8931,22 @@ def __init__(self, id: Optional[str] = None, type: Optional[SkillInvocationEnter self.type = type self.name = name + class SkillInvocation(BaseObject): - def __init__(self, type: Optional[SkillInvocationTypeField] = None, id: Optional[str] = None, skill: Optional[SkillInvocationSkillField] = None, token: Optional[SkillInvocationTokenField] = None, status: Optional[SkillInvocationStatusField] = None, created_at: Optional[str] = None, trigger: Optional[str] = None, enterprise: Optional[SkillInvocationEnterpriseField] = None, source: Optional[Union[File, Folder]] = None, event: Optional[Event] = None, **kwargs): + def __init__( + self, + type: Optional[SkillInvocationTypeField] = None, + id: Optional[str] = None, + skill: Optional[SkillInvocationSkillField] = None, + token: Optional[SkillInvocationTokenField] = None, + status: Optional[SkillInvocationStatusField] = None, + created_at: Optional[str] = None, + trigger: Optional[str] = None, + enterprise: Optional[SkillInvocationEnterpriseField] = None, + source: Optional[Union[File, Folder]] = None, + event: Optional[Event] = None, + **kwargs + ): """ :param type: `skill_invocation` :type type: Optional[SkillInvocationTypeField], optional @@ -6405,9 +8973,11 @@ def __init__(self, type: Optional[SkillInvocationTypeField] = None, id: Optional self.source = source self.event = event + class CollaborationTypeField(str, Enum): COLLABORATION = 'collaboration' + class CollaborationRoleField(str, Enum): EDITOR = 'editor' VIEWER = 'viewer' @@ -6418,13 +8988,22 @@ class CollaborationRoleField(str, Enum): CO_OWNER = 'co-owner' OWNER = 'owner' + class CollaborationStatusField(str, Enum): ACCEPTED = 'accepted' PENDING = 'pending' REJECTED = 'rejected' -class CollaborationAcceptanceRequirementsStatusFieldTermsOfServiceRequirementField(BaseObject): - def __init__(self, is_accepted: Optional[bool] = None, terms_of_service: Optional[TermsOfServiceBase] = None, **kwargs): + +class CollaborationAcceptanceRequirementsStatusFieldTermsOfServiceRequirementField( + BaseObject +): + def __init__( + self, + is_accepted: Optional[bool] = None, + terms_of_service: Optional[TermsOfServiceBase] = None, + **kwargs + ): """ :param is_accepted: Whether or not the terms of service have been accepted. The field is `null` when there is no terms of service required. @@ -6434,8 +9013,18 @@ def __init__(self, is_accepted: Optional[bool] = None, terms_of_service: Optiona self.is_accepted = is_accepted self.terms_of_service = terms_of_service -class CollaborationAcceptanceRequirementsStatusFieldStrongPasswordRequirementField(BaseObject): - def __init__(self, enterprise_has_strong_password_required_for_external_users: Optional[bool] = None, user_has_strong_password: Optional[bool] = None, **kwargs): + +class CollaborationAcceptanceRequirementsStatusFieldStrongPasswordRequirementField( + BaseObject +): + def __init__( + self, + enterprise_has_strong_password_required_for_external_users: Optional[ + bool + ] = None, + user_has_strong_password: Optional[bool] = None, + **kwargs + ): """ :param enterprise_has_strong_password_required_for_external_users: Whether or not the enterprise that owns the content requires a strong password to collaborate on the content. @@ -6446,11 +9035,21 @@ def __init__(self, enterprise_has_strong_password_required_for_external_users: O :type user_has_strong_password: Optional[bool], optional """ super().__init__(**kwargs) - self.enterprise_has_strong_password_required_for_external_users = enterprise_has_strong_password_required_for_external_users + self.enterprise_has_strong_password_required_for_external_users = ( + enterprise_has_strong_password_required_for_external_users + ) self.user_has_strong_password = user_has_strong_password -class CollaborationAcceptanceRequirementsStatusFieldTwoFactorAuthenticationRequirementField(BaseObject): - def __init__(self, enterprise_has_two_factor_auth_enabled: Optional[bool] = None, user_has_two_factor_authentication_enabled: Optional[bool] = None, **kwargs): + +class CollaborationAcceptanceRequirementsStatusFieldTwoFactorAuthenticationRequirementField( + BaseObject +): + def __init__( + self, + enterprise_has_two_factor_auth_enabled: Optional[bool] = None, + user_has_two_factor_authentication_enabled: Optional[bool] = None, + **kwargs + ): """ :param enterprise_has_two_factor_auth_enabled: Whether or not the enterprise that owns the content requires two-factor authentication to be enabled in order to @@ -6462,18 +9061,56 @@ def __init__(self, enterprise_has_two_factor_auth_enabled: Optional[bool] = None :type user_has_two_factor_authentication_enabled: Optional[bool], optional """ super().__init__(**kwargs) - self.enterprise_has_two_factor_auth_enabled = enterprise_has_two_factor_auth_enabled - self.user_has_two_factor_authentication_enabled = user_has_two_factor_authentication_enabled + self.enterprise_has_two_factor_auth_enabled = ( + enterprise_has_two_factor_auth_enabled + ) + self.user_has_two_factor_authentication_enabled = ( + user_has_two_factor_authentication_enabled + ) + class CollaborationAcceptanceRequirementsStatusField(BaseObject): - def __init__(self, terms_of_service_requirement: Optional[CollaborationAcceptanceRequirementsStatusFieldTermsOfServiceRequirementField] = None, strong_password_requirement: Optional[CollaborationAcceptanceRequirementsStatusFieldStrongPasswordRequirementField] = None, two_factor_authentication_requirement: Optional[CollaborationAcceptanceRequirementsStatusFieldTwoFactorAuthenticationRequirementField] = None, **kwargs): + def __init__( + self, + terms_of_service_requirement: Optional[ + CollaborationAcceptanceRequirementsStatusFieldTermsOfServiceRequirementField + ] = None, + strong_password_requirement: Optional[ + CollaborationAcceptanceRequirementsStatusFieldStrongPasswordRequirementField + ] = None, + two_factor_authentication_requirement: Optional[ + CollaborationAcceptanceRequirementsStatusFieldTwoFactorAuthenticationRequirementField + ] = None, + **kwargs + ): super().__init__(**kwargs) self.terms_of_service_requirement = terms_of_service_requirement self.strong_password_requirement = strong_password_requirement - self.two_factor_authentication_requirement = two_factor_authentication_requirement + self.two_factor_authentication_requirement = ( + two_factor_authentication_requirement + ) + class Collaboration(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[CollaborationTypeField] = None, item: Optional[Union[File, Folder, WebLink]] = None, accessible_by: Optional[UserCollaborations] = None, invite_email: Optional[str] = None, role: Optional[CollaborationRoleField] = None, expires_at: Optional[str] = None, status: Optional[CollaborationStatusField] = None, acknowledged_at: Optional[str] = None, created_by: Optional[UserCollaborations] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, acceptance_requirements_status: Optional[CollaborationAcceptanceRequirementsStatusField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[CollaborationTypeField] = None, + item: Optional[Union[File, Folder, WebLink]] = None, + accessible_by: Optional[UserCollaborations] = None, + invite_email: Optional[str] = None, + role: Optional[CollaborationRoleField] = None, + expires_at: Optional[str] = None, + status: Optional[CollaborationStatusField] = None, + acknowledged_at: Optional[str] = None, + created_by: Optional[UserCollaborations] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + acceptance_requirements_status: Optional[ + CollaborationAcceptanceRequirementsStatusField + ] = None, + **kwargs + ): """ :param id: The unique identifier for this collaboration. :type id: Optional[str], optional @@ -6513,12 +9150,19 @@ def __init__(self, id: Optional[str] = None, type: Optional[CollaborationTypeFie self.modified_at = modified_at self.acceptance_requirements_status = acceptance_requirements_status + class CollaborationsOrderFieldDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' + class CollaborationsOrderField(BaseObject): - def __init__(self, by: Optional[str] = None, direction: Optional[CollaborationsOrderFieldDirectionField] = None, **kwargs): + def __init__( + self, + by: Optional[str] = None, + direction: Optional[CollaborationsOrderFieldDirectionField] = None, + **kwargs + ): """ :param by: The field to order by :type by: Optional[str], optional @@ -6529,8 +9173,17 @@ def __init__(self, by: Optional[str] = None, direction: Optional[CollaborationsO self.by = by self.direction = direction + class Collaborations(BaseObject): - def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[List[CollaborationsOrderField]] = None, entries: Optional[List[Collaboration]] = None, **kwargs): + def __init__( + self, + total_count: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + order: Optional[List[CollaborationsOrderField]] = None, + entries: Optional[List[Collaboration]] = None, + **kwargs + ): """ :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 @@ -6561,9 +9214,11 @@ def __init__(self, total_count: Optional[int] = None, limit: Optional[int] = Non self.order = order self.entries = entries + class WebhookInvocationTypeField(str, Enum): WEBHOOK_EVENT = 'webhook_event' + class WebhookInvocationTriggerField(str, Enum): FILE_UPLOADED = 'FILE.UPLOADED' FILE_PREVIEWED = 'FILE.PREVIEWED' @@ -6606,8 +9261,19 @@ class WebhookInvocationTriggerField(str, Enum): SIGN_REQUEST_EXPIRED = 'SIGN_REQUEST.EXPIRED' SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED' + class WebhookInvocation(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[WebhookInvocationTypeField] = None, webhook: Optional[Webhook] = None, created_by: Optional[UserMini] = None, created_at: Optional[str] = None, trigger: Optional[WebhookInvocationTriggerField] = None, source: Optional[Union[File, Folder]] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[WebhookInvocationTypeField] = None, + webhook: Optional[Webhook] = None, + created_by: Optional[UserMini] = None, + created_at: Optional[str] = None, + trigger: Optional[WebhookInvocationTriggerField] = None, + source: Optional[Union[File, Folder]] = None, + **kwargs + ): """ :param id: The unique identifier for this webhook invocation :type id: Optional[str], optional @@ -6626,11 +9292,21 @@ def __init__(self, id: Optional[str] = None, type: Optional[WebhookInvocationTyp self.trigger = trigger self.source = source + class WorkflowMiniTypeField(str, Enum): WORKFLOW = 'workflow' + class WorkflowMini(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[WorkflowMiniTypeField] = None, name: Optional[str] = None, description: Optional[str] = None, is_enabled: Optional[bool] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[WorkflowMiniTypeField] = None, + name: Optional[str] = None, + description: Optional[str] = None, + is_enabled: Optional[bool] = None, + **kwargs + ): """ :param id: The unique identifier for the workflow :type id: Optional[str], optional @@ -6650,23 +9326,36 @@ def __init__(self, id: Optional[str] = None, type: Optional[WorkflowMiniTypeFiel self.description = description self.is_enabled = is_enabled + class WorkflowFlowsFieldTypeField(str, Enum): FLOW = 'flow' + class WorkflowFlowsFieldTriggerFieldTypeField(str, Enum): TRIGGER = 'trigger' + class WorkflowFlowsFieldTriggerFieldTriggerTypeField(str, Enum): WORKFLOW_MANUAL_START = 'WORKFLOW_MANUAL_START' + class WorkflowFlowsFieldTriggerFieldScopeFieldTypeField(str, Enum): TRIGGER_SCOPE = 'trigger_scope' + class WorkflowFlowsFieldTriggerFieldScopeFieldObjectFieldTypeField(str, Enum): FOLDER = 'folder' + class WorkflowFlowsFieldTriggerFieldScopeFieldObjectField(BaseObject): - def __init__(self, type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldObjectFieldTypeField] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[ + WorkflowFlowsFieldTriggerFieldScopeFieldObjectFieldTypeField + ] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: The type of the object :type type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldObjectFieldTypeField], optional @@ -6677,8 +9366,15 @@ def __init__(self, type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldObject self.type = type self.id = id + class WorkflowFlowsFieldTriggerFieldScopeField(BaseObject): - def __init__(self, type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldTypeField] = None, ref: Optional[str] = None, object: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldObjectField] = None, **kwargs): + def __init__( + self, + type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldTypeField] = None, + ref: Optional[str] = None, + object: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldObjectField] = None, + **kwargs + ): """ :param type: The trigger scope's resource type :type type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldTypeField], optional @@ -6692,8 +9388,15 @@ def __init__(self, type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldTypeFi self.ref = ref self.object = object + class WorkflowFlowsFieldTriggerField(BaseObject): - def __init__(self, type: Optional[WorkflowFlowsFieldTriggerFieldTypeField] = None, trigger_type: Optional[WorkflowFlowsFieldTriggerFieldTriggerTypeField] = None, scope: Optional[List[WorkflowFlowsFieldTriggerFieldScopeField]] = None, **kwargs): + def __init__( + self, + type: Optional[WorkflowFlowsFieldTriggerFieldTypeField] = None, + trigger_type: Optional[WorkflowFlowsFieldTriggerFieldTriggerTypeField] = None, + scope: Optional[List[WorkflowFlowsFieldTriggerFieldScopeField]] = None, + **kwargs + ): """ :param type: The trigger's resource type :type type: Optional[WorkflowFlowsFieldTriggerFieldTypeField], optional @@ -6707,9 +9410,11 @@ def __init__(self, type: Optional[WorkflowFlowsFieldTriggerFieldTypeField] = Non self.trigger_type = trigger_type self.scope = scope + class WorkflowFlowsFieldOutcomesFieldTypeField(str, Enum): OUTCOME = 'outcome' + class WorkflowFlowsFieldOutcomesFieldActionTypeField(str, Enum): ADD_METADATA = 'add_metadata' ASSIGN_TASK = 'assign_task' @@ -6735,9 +9440,11 @@ class WorkflowFlowsFieldOutcomesFieldActionTypeField(str, Enum): APPLY_FOLDER_CLASSIFICATION = 'apply_folder_classification' SEND_NOTIFICATION = 'send_notification' + class WorkflowFlowsFieldOutcomesFieldIfRejectedFieldTypeField(str, Enum): OUTCOME = 'outcome' + class WorkflowFlowsFieldOutcomesFieldIfRejectedFieldActionTypeField(str, Enum): ADD_METADATA = 'add_metadata' ASSIGN_TASK = 'assign_task' @@ -6763,8 +9470,18 @@ class WorkflowFlowsFieldOutcomesFieldIfRejectedFieldActionTypeField(str, Enum): APPLY_FOLDER_CLASSIFICATION = 'apply_folder_classification' SEND_NOTIFICATION = 'send_notification' + class WorkflowFlowsFieldOutcomesFieldIfRejectedField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[WorkflowFlowsFieldOutcomesFieldIfRejectedFieldTypeField] = None, name: Optional[str] = None, action_type: Optional[WorkflowFlowsFieldOutcomesFieldIfRejectedFieldActionTypeField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[WorkflowFlowsFieldOutcomesFieldIfRejectedFieldTypeField] = None, + name: Optional[str] = None, + action_type: Optional[ + WorkflowFlowsFieldOutcomesFieldIfRejectedFieldActionTypeField + ] = None, + **kwargs + ): """ :param id: The identifier of the outcome :type id: Optional[str], optional @@ -6779,8 +9496,19 @@ def __init__(self, id: Optional[str] = None, type: Optional[WorkflowFlowsFieldOu self.name = name self.action_type = action_type + class WorkflowFlowsFieldOutcomesField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[WorkflowFlowsFieldOutcomesFieldTypeField] = None, name: Optional[str] = None, action_type: Optional[WorkflowFlowsFieldOutcomesFieldActionTypeField] = None, if_rejected: Optional[List[WorkflowFlowsFieldOutcomesFieldIfRejectedField]] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[WorkflowFlowsFieldOutcomesFieldTypeField] = None, + name: Optional[str] = None, + action_type: Optional[WorkflowFlowsFieldOutcomesFieldActionTypeField] = None, + if_rejected: Optional[ + List[WorkflowFlowsFieldOutcomesFieldIfRejectedField] + ] = None, + **kwargs + ): """ :param id: The identifier of the outcome :type id: Optional[str], optional @@ -6799,8 +9527,18 @@ def __init__(self, id: Optional[str] = None, type: Optional[WorkflowFlowsFieldOu self.action_type = action_type self.if_rejected = if_rejected + class WorkflowFlowsField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[WorkflowFlowsFieldTypeField] = None, trigger: Optional[WorkflowFlowsFieldTriggerField] = None, outcomes: Optional[List[WorkflowFlowsFieldOutcomesField]] = None, created_at: Optional[str] = None, created_by: Optional[UserBase] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[WorkflowFlowsFieldTypeField] = None, + trigger: Optional[WorkflowFlowsFieldTriggerField] = None, + outcomes: Optional[List[WorkflowFlowsFieldOutcomesField]] = None, + created_at: Optional[str] = None, + created_by: Optional[UserBase] = None, + **kwargs + ): """ :param id: The identifier of the flow :type id: Optional[str], optional @@ -6817,8 +9555,18 @@ def __init__(self, id: Optional[str] = None, type: Optional[WorkflowFlowsFieldTy self.created_at = created_at self.created_by = created_by + class Workflow(WorkflowMini): - def __init__(self, flows: Optional[List[WorkflowFlowsField]] = None, id: Optional[str] = None, type: Optional[WorkflowMiniTypeField] = None, name: Optional[str] = None, description: Optional[str] = None, is_enabled: Optional[bool] = None, **kwargs): + def __init__( + self, + flows: Optional[List[WorkflowFlowsField]] = None, + id: Optional[str] = None, + type: Optional[WorkflowMiniTypeField] = None, + name: Optional[str] = None, + description: Optional[str] = None, + is_enabled: Optional[bool] = None, + **kwargs + ): """ :param flows: A list of flows assigned to a workflow. :type flows: Optional[List[WorkflowFlowsField]], optional @@ -6833,11 +9581,26 @@ def __init__(self, flows: Optional[List[WorkflowFlowsField]] = None, id: Optiona :param is_enabled: Specifies if this workflow is enabled :type is_enabled: Optional[bool], optional """ - super().__init__(id=id, type=type, name=name, description=description, is_enabled=is_enabled, **kwargs) + super().__init__( + id=id, + type=type, + name=name, + description=description, + is_enabled=is_enabled, + **kwargs + ) self.flows = flows + class Workflows(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[Workflow]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[Workflow]] = 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 @@ -6856,8 +9619,22 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class WorkflowFull(Workflow): - def __init__(self, created_at: Optional[str] = None, modified_at: Optional[str] = None, created_by: Optional[UserBase] = None, modified_by: Optional[UserBase] = None, flows: Optional[List[WorkflowFlowsField]] = None, id: Optional[str] = None, type: Optional[WorkflowMiniTypeField] = None, name: Optional[str] = None, description: Optional[str] = None, is_enabled: Optional[bool] = None, **kwargs): + def __init__( + self, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + created_by: Optional[UserBase] = None, + modified_by: Optional[UserBase] = None, + flows: Optional[List[WorkflowFlowsField]] = None, + id: Optional[str] = None, + type: Optional[WorkflowMiniTypeField] = None, + name: Optional[str] = None, + description: Optional[str] = None, + is_enabled: Optional[bool] = None, + **kwargs + ): """ :param created_at: The date and time when the workflow was created on Box :type created_at: Optional[str], optional @@ -6876,18 +9653,35 @@ def __init__(self, created_at: Optional[str] = None, modified_at: Optional[str] :param is_enabled: Specifies if this workflow is enabled :type is_enabled: Optional[bool], optional """ - super().__init__(flows=flows, id=id, type=type, name=name, description=description, is_enabled=is_enabled, **kwargs) + super().__init__( + flows=flows, + id=id, + type=type, + name=name, + description=description, + is_enabled=is_enabled, + **kwargs + ) self.created_at = created_at self.modified_at = modified_at self.created_by = created_by self.modified_by = modified_by + class ZipDownloadNameConflictsFieldTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' + class ZipDownloadNameConflictsField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[ZipDownloadNameConflictsFieldTypeField] = None, original_name: Optional[str] = None, download_name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[ZipDownloadNameConflictsFieldTypeField] = None, + original_name: Optional[str] = None, + download_name: Optional[str] = None, + **kwargs + ): """ :param id: The identifier of the item :type id: Optional[str], optional @@ -6905,8 +9699,16 @@ def __init__(self, id: Optional[str] = None, type: Optional[ZipDownloadNameConfl self.original_name = original_name self.download_name = download_name + class ZipDownload(BaseObject): - def __init__(self, download_url: Optional[str] = None, status_url: Optional[str] = None, expires_at: Optional[str] = None, name_conflicts: Optional[List[List[ZipDownloadNameConflictsField]]] = None, **kwargs): + def __init__( + self, + download_url: Optional[str] = None, + status_url: Optional[str] = None, + expires_at: Optional[str] = None, + name_conflicts: Optional[List[List[ZipDownloadNameConflictsField]]] = None, + **kwargs + ): """ :param download_url: The URL that can be used to download the `zip` archive. A `Get` request to this URL will start streaming the items requested. By default, this URL @@ -6948,13 +9750,23 @@ def __init__(self, download_url: Optional[str] = None, status_url: Optional[str] self.expires_at = expires_at self.name_conflicts = name_conflicts + class ZipDownloadStatusStateField(str, Enum): IN_PROGRESS = 'in_progress' FAILED = 'failed' SUCCESS = 'success' + class ZipDownloadStatus(BaseObject): - def __init__(self, total_file_count: Optional[int] = None, downloaded_file_count: Optional[int] = None, skipped_file_count: Optional[int] = None, skipped_folder_count: Optional[int] = None, state: Optional[ZipDownloadStatusStateField] = None, **kwargs): + def __init__( + self, + total_file_count: Optional[int] = None, + downloaded_file_count: Optional[int] = None, + skipped_file_count: Optional[int] = None, + skipped_folder_count: Optional[int] = None, + state: Optional[ZipDownloadStatusStateField] = None, + **kwargs + ): """ :param total_file_count: The total number of files in the archive. :type total_file_count: Optional[int], optional @@ -6980,12 +9792,15 @@ def __init__(self, total_file_count: Optional[int] = None, downloaded_file_count self.skipped_folder_count = skipped_folder_count self.state = state + class KeywordSkillCardTypeField(str, Enum): SKILL_CARD = 'skill_card' + class KeywordSkillCardSkillCardTypeField(str, Enum): KEYWORD = 'keyword' + class KeywordSkillCardSkillCardTitleField(BaseObject): def __init__(self, message: str, code: Optional[str] = None, **kwargs): """ @@ -6998,9 +9813,11 @@ def __init__(self, message: str, code: Optional[str] = None, **kwargs): self.message = message self.code = code + class KeywordSkillCardSkillFieldTypeField(str, Enum): SERVICE = 'service' + class KeywordSkillCardSkillField(BaseObject): def __init__(self, type: KeywordSkillCardSkillFieldTypeField, id: str, **kwargs): """ @@ -7014,11 +9831,15 @@ def __init__(self, type: KeywordSkillCardSkillFieldTypeField, id: str, **kwargs) self.type = type self.id = id + class KeywordSkillCardInvocationFieldTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' + class KeywordSkillCardInvocationField(BaseObject): - def __init__(self, type: KeywordSkillCardInvocationFieldTypeField, id: str, **kwargs): + def __init__( + self, type: KeywordSkillCardInvocationFieldTypeField, id: str, **kwargs + ): """ :param type: `skill_invocation` :type type: KeywordSkillCardInvocationFieldTypeField @@ -7033,6 +9854,7 @@ def __init__(self, type: KeywordSkillCardInvocationFieldTypeField, id: str, **kw self.type = type self.id = id + class KeywordSkillCardEntriesField(BaseObject): def __init__(self, text: Optional[str] = None, **kwargs): """ @@ -7042,8 +9864,19 @@ def __init__(self, text: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.text = text + class KeywordSkillCard(BaseObject): - def __init__(self, type: KeywordSkillCardTypeField, skill_card_type: KeywordSkillCardSkillCardTypeField, skill: KeywordSkillCardSkillField, invocation: KeywordSkillCardInvocationField, entries: List[KeywordSkillCardEntriesField], created_at: Optional[str] = None, skill_card_title: Optional[KeywordSkillCardSkillCardTitleField] = None, **kwargs): + def __init__( + self, + type: KeywordSkillCardTypeField, + skill_card_type: KeywordSkillCardSkillCardTypeField, + skill: KeywordSkillCardSkillField, + invocation: KeywordSkillCardInvocationField, + entries: List[KeywordSkillCardEntriesField], + created_at: Optional[str] = None, + skill_card_title: Optional[KeywordSkillCardSkillCardTitleField] = None, + **kwargs + ): """ :param type: `skill_card` :type type: KeywordSkillCardTypeField @@ -7070,6 +9903,7 @@ def __init__(self, type: KeywordSkillCardTypeField, skill_card_type: KeywordSkil self.created_at = created_at self.skill_card_title = skill_card_title + class IntegrationMappingSlackOptions(BaseObject): def __init__(self, is_access_management_disabled: Optional[bool] = None, **kwargs): """ @@ -7083,11 +9917,20 @@ def __init__(self, is_access_management_disabled: Optional[bool] = None, **kwarg super().__init__(**kwargs) self.is_access_management_disabled = is_access_management_disabled + class IntegrationMappingPartnerItemSlackTypeField(str, Enum): CHANNEL = 'channel' + class IntegrationMappingPartnerItemSlack(BaseObject): - def __init__(self, type: IntegrationMappingPartnerItemSlackTypeField, id: str, slack_workspace_id: Optional[str] = None, slack_org_id: Optional[str] = None, **kwargs): + def __init__( + self, + type: IntegrationMappingPartnerItemSlackTypeField, + id: str, + slack_workspace_id: Optional[str] = None, + slack_org_id: Optional[str] = None, + **kwargs + ): """ :param type: Type of the mapped item referenced in `id` :type type: IntegrationMappingPartnerItemSlackTypeField @@ -7104,15 +9947,32 @@ def __init__(self, type: IntegrationMappingPartnerItemSlackTypeField, id: str, s self.slack_workspace_id = slack_workspace_id self.slack_org_id = slack_org_id + class IntegrationMappingTypeField(str, Enum): INTEGRATION_MAPPING = 'integration_mapping' + class IntegrationMappingOptionsField(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) + class IntegrationMapping(IntegrationMappingBase): - def __init__(self, type: IntegrationMappingTypeField, partner_item: Union[IntegrationMappingPartnerItemSlack], box_item: FolderMini, is_manually_created: Optional[bool] = None, options: Optional[IntegrationMappingOptionsField] = None, created_by: Optional[UserIntegrationMappings] = None, modified_by: Optional[UserIntegrationMappings] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, id: Optional[str] = None, integration_type: Optional[IntegrationMappingBaseIntegrationTypeField] = None, **kwargs): + def __init__( + self, + type: IntegrationMappingTypeField, + partner_item: Union[IntegrationMappingPartnerItemSlack], + box_item: FolderMini, + is_manually_created: Optional[bool] = None, + options: Optional[IntegrationMappingOptionsField] = None, + created_by: Optional[UserIntegrationMappings] = None, + modified_by: Optional[UserIntegrationMappings] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + id: Optional[str] = None, + integration_type: Optional[IntegrationMappingBaseIntegrationTypeField] = None, + **kwargs + ): """ :param type: Mapping type :type type: IntegrationMappingTypeField @@ -7158,8 +10018,16 @@ def __init__(self, type: IntegrationMappingTypeField, partner_item: Union[Integr self.created_at = created_at self.modified_at = modified_at + class IntegrationMappings(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[IntegrationMapping]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[IntegrationMapping]] = 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 @@ -7178,11 +10046,15 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class IntegrationMappingBoxItemSlackTypeField(str, Enum): FOLDER = 'folder' + class IntegrationMappingBoxItemSlack(BaseObject): - def __init__(self, type: IntegrationMappingBoxItemSlackTypeField, id: str, **kwargs): + def __init__( + self, type: IntegrationMappingBoxItemSlackTypeField, id: str, **kwargs + ): """ :param type: Type of the mapped item referenced in `id` :type type: IntegrationMappingBoxItemSlackTypeField @@ -7193,19 +10065,29 @@ def __init__(self, type: IntegrationMappingBoxItemSlackTypeField, id: str, **kwa self.type = type self.id = id + class IntegrationMappingSlackCreateRequest(BaseObject): - def __init__(self, partner_item: IntegrationMappingPartnerItemSlack, box_item: IntegrationMappingBoxItemSlack, options: Optional[IntegrationMappingSlackOptions] = None, **kwargs): + def __init__( + self, + partner_item: IntegrationMappingPartnerItemSlack, + box_item: IntegrationMappingBoxItemSlack, + options: Optional[IntegrationMappingSlackOptions] = None, + **kwargs + ): super().__init__(**kwargs) self.partner_item = partner_item self.box_item = box_item self.options = options + class TimelineSkillCardTypeField(str, Enum): SKILL_CARD = 'skill_card' + class TimelineSkillCardSkillCardTypeField(str, Enum): TIMELINE = 'timeline' + class TimelineSkillCardSkillCardTitleField(BaseObject): def __init__(self, message: str, code: Optional[str] = None, **kwargs): """ @@ -7218,9 +10100,11 @@ def __init__(self, message: str, code: Optional[str] = None, **kwargs): self.message = message self.code = code + class TimelineSkillCardSkillFieldTypeField(str, Enum): SERVICE = 'service' + class TimelineSkillCardSkillField(BaseObject): def __init__(self, type: TimelineSkillCardSkillFieldTypeField, id: str, **kwargs): """ @@ -7234,11 +10118,15 @@ def __init__(self, type: TimelineSkillCardSkillFieldTypeField, id: str, **kwargs self.type = type self.id = id + class TimelineSkillCardInvocationFieldTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' + class TimelineSkillCardInvocationField(BaseObject): - def __init__(self, type: TimelineSkillCardInvocationFieldTypeField, id: str, **kwargs): + def __init__( + self, type: TimelineSkillCardInvocationFieldTypeField, id: str, **kwargs + ): """ :param type: `skill_invocation` :type type: TimelineSkillCardInvocationFieldTypeField @@ -7253,8 +10141,11 @@ def __init__(self, type: TimelineSkillCardInvocationFieldTypeField, id: str, **k self.type = type self.id = id + class TimelineSkillCardEntriesFieldAppearsField(BaseObject): - def __init__(self, start: Optional[int] = None, end: Optional[int] = None, **kwargs): + def __init__( + self, start: Optional[int] = None, end: Optional[int] = None, **kwargs + ): """ :param start: The time in seconds when an entry should start appearing on a timeline. @@ -7267,8 +10158,15 @@ def __init__(self, start: Optional[int] = None, end: Optional[int] = None, **kwa self.start = start self.end = end + class TimelineSkillCardEntriesField(BaseObject): - def __init__(self, text: Optional[str] = None, appears: Optional[List[TimelineSkillCardEntriesFieldAppearsField]] = None, image_url: Optional[str] = None, **kwargs): + def __init__( + self, + text: Optional[str] = None, + appears: Optional[List[TimelineSkillCardEntriesFieldAppearsField]] = None, + image_url: Optional[str] = None, + **kwargs + ): """ :param text: The text of the entry. This would be the display name for an item being placed on the timeline, for example the name @@ -7290,8 +10188,20 @@ def __init__(self, text: Optional[str] = None, appears: Optional[List[TimelineSk self.appears = appears self.image_url = image_url + class TimelineSkillCard(BaseObject): - def __init__(self, type: TimelineSkillCardTypeField, skill_card_type: TimelineSkillCardSkillCardTypeField, skill: TimelineSkillCardSkillField, invocation: TimelineSkillCardInvocationField, entries: List[TimelineSkillCardEntriesField], created_at: Optional[str] = None, skill_card_title: Optional[TimelineSkillCardSkillCardTitleField] = None, duration: Optional[int] = None, **kwargs): + def __init__( + self, + type: TimelineSkillCardTypeField, + skill_card_type: TimelineSkillCardSkillCardTypeField, + skill: TimelineSkillCardSkillField, + invocation: TimelineSkillCardInvocationField, + entries: List[TimelineSkillCardEntriesField], + created_at: Optional[str] = None, + skill_card_title: Optional[TimelineSkillCardSkillCardTitleField] = None, + duration: Optional[int] = None, + **kwargs + ): """ :param type: `skill_card` :type type: TimelineSkillCardTypeField @@ -7321,12 +10231,15 @@ def __init__(self, type: TimelineSkillCardTypeField, skill_card_type: TimelineSk self.skill_card_title = skill_card_title self.duration = duration + class TranscriptSkillCardTypeField(str, Enum): SKILL_CARD = 'skill_card' + class TranscriptSkillCardSkillCardTypeField(str, Enum): TRANSCRIPT = 'transcript' + class TranscriptSkillCardSkillCardTitleField(BaseObject): def __init__(self, message: str, code: Optional[str] = None, **kwargs): """ @@ -7339,9 +10252,11 @@ def __init__(self, message: str, code: Optional[str] = None, **kwargs): self.message = message self.code = code + class TranscriptSkillCardSkillFieldTypeField(str, Enum): SERVICE = 'service' + class TranscriptSkillCardSkillField(BaseObject): def __init__(self, type: TranscriptSkillCardSkillFieldTypeField, id: str, **kwargs): """ @@ -7355,11 +10270,15 @@ def __init__(self, type: TranscriptSkillCardSkillFieldTypeField, id: str, **kwar self.type = type self.id = id + class TranscriptSkillCardInvocationFieldTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' + class TranscriptSkillCardInvocationField(BaseObject): - def __init__(self, type: TranscriptSkillCardInvocationFieldTypeField, id: str, **kwargs): + def __init__( + self, type: TranscriptSkillCardInvocationFieldTypeField, id: str, **kwargs + ): """ :param type: `skill_invocation` :type type: TranscriptSkillCardInvocationFieldTypeField @@ -7374,6 +10293,7 @@ def __init__(self, type: TranscriptSkillCardInvocationFieldTypeField, id: str, * self.type = type self.id = id + class TranscriptSkillCardEntriesFieldAppearsField(BaseObject): def __init__(self, start: Optional[int] = None, **kwargs): """ @@ -7384,8 +10304,14 @@ def __init__(self, start: Optional[int] = None, **kwargs): super().__init__(**kwargs) self.start = start + class TranscriptSkillCardEntriesField(BaseObject): - def __init__(self, text: Optional[str] = None, appears: Optional[List[TranscriptSkillCardEntriesFieldAppearsField]] = None, **kwargs): + def __init__( + self, + text: Optional[str] = None, + appears: Optional[List[TranscriptSkillCardEntriesFieldAppearsField]] = None, + **kwargs + ): """ :param text: The text of the entry. This would be the transcribed text assigned to the entry on the timeline. @@ -7398,8 +10324,20 @@ def __init__(self, text: Optional[str] = None, appears: Optional[List[Transcript self.text = text self.appears = appears + class TranscriptSkillCard(BaseObject): - def __init__(self, type: TranscriptSkillCardTypeField, skill_card_type: TranscriptSkillCardSkillCardTypeField, skill: TranscriptSkillCardSkillField, invocation: TranscriptSkillCardInvocationField, entries: List[TranscriptSkillCardEntriesField], created_at: Optional[str] = None, skill_card_title: Optional[TranscriptSkillCardSkillCardTitleField] = None, duration: Optional[int] = None, **kwargs): + def __init__( + self, + type: TranscriptSkillCardTypeField, + skill_card_type: TranscriptSkillCardSkillCardTypeField, + skill: TranscriptSkillCardSkillField, + invocation: TranscriptSkillCardInvocationField, + entries: List[TranscriptSkillCardEntriesField], + created_at: Optional[str] = None, + skill_card_title: Optional[TranscriptSkillCardSkillCardTitleField] = None, + duration: Optional[int] = None, + **kwargs + ): """ :param type: `skill_card` :type type: TranscriptSkillCardTypeField @@ -7432,12 +10370,15 @@ def __init__(self, type: TranscriptSkillCardTypeField, skill_card_type: Transcri self.skill_card_title = skill_card_title self.duration = duration + class StatusSkillCardTypeField(str, Enum): SKILL_CARD = 'skill_card' + class StatusSkillCardSkillCardTypeField(str, Enum): STATUS = 'status' + class StatusSkillCardSkillCardTitleField(BaseObject): def __init__(self, message: str, code: Optional[str] = None, **kwargs): """ @@ -7450,6 +10391,7 @@ def __init__(self, message: str, code: Optional[str] = None, **kwargs): self.message = message self.code = code + class StatusSkillCardStatusFieldCodeField(str, Enum): INVOKED = 'invoked' PROCESSING = 'processing' @@ -7457,8 +10399,14 @@ class StatusSkillCardStatusFieldCodeField(str, Enum): TRANSIENT_FAILURE = 'transient_failure' PERMANENT_FAILURE = 'permanent_failure' + class StatusSkillCardStatusField(BaseObject): - def __init__(self, code: StatusSkillCardStatusFieldCodeField, message: Optional[str] = None, **kwargs): + def __init__( + self, + code: StatusSkillCardStatusFieldCodeField, + message: Optional[str] = None, + **kwargs + ): """ :param code: A code for the status of this Skill invocation. By default each of these will have their own accompanied @@ -7473,9 +10421,11 @@ def __init__(self, code: StatusSkillCardStatusFieldCodeField, message: Optional[ self.code = code self.message = message + class StatusSkillCardSkillFieldTypeField(str, Enum): SERVICE = 'service' + class StatusSkillCardSkillField(BaseObject): def __init__(self, type: StatusSkillCardSkillFieldTypeField, id: str, **kwargs): """ @@ -7489,11 +10439,15 @@ def __init__(self, type: StatusSkillCardSkillFieldTypeField, id: str, **kwargs): self.type = type self.id = id + class StatusSkillCardInvocationFieldTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' + class StatusSkillCardInvocationField(BaseObject): - def __init__(self, type: StatusSkillCardInvocationFieldTypeField, id: str, **kwargs): + def __init__( + self, type: StatusSkillCardInvocationFieldTypeField, id: str, **kwargs + ): """ :param type: `skill_invocation` :type type: StatusSkillCardInvocationFieldTypeField @@ -7508,8 +10462,19 @@ def __init__(self, type: StatusSkillCardInvocationFieldTypeField, id: str, **kwa self.type = type self.id = id + class StatusSkillCard(BaseObject): - def __init__(self, type: StatusSkillCardTypeField, skill_card_type: StatusSkillCardSkillCardTypeField, status: StatusSkillCardStatusField, skill: StatusSkillCardSkillField, invocation: StatusSkillCardInvocationField, created_at: Optional[str] = None, skill_card_title: Optional[StatusSkillCardSkillCardTitleField] = None, **kwargs): + def __init__( + self, + type: StatusSkillCardTypeField, + skill_card_type: StatusSkillCardSkillCardTypeField, + status: StatusSkillCardStatusField, + skill: StatusSkillCardSkillField, + invocation: StatusSkillCardInvocationField, + created_at: Optional[str] = None, + skill_card_title: Optional[StatusSkillCardSkillCardTitleField] = None, + **kwargs + ): """ :param type: `skill_card` :type type: StatusSkillCardTypeField @@ -7536,10 +10501,53 @@ def __init__(self, type: StatusSkillCardTypeField, skill_card_type: StatusSkillC self.created_at = created_at self.skill_card_title = skill_card_title + class SkillCardsMetadata(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'can_edit': '$canEdit', 'id': '$id', 'parent': '$parent', 'scope': '$scope', 'template': '$template', 'type': '$type', 'type_version': '$typeVersion', 'version': '$version', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'$canEdit': 'can_edit', '$id': 'id', '$parent': 'parent', '$scope': 'scope', '$template': 'template', '$type': 'type', '$typeVersion': 'type_version', '$version': 'version', **BaseObject._json_to_fields_mapping} - def __init__(self, can_edit: Optional[bool] = None, id: Optional[str] = None, parent: Optional[str] = None, scope: Optional[str] = None, template: Optional[str] = None, type: Optional[str] = None, type_version: Optional[int] = None, version: Optional[int] = None, cards: Optional[List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'can_edit': '$canEdit', + 'id': '$id', + 'parent': '$parent', + 'scope': '$scope', + 'template': '$template', + 'type': '$type', + 'type_version': '$typeVersion', + 'version': '$version', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + '$canEdit': 'can_edit', + '$id': 'id', + '$parent': 'parent', + '$scope': 'scope', + '$template': 'template', + '$type': 'type', + '$typeVersion': 'type_version', + '$version': 'version', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + can_edit: Optional[bool] = None, + id: Optional[str] = None, + parent: Optional[str] = None, + scope: Optional[str] = None, + template: Optional[str] = None, + type: Optional[str] = None, + type_version: Optional[int] = None, + version: Optional[int] = None, + cards: Optional[ + List[ + Union[ + KeywordSkillCard, + TimelineSkillCard, + TranscriptSkillCard, + StatusSkillCard, + ] + ] + ] = None, + **kwargs + ): """ :param can_edit: Whether the user can edit this metadata :type can_edit: Optional[bool], optional @@ -7575,13 +10583,28 @@ def __init__(self, can_edit: Optional[bool] = None, id: Optional[str] = None, pa self.version = version self.cards = cards + class SignRequestCreateSignerRoleField(str, Enum): SIGNER = 'signer' APPROVER = 'approver' FINAL_COPY_READER = 'final_copy_reader' + class SignRequestCreateSigner(BaseObject): - def __init__(self, email: str, role: Optional[SignRequestCreateSignerRoleField] = None, is_in_person: Optional[bool] = None, order: Optional[int] = None, embed_url_external_user_id: Optional[str] = None, redirect_url: Optional[str] = None, declined_redirect_url: Optional[str] = None, login_required: Optional[bool] = None, verification_phone_number: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__( + self, + email: str, + role: Optional[SignRequestCreateSignerRoleField] = None, + is_in_person: Optional[bool] = None, + order: Optional[int] = None, + embed_url_external_user_id: Optional[str] = None, + redirect_url: Optional[str] = None, + declined_redirect_url: Optional[str] = None, + login_required: Optional[bool] = None, + verification_phone_number: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): """ :param email: Email address of the signer :type email: str @@ -7634,8 +10657,16 @@ def __init__(self, email: str, role: Optional[SignRequestCreateSignerRoleField] self.verification_phone_number = verification_phone_number self.password = password + class SignRequestPrefillTag(BaseObject): - def __init__(self, document_tag_id: Optional[str] = None, text_value: Optional[str] = None, checkbox_value: Optional[bool] = None, date_value: Optional[str] = None, **kwargs): + def __init__( + self, + document_tag_id: Optional[str] = None, + text_value: Optional[str] = None, + checkbox_value: Optional[bool] = None, + date_value: Optional[str] = None, + **kwargs + ): """ :param document_tag_id: This references the ID of a specific tag contained in a file of the sign request. :type document_tag_id: Optional[str], optional @@ -7652,12 +10683,14 @@ def __init__(self, document_tag_id: Optional[str] = None, text_value: Optional[s self.checkbox_value = checkbox_value self.date_value = date_value + class SignRequestSignerInputTypeField(str, Enum): SIGNATURE = 'signature' DATE = 'date' TEXT = 'text' CHECKBOX = 'checkbox' + class SignRequestSignerInputContentTypeField(str, Enum): INITIAL = 'initial' STAMP = 'stamp' @@ -7673,8 +10706,19 @@ class SignRequestSignerInputContentTypeField(str, Enum): CHECKBOX = 'checkbox' ATTACHMENT = 'attachment' + class SignRequestSignerInput(SignRequestPrefillTag): - def __init__(self, page_index: int, type: Optional[SignRequestSignerInputTypeField] = None, content_type: Optional[SignRequestSignerInputContentTypeField] = None, document_tag_id: Optional[str] = None, text_value: Optional[str] = None, checkbox_value: Optional[bool] = None, date_value: Optional[str] = None, **kwargs): + def __init__( + self, + page_index: int, + type: Optional[SignRequestSignerInputTypeField] = None, + content_type: Optional[SignRequestSignerInputContentTypeField] = None, + document_tag_id: Optional[str] = None, + text_value: Optional[str] = None, + checkbox_value: Optional[bool] = None, + date_value: Optional[str] = None, + **kwargs + ): """ :param page_index: Index of page that the input is on :type page_index: int @@ -7691,17 +10735,30 @@ def __init__(self, page_index: int, type: Optional[SignRequestSignerInputTypeFie :param date_value: Date prefill value :type date_value: Optional[str], optional """ - super().__init__(document_tag_id=document_tag_id, text_value=text_value, checkbox_value=checkbox_value, date_value=date_value, **kwargs) + super().__init__( + document_tag_id=document_tag_id, + text_value=text_value, + checkbox_value=checkbox_value, + date_value=date_value, + **kwargs + ) self.page_index = page_index self.type = type self.content_type = content_type + class SignRequestSignerSignerDecisionFieldTypeField(str, Enum): SIGNED = 'signed' DECLINED = 'declined' + class SignRequestSignerSignerDecisionField(BaseObject): - def __init__(self, type: Optional[SignRequestSignerSignerDecisionFieldTypeField] = None, finalized_at: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[SignRequestSignerSignerDecisionFieldTypeField] = None, + finalized_at: Optional[str] = None, + **kwargs + ): """ :param type: Type of decision made by the signer :type type: Optional[SignRequestSignerSignerDecisionFieldTypeField], optional @@ -7712,8 +10769,27 @@ def __init__(self, type: Optional[SignRequestSignerSignerDecisionFieldTypeField] self.type = type self.finalized_at = finalized_at + class SignRequestSigner(SignRequestCreateSigner): - def __init__(self, email: str, has_viewed_document: Optional[bool] = None, signer_decision: Optional[SignRequestSignerSignerDecisionField] = None, inputs: Optional[List[SignRequestSignerInput]] = None, embed_url: Optional[str] = None, iframeable_embed_url: Optional[str] = None, role: Optional[SignRequestCreateSignerRoleField] = None, is_in_person: Optional[bool] = None, order: Optional[int] = None, embed_url_external_user_id: Optional[str] = None, redirect_url: Optional[str] = None, declined_redirect_url: Optional[str] = None, login_required: Optional[bool] = None, verification_phone_number: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__( + self, + email: str, + has_viewed_document: Optional[bool] = None, + signer_decision: Optional[SignRequestSignerSignerDecisionField] = None, + inputs: Optional[List[SignRequestSignerInput]] = None, + embed_url: Optional[str] = None, + iframeable_embed_url: Optional[str] = None, + role: Optional[SignRequestCreateSignerRoleField] = None, + is_in_person: Optional[bool] = None, + order: Optional[int] = None, + embed_url_external_user_id: Optional[str] = None, + redirect_url: Optional[str] = None, + declined_redirect_url: Optional[str] = None, + login_required: Optional[bool] = None, + verification_phone_number: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): """ :param email: Email address of the signer :type email: str @@ -7767,15 +10843,45 @@ def __init__(self, email: str, has_viewed_document: Optional[bool] = None, signe to sign a document. This field is write only. :type password: Optional[str], optional """ - super().__init__(email=email, role=role, is_in_person=is_in_person, order=order, embed_url_external_user_id=embed_url_external_user_id, redirect_url=redirect_url, declined_redirect_url=declined_redirect_url, login_required=login_required, verification_phone_number=verification_phone_number, password=password, **kwargs) + super().__init__( + email=email, + role=role, + is_in_person=is_in_person, + order=order, + embed_url_external_user_id=embed_url_external_user_id, + redirect_url=redirect_url, + declined_redirect_url=declined_redirect_url, + login_required=login_required, + verification_phone_number=verification_phone_number, + password=password, + **kwargs + ) self.has_viewed_document = has_viewed_document self.signer_decision = signer_decision self.inputs = inputs self.embed_url = embed_url self.iframeable_embed_url = iframeable_embed_url + class SignRequestBase(BaseObject): - def __init__(self, parent_folder: FolderMini, is_document_preparation_needed: Optional[bool] = None, redirect_url: Optional[str] = None, declined_redirect_url: Optional[str] = None, are_text_signatures_enabled: Optional[bool] = None, email_subject: Optional[str] = None, email_message: Optional[str] = None, are_reminders_enabled: Optional[bool] = None, name: Optional[str] = None, prefill_tags: Optional[List[SignRequestPrefillTag]] = None, days_valid: Optional[int] = None, external_id: Optional[str] = None, is_phone_verification_required_to_view: Optional[bool] = None, template_id: Optional[str] = None, **kwargs): + def __init__( + self, + parent_folder: FolderMini, + is_document_preparation_needed: Optional[bool] = None, + redirect_url: Optional[str] = None, + declined_redirect_url: Optional[str] = None, + are_text_signatures_enabled: Optional[bool] = None, + email_subject: Optional[str] = None, + email_message: Optional[str] = None, + are_reminders_enabled: Optional[bool] = None, + name: Optional[str] = None, + prefill_tags: Optional[List[SignRequestPrefillTag]] = None, + days_valid: Optional[int] = None, + external_id: Optional[str] = None, + is_phone_verification_required_to_view: Optional[bool] = None, + template_id: Optional[str] = None, + **kwargs + ): """ :param is_document_preparation_needed: Indicates if the sender should receive a `prepare_url` in the response to complete document preparation via UI. :type is_document_preparation_needed: Optional[bool], optional @@ -7817,12 +10923,16 @@ def __init__(self, parent_folder: FolderMini, is_document_preparation_needed: Op self.prefill_tags = prefill_tags self.days_valid = days_valid self.external_id = external_id - self.is_phone_verification_required_to_view = is_phone_verification_required_to_view + self.is_phone_verification_required_to_view = ( + is_phone_verification_required_to_view + ) self.template_id = template_id + class SignRequestTypeField(str, Enum): SIGN_REQUEST = 'sign-request' + class SignRequestStatusField(str, Enum): CONVERTING = 'converting' CREATED = 'created' @@ -7837,8 +10947,14 @@ class SignRequestStatusField(str, Enum): FINALIZING = 'finalizing' ERROR_FINALIZING = 'error_finalizing' + class SignRequestSignFilesField(BaseObject): - def __init__(self, files: Optional[List[FileMini]] = None, is_ready_for_download: Optional[bool] = None, **kwargs): + def __init__( + self, + files: Optional[List[FileMini]] = None, + is_ready_for_download: Optional[bool] = None, + **kwargs + ): """ :param is_ready_for_download: Indicates whether the `sign_files` documents are processing and the PDFs may be out of date. A change to any document @@ -7851,8 +10967,36 @@ def __init__(self, files: Optional[List[FileMini]] = None, is_ready_for_download self.files = files self.is_ready_for_download = is_ready_for_download + class SignRequest(SignRequestBase): - def __init__(self, parent_folder: FolderMini, type: Optional[SignRequestTypeField] = None, source_files: Optional[List[FileBase]] = None, signers: Optional[List[SignRequestSigner]] = None, signature_color: Optional[str] = None, id: Optional[str] = None, prepare_url: Optional[str] = None, signing_log: Optional[FileMini] = None, status: Optional[SignRequestStatusField] = None, sign_files: Optional[SignRequestSignFilesField] = None, auto_expire_at: Optional[str] = None, is_document_preparation_needed: Optional[bool] = None, redirect_url: Optional[str] = None, declined_redirect_url: Optional[str] = None, are_text_signatures_enabled: Optional[bool] = None, email_subject: Optional[str] = None, email_message: Optional[str] = None, are_reminders_enabled: Optional[bool] = None, name: Optional[str] = None, prefill_tags: Optional[List[SignRequestPrefillTag]] = None, days_valid: Optional[int] = None, external_id: Optional[str] = None, is_phone_verification_required_to_view: Optional[bool] = None, template_id: Optional[str] = None, **kwargs): + def __init__( + self, + parent_folder: FolderMini, + type: Optional[SignRequestTypeField] = None, + source_files: Optional[List[FileBase]] = None, + signers: Optional[List[SignRequestSigner]] = None, + signature_color: Optional[str] = None, + id: Optional[str] = None, + prepare_url: Optional[str] = None, + signing_log: Optional[FileMini] = None, + status: Optional[SignRequestStatusField] = None, + sign_files: Optional[SignRequestSignFilesField] = None, + auto_expire_at: Optional[str] = None, + is_document_preparation_needed: Optional[bool] = None, + redirect_url: Optional[str] = None, + declined_redirect_url: Optional[str] = None, + are_text_signatures_enabled: Optional[bool] = None, + email_subject: Optional[str] = None, + email_message: Optional[str] = None, + are_reminders_enabled: Optional[bool] = None, + name: Optional[str] = None, + prefill_tags: Optional[List[SignRequestPrefillTag]] = None, + days_valid: Optional[int] = None, + external_id: Optional[str] = None, + is_phone_verification_required_to_view: Optional[bool] = None, + template_id: Optional[str] = None, + **kwargs + ): """ :param type: object type :type type: Optional[SignRequestTypeField], optional @@ -7903,7 +11047,23 @@ def __init__(self, parent_folder: FolderMini, type: Optional[SignRequestTypeFiel :param template_id: When a signature request is created from a template this field will indicate the id of that template. :type template_id: Optional[str], optional """ - super().__init__(parent_folder=parent_folder, is_document_preparation_needed=is_document_preparation_needed, redirect_url=redirect_url, declined_redirect_url=declined_redirect_url, are_text_signatures_enabled=are_text_signatures_enabled, email_subject=email_subject, email_message=email_message, are_reminders_enabled=are_reminders_enabled, name=name, prefill_tags=prefill_tags, days_valid=days_valid, external_id=external_id, is_phone_verification_required_to_view=is_phone_verification_required_to_view, template_id=template_id, **kwargs) + super().__init__( + parent_folder=parent_folder, + is_document_preparation_needed=is_document_preparation_needed, + redirect_url=redirect_url, + declined_redirect_url=declined_redirect_url, + are_text_signatures_enabled=are_text_signatures_enabled, + email_subject=email_subject, + email_message=email_message, + are_reminders_enabled=are_reminders_enabled, + name=name, + prefill_tags=prefill_tags, + days_valid=days_valid, + external_id=external_id, + is_phone_verification_required_to_view=is_phone_verification_required_to_view, + template_id=template_id, + **kwargs + ) self.type = type self.source_files = source_files self.signers = signers @@ -7915,8 +11075,16 @@ def __init__(self, parent_folder: FolderMini, type: Optional[SignRequestTypeFiel self.sign_files = sign_files self.auto_expire_at = auto_expire_at + class SignRequests(BaseObject): - def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = None, prev_marker: Optional[int] = None, entries: Optional[List[SignRequest]] = None, **kwargs): + def __init__( + self, + limit: Optional[int] = None, + next_marker: Optional[int] = None, + prev_marker: Optional[int] = None, + entries: Optional[List[SignRequest]] = 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 @@ -7935,8 +11103,28 @@ def __init__(self, limit: Optional[int] = None, next_marker: Optional[int] = Non self.prev_marker = prev_marker self.entries = entries + class SignRequestCreateRequest(SignRequestBase): - def __init__(self, signers: List[SignRequestCreateSigner], parent_folder: FolderMini, source_files: Optional[List[FileBase]] = None, is_document_preparation_needed: Optional[bool] = None, redirect_url: Optional[str] = None, declined_redirect_url: Optional[str] = None, are_text_signatures_enabled: Optional[bool] = None, email_subject: Optional[str] = None, email_message: Optional[str] = None, are_reminders_enabled: Optional[bool] = None, name: Optional[str] = None, prefill_tags: Optional[List[SignRequestPrefillTag]] = None, days_valid: Optional[int] = None, external_id: Optional[str] = None, is_phone_verification_required_to_view: Optional[bool] = None, template_id: Optional[str] = None, **kwargs): + def __init__( + self, + signers: List[SignRequestCreateSigner], + parent_folder: FolderMini, + source_files: Optional[List[FileBase]] = None, + is_document_preparation_needed: Optional[bool] = None, + redirect_url: Optional[str] = None, + declined_redirect_url: Optional[str] = None, + are_text_signatures_enabled: Optional[bool] = None, + email_subject: Optional[str] = None, + email_message: Optional[str] = None, + are_reminders_enabled: Optional[bool] = None, + name: Optional[str] = None, + prefill_tags: Optional[List[SignRequestPrefillTag]] = None, + days_valid: Optional[int] = None, + external_id: Optional[str] = None, + is_phone_verification_required_to_view: Optional[bool] = None, + template_id: Optional[str] = None, + **kwargs + ): """ :param signers: Array of signers for the sign request. 35 is the max number of signers permitted. @@ -7970,10 +11158,27 @@ def __init__(self, signers: List[SignRequestCreateSigner], parent_folder: Folder :param template_id: When a signature request is created from a template this field will indicate the id of that template. :type template_id: Optional[str], optional """ - super().__init__(parent_folder=parent_folder, is_document_preparation_needed=is_document_preparation_needed, redirect_url=redirect_url, declined_redirect_url=declined_redirect_url, are_text_signatures_enabled=are_text_signatures_enabled, email_subject=email_subject, email_message=email_message, are_reminders_enabled=are_reminders_enabled, name=name, prefill_tags=prefill_tags, days_valid=days_valid, external_id=external_id, is_phone_verification_required_to_view=is_phone_verification_required_to_view, template_id=template_id, **kwargs) + super().__init__( + parent_folder=parent_folder, + is_document_preparation_needed=is_document_preparation_needed, + redirect_url=redirect_url, + declined_redirect_url=declined_redirect_url, + are_text_signatures_enabled=are_text_signatures_enabled, + email_subject=email_subject, + email_message=email_message, + are_reminders_enabled=are_reminders_enabled, + name=name, + prefill_tags=prefill_tags, + days_valid=days_valid, + external_id=external_id, + is_phone_verification_required_to_view=is_phone_verification_required_to_view, + template_id=template_id, + **kwargs + ) self.signers = signers self.source_files = source_files + class TemplateSignerInputTypeField(str, Enum): SIGNATURE = 'signature' DATE = 'date' @@ -7982,6 +11187,7 @@ class TemplateSignerInputTypeField(str, Enum): RADIO = 'radio' DROPDOWN = 'dropdown' + class TemplateSignerInputContentTypeField(str, Enum): SIGNATURE = 'signature' INITIAL = 'initial' @@ -7999,6 +11205,7 @@ class TemplateSignerInputContentTypeField(str, Enum): RADIO = 'radio' DROPDOWN = 'dropdown' + class TemplateSignerInputCoordinatesField(BaseObject): def __init__(self, x: Optional[int] = None, y: Optional[int] = None, **kwargs): """ @@ -8011,8 +11218,11 @@ def __init__(self, x: Optional[int] = None, y: Optional[int] = None, **kwargs): self.x = x self.y = y + class TemplateSignerInputDimensionsField(BaseObject): - def __init__(self, width: Optional[int] = None, height: Optional[int] = None, **kwargs): + def __init__( + self, width: Optional[int] = None, height: Optional[int] = None, **kwargs + ): """ :param width: Relative width to the page the input is on, ranging from 0 to 1. :type width: Optional[int], optional @@ -8023,8 +11233,25 @@ def __init__(self, width: Optional[int] = None, height: Optional[int] = None, ** self.width = width self.height = height + class TemplateSignerInput(SignRequestPrefillTag): - def __init__(self, page_index: int, type: Optional[TemplateSignerInputTypeField] = None, content_type: Optional[TemplateSignerInputContentTypeField] = None, is_required: Optional[bool] = None, document_id: Optional[str] = None, dropdown_choices: Optional[List[str]] = None, group_id: Optional[str] = None, coordinates: Optional[TemplateSignerInputCoordinatesField] = None, dimensions: Optional[TemplateSignerInputDimensionsField] = None, document_tag_id: Optional[str] = None, text_value: Optional[str] = None, checkbox_value: Optional[bool] = None, date_value: Optional[str] = None, **kwargs): + def __init__( + self, + page_index: int, + type: Optional[TemplateSignerInputTypeField] = None, + content_type: Optional[TemplateSignerInputContentTypeField] = None, + is_required: Optional[bool] = None, + document_id: Optional[str] = None, + dropdown_choices: Optional[List[str]] = None, + group_id: Optional[str] = None, + coordinates: Optional[TemplateSignerInputCoordinatesField] = None, + dimensions: Optional[TemplateSignerInputDimensionsField] = None, + document_tag_id: Optional[str] = None, + text_value: Optional[str] = None, + checkbox_value: Optional[bool] = None, + date_value: Optional[str] = None, + **kwargs + ): """ :param page_index: Index of page that the input is on. :type page_index: int @@ -8053,7 +11280,13 @@ def __init__(self, page_index: int, type: Optional[TemplateSignerInputTypeField] :param date_value: Date prefill value :type date_value: Optional[str], optional """ - super().__init__(document_tag_id=document_tag_id, text_value=text_value, checkbox_value=checkbox_value, date_value=date_value, **kwargs) + super().__init__( + document_tag_id=document_tag_id, + text_value=text_value, + checkbox_value=checkbox_value, + date_value=date_value, + **kwargs + ) self.page_index = page_index self.type = type self.content_type = content_type @@ -8064,13 +11297,23 @@ def __init__(self, page_index: int, type: Optional[TemplateSignerInputTypeField] self.coordinates = coordinates self.dimensions = dimensions + class TemplateSignerRoleField(str, Enum): SIGNER = 'signer' APPROVER = 'approver' FINAL_COPY_READER = 'final_copy_reader' + class TemplateSigner(BaseObject): - def __init__(self, inputs: Optional[List[TemplateSignerInput]] = None, email: Optional[str] = None, role: Optional[TemplateSignerRoleField] = None, is_in_person: Optional[bool] = None, order: Optional[int] = None, **kwargs): + def __init__( + self, + inputs: Optional[List[TemplateSignerInput]] = None, + email: Optional[str] = None, + role: Optional[TemplateSignerRoleField] = None, + is_in_person: Optional[bool] = None, + order: Optional[int] = None, + **kwargs + ): """ :param email: Email address of the signer :type email: Optional[str], optional @@ -8094,6 +11337,7 @@ def __init__(self, inputs: Optional[List[TemplateSignerInput]] = None, email: Op self.is_in_person = is_in_person self.order = order + class SignTemplateAdditionalInfoFieldNonEditableField(str, Enum): EMAIL_SUBJECT = 'email_subject' EMAIL_MESSAGE = 'email_message' @@ -8102,11 +11346,19 @@ class SignTemplateAdditionalInfoFieldNonEditableField(str, Enum): SIGNERS = 'signers' SOURCE_FILES = 'source_files' + class SignTemplateAdditionalInfoFieldRequiredFieldSignersField(str, Enum): EMAIL = 'email' + class SignTemplateAdditionalInfoFieldRequiredField(BaseObject): - def __init__(self, signers: Optional[List[List[SignTemplateAdditionalInfoFieldRequiredFieldSignersField]]] = None, **kwargs): + def __init__( + self, + signers: Optional[ + List[List[SignTemplateAdditionalInfoFieldRequiredFieldSignersField]] + ] = None, + **kwargs + ): """ :param signers: Required signer fields. :type signers: Optional[List[List[SignTemplateAdditionalInfoFieldRequiredFieldSignersField]]], optional @@ -8114,8 +11366,16 @@ def __init__(self, signers: Optional[List[List[SignTemplateAdditionalInfoFieldRe super().__init__(**kwargs) self.signers = signers + class SignTemplateAdditionalInfoField(BaseObject): - def __init__(self, non_editable: Optional[List[SignTemplateAdditionalInfoFieldNonEditableField]] = None, required: Optional[SignTemplateAdditionalInfoFieldRequiredField] = None, **kwargs): + def __init__( + self, + non_editable: Optional[ + List[SignTemplateAdditionalInfoFieldNonEditableField] + ] = None, + required: Optional[SignTemplateAdditionalInfoFieldRequiredField] = None, + **kwargs + ): """ :param non_editable: Non editable fields. :type non_editable: Optional[List[SignTemplateAdditionalInfoFieldNonEditableField]], optional @@ -8126,8 +11386,18 @@ def __init__(self, non_editable: Optional[List[SignTemplateAdditionalInfoFieldNo self.non_editable = non_editable self.required = required + class SignTemplateReadySignLinkField(BaseObject): - def __init__(self, url: Optional[str] = None, name: Optional[str] = None, instructions: Optional[str] = None, folder_id: Optional[str] = None, is_notification_disabled: Optional[bool] = None, is_active: Optional[bool] = None, **kwargs): + def __init__( + self, + url: Optional[str] = None, + name: Optional[str] = None, + instructions: Optional[str] = None, + folder_id: Optional[str] = None, + is_notification_disabled: Optional[bool] = None, + is_active: Optional[bool] = None, + **kwargs + ): """ :param url: The URL that can be sent to signers. :type url: Optional[str], optional @@ -8155,8 +11425,16 @@ def __init__(self, url: Optional[str] = None, name: Optional[str] = None, instru self.is_notification_disabled = is_notification_disabled self.is_active = is_active + class SignTemplateCustomBrandingField(BaseObject): - def __init__(self, company_name: Optional[str] = None, logo_uri: Optional[str] = None, branding_color: Optional[str] = None, email_footer_text: Optional[str] = None, **kwargs): + def __init__( + self, + company_name: Optional[str] = None, + logo_uri: Optional[str] = None, + branding_color: Optional[str] = None, + email_footer_text: Optional[str] = None, + **kwargs + ): """ :param company_name: Name of the company :type company_name: Optional[str], optional @@ -8173,8 +11451,28 @@ def __init__(self, company_name: Optional[str] = None, logo_uri: Optional[str] = self.branding_color = branding_color self.email_footer_text = email_footer_text + class SignTemplate(BaseObject): - def __init__(self, id: Optional[str] = None, name: Optional[str] = None, email_subject: Optional[str] = None, email_message: Optional[str] = None, days_valid: Optional[int] = None, parent_folder: Optional[FolderMini] = None, source_files: Optional[List[FileMini]] = None, are_fields_locked: Optional[bool] = None, are_options_locked: Optional[bool] = None, are_recipients_locked: Optional[bool] = None, are_email_settings_locked: Optional[bool] = None, are_files_locked: Optional[bool] = None, signers: Optional[List[TemplateSigner]] = None, additional_info: Optional[SignTemplateAdditionalInfoField] = None, ready_sign_link: Optional[SignTemplateReadySignLinkField] = None, custom_branding: Optional[SignTemplateCustomBrandingField] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + email_subject: Optional[str] = None, + email_message: Optional[str] = None, + days_valid: Optional[int] = None, + parent_folder: Optional[FolderMini] = None, + source_files: Optional[List[FileMini]] = None, + are_fields_locked: Optional[bool] = None, + are_options_locked: Optional[bool] = None, + are_recipients_locked: Optional[bool] = None, + are_email_settings_locked: Optional[bool] = None, + are_files_locked: Optional[bool] = None, + signers: Optional[List[TemplateSigner]] = None, + additional_info: Optional[SignTemplateAdditionalInfoField] = None, + ready_sign_link: Optional[SignTemplateReadySignLinkField] = None, + custom_branding: Optional[SignTemplateCustomBrandingField] = None, + **kwargs + ): """ :param id: Template identifier. :type id: Optional[str], optional @@ -8226,6 +11524,7 @@ def __init__(self, id: Optional[str] = None, name: Optional[str] = None, email_s self.ready_sign_link = ready_sign_link self.custom_branding = custom_branding + class ShieldInformationBarrierReportDetailsDetailsField(BaseObject): def __init__(self, folder_id: Optional[str] = None, **kwargs): """ @@ -8235,19 +11534,37 @@ def __init__(self, folder_id: Optional[str] = None, **kwargs): super().__init__(**kwargs) self.folder_id = folder_id + class ShieldInformationBarrierReportDetails(BaseObject): - def __init__(self, details: Optional[ShieldInformationBarrierReportDetailsDetailsField] = None, **kwargs): + def __init__( + self, + details: Optional[ShieldInformationBarrierReportDetailsDetailsField] = None, + **kwargs + ): super().__init__(**kwargs) self.details = details + class ShieldInformationBarrierReportStatusField(str, Enum): PENDING = 'pending' ERROR = 'error' DONE = 'done' CANCELLED = 'cancelled' + class ShieldInformationBarrierReport(ShieldInformationBarrierReportBase): - def __init__(self, shield_information_barrier: Optional[ShieldInformationBarrierReference] = None, status: Optional[ShieldInformationBarrierReportStatusField] = None, details: Optional[ShieldInformationBarrierReportDetails] = None, created_at: Optional[str] = None, created_by: Optional[UserBase] = None, updated_at: Optional[str] = None, id: Optional[str] = None, type: Optional[ShieldInformationBarrierReportBaseTypeField] = None, **kwargs): + def __init__( + self, + shield_information_barrier: Optional[ShieldInformationBarrierReference] = None, + status: Optional[ShieldInformationBarrierReportStatusField] = None, + details: Optional[ShieldInformationBarrierReportDetails] = None, + created_at: Optional[str] = None, + created_by: Optional[UserBase] = None, + updated_at: Optional[str] = None, + id: Optional[str] = None, + type: Optional[ShieldInformationBarrierReportBaseTypeField] = None, + **kwargs + ): """ :param status: Status of the shield information report :type status: Optional[ShieldInformationBarrierReportStatusField], optional @@ -8270,11 +11587,19 @@ def __init__(self, shield_information_barrier: Optional[ShieldInformationBarrier self.created_by = created_by self.updated_at = updated_at + class TrackingCodeTypeField(str, Enum): TRACKING_CODE = 'tracking_code' + class TrackingCode(BaseObject): - def __init__(self, type: Optional[TrackingCodeTypeField] = None, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__( + self, + type: Optional[TrackingCodeTypeField] = None, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): """ :param type: `tracking_code` :type type: Optional[TrackingCodeTypeField], optional @@ -8289,16 +11614,25 @@ def __init__(self, type: Optional[TrackingCodeTypeField] = None, name: Optional[ self.name = name self.value = value + class UserFullRoleField(str, Enum): ADMIN = 'admin' COADMIN = 'coadmin' USER = 'user' + class UserFullEnterpriseFieldTypeField(str, Enum): ENTERPRISE = 'enterprise' + class UserFullEnterpriseField(BaseObject): - def __init__(self, id: Optional[str] = None, type: Optional[UserFullEnterpriseFieldTypeField] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + id: Optional[str] = None, + type: Optional[UserFullEnterpriseFieldTypeField] = None, + name: Optional[str] = None, + **kwargs + ): """ :param id: The unique identifier for this enterprise. :type id: Optional[str], optional @@ -8312,8 +11646,41 @@ def __init__(self, id: Optional[str] = None, type: Optional[UserFullEnterpriseFi self.type = type self.name = name + class UserFull(User): - def __init__(self, type: UserBaseTypeField, role: Optional[UserFullRoleField] = None, tracking_codes: Optional[List[TrackingCode]] = None, can_see_managed_users: Optional[bool] = None, is_sync_enabled: Optional[bool] = None, is_external_collab_restricted: Optional[bool] = None, is_exempt_from_device_limits: Optional[bool] = None, is_exempt_from_login_verification: Optional[bool] = None, enterprise: Optional[UserFullEnterpriseField] = None, my_tags: Optional[List[str]] = None, hostname: Optional[str] = None, is_platform_access_only: Optional[bool] = None, external_app_user_id: Optional[str] = None, created_at: Optional[str] = None, modified_at: Optional[str] = None, language: Optional[str] = None, timezone: Optional[str] = None, space_amount: Optional[int] = None, space_used: Optional[int] = None, max_upload_size: Optional[int] = None, status: Optional[UserStatusField] = None, job_title: Optional[str] = None, phone: Optional[str] = None, address: Optional[str] = None, avatar_url: Optional[str] = None, notification_email: Optional[UserNotificationEmailField] = None, name: Optional[str] = None, login: Optional[str] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + type: UserBaseTypeField, + role: Optional[UserFullRoleField] = None, + tracking_codes: Optional[List[TrackingCode]] = None, + can_see_managed_users: Optional[bool] = None, + is_sync_enabled: Optional[bool] = None, + is_external_collab_restricted: Optional[bool] = None, + is_exempt_from_device_limits: Optional[bool] = None, + is_exempt_from_login_verification: Optional[bool] = None, + enterprise: Optional[UserFullEnterpriseField] = None, + my_tags: Optional[List[str]] = None, + hostname: Optional[str] = None, + is_platform_access_only: Optional[bool] = None, + external_app_user_id: Optional[str] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, + language: Optional[str] = None, + timezone: Optional[str] = None, + space_amount: Optional[int] = None, + space_used: Optional[int] = None, + max_upload_size: Optional[int] = None, + status: Optional[UserStatusField] = None, + job_title: Optional[str] = None, + phone: Optional[str] = None, + address: Optional[str] = None, + avatar_url: Optional[str] = None, + notification_email: Optional[UserNotificationEmailField] = None, + name: Optional[str] = None, + login: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): """ :param type: `user` :type type: UserBaseTypeField @@ -8384,7 +11751,26 @@ def __init__(self, type: UserBaseTypeField, role: Optional[UserFullRoleField] = :param id: The unique identifier for this user :type id: Optional[str], optional """ - super().__init__(type=type, created_at=created_at, modified_at=modified_at, language=language, timezone=timezone, space_amount=space_amount, space_used=space_used, max_upload_size=max_upload_size, status=status, job_title=job_title, phone=phone, address=address, avatar_url=avatar_url, notification_email=notification_email, name=name, login=login, id=id, **kwargs) + super().__init__( + type=type, + created_at=created_at, + modified_at=modified_at, + language=language, + timezone=timezone, + space_amount=space_amount, + space_used=space_used, + max_upload_size=max_upload_size, + status=status, + job_title=job_title, + phone=phone, + address=address, + avatar_url=avatar_url, + notification_email=notification_email, + name=name, + login=login, + id=id, + **kwargs + ) self.role = role self.tracking_codes = tracking_codes self.can_see_managed_users = can_see_managed_users @@ -8398,19 +11784,35 @@ def __init__(self, type: UserBaseTypeField, role: Optional[UserFullRoleField] = self.is_platform_access_only = is_platform_access_only self.external_app_user_id = external_app_user_id + class MetadataFilterScopeField(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' ENTERPRISE__ENTERPRISE_ID_ = 'enterprise_{enterprise_id}' + class MetadataFilterFiltersField(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) + class MetadataFilter(BaseObject): - _fields_to_json_mapping: Dict[str, str] = {'template_key': 'templateKey', **BaseObject._fields_to_json_mapping} - _json_to_fields_mapping: Dict[str, str] = {'templateKey': 'template_key', **BaseObject._json_to_fields_mapping} - def __init__(self, scope: Optional[MetadataFilterScopeField] = None, template_key: Optional[str] = None, filters: Optional[MetadataFilterFiltersField] = None, **kwargs): + _fields_to_json_mapping: Dict[str, str] = { + 'template_key': 'templateKey', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'templateKey': 'template_key', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + scope: Optional[MetadataFilterScopeField] = None, + template_key: Optional[str] = None, + filters: Optional[MetadataFilterFiltersField] = None, + **kwargs + ): """ :param scope: Specifies the scope of the template to filter search results by. This will be `enterprise_{enterprise_id}` for templates defined @@ -8435,17 +11837,60 @@ def __init__(self, scope: Optional[MetadataFilterScopeField] = None, template_ke self.template_key = template_key self.filters = filters + class MetadataFieldFilterString(BaseObject): pass + class MetadataFieldFilterFloat(BaseObject): pass + class MetadataFieldFilterMultiSelect(BaseObject): pass + +class MetadataFieldFilterFloatRangeMapValue(BaseObject): + def __init__(self, lt: Optional[int] = None, gt: Optional[int] = 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 + :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 + """ + super().__init__(**kwargs) + self.lt = lt + self.gt = gt + + class MetadataFieldFilterFloatRange(BaseObject): pass + +class MetadataFieldFilterDateRangeMapValue(BaseObject): + def __init__(self, lt: Optional[str] = None, gt: Optional[str] = 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[str], 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[str], optional + """ + super().__init__(**kwargs) + self.lt = lt + self.gt = gt + + class MetadataFieldFilterDateRange(BaseObject): - pass \ No newline at end of file + pass diff --git a/docs/authorization.md b/docs/authorization.md index f9e5c43e..d0759ce8 100644 --- a/docs/authorization.md +++ b/docs/authorization.md @@ -1,6 +1,5 @@ # AuthorizationManager - - [Authorize user](#authorize-user) ## Authorize user @@ -18,7 +17,7 @@ This operation is performed by calling function `get_authorize`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-authorize/). -*Currently we don't have an example for calling `get_authorize` in integration tests* +_Currently we don't have an example for calling `get_authorize` in integration tests_ ### Arguments @@ -35,11 +34,8 @@ See the endpoint docs at - 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`. Does not return any data, but rather should be used in the browser. - - diff --git a/docs/avatars.md b/docs/avatars.md index f52628f5..f8035419 100644 --- a/docs/avatars.md +++ b/docs/avatars.md @@ -1,6 +1,5 @@ # AvatarsManager - - [Get user avatar](#get-user-avatar) - [Add or update user avatar](#add-or-update-user-avatar) - [Delete user avatar](#delete-user-avatar) @@ -15,6 +14,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-users-id-avatar/). + ```python client.avatars.get_user_avatar(user_id=user.id) ``` @@ -26,7 +26,6 @@ client.avatars.get_user_avatar(user_id=user.id) - 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`. @@ -35,7 +34,6 @@ When an avatar can be found for the user the image data will be returned in the body of the response. - ## Add or update user avatar Adds or updates a user avatar. @@ -46,6 +44,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-users-id-avatar/). + ```python client.avatars.create_user_avatar(user_id=user.id, pic=decode_base_64_byte_stream('iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEW10NBjBBbqAAAAH0lEQVRoge3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAvg0hAAABmmDh1QAAAABJRU5ErkJggg=='), pic_file_name='avatar.png', pic_content_type='image/png') ``` @@ -57,21 +56,19 @@ client.avatars.create_user_avatar(user_id=user.id, pic=decode_base_64_byte_strea - pic `ByteStream` - The image file to be uploaded to Box. Accepted file extensions are `.jpg` or `.png`. The maximum file size is 1MB. - pic_file_name `Optional[str]` - - + - - pic_content_type `Optional[str]` - - + - - 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 `UserAvatar`. -* `ok`: Returns the `pic_urls` object with URLs to existing -user avatars that were updated.* `created`: Returns the `pic_urls` object with URLS to user avatars -uploaded to Box with the request. - +- `ok`: Returns the `pic_urls` object with URLs to existing + user avatars that were updated.\* `created`: Returns the `pic_urls` object with URLS to user avatars + uploaded to Box with the request. ## Delete user avatar @@ -84,6 +81,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-users-id-avatar/). + ```python client.avatars.delete_user_avatar(user_id=user.id) ``` @@ -95,11 +93,8 @@ client.avatars.delete_user_avatar(user_id=user.id) - 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`. -* `no_content`: Removes the avatar and returns an empty response. - - +- `no_content`: Removes the avatar and returns an empty response. diff --git a/docs/chunked_uploads.md b/docs/chunked_uploads.md index 700b4998..f43f6dd9 100644 --- a/docs/chunked_uploads.md +++ b/docs/chunked_uploads.md @@ -19,7 +19,7 @@ This operation is performed by calling function `create_file_upload_session`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-upload-sessions/). -*Currently we don't have an example for calling `create_file_upload_session` in integration tests* +_Currently we don't have an example for calling `create_file_upload_session` in integration tests_ ### Arguments @@ -32,14 +32,12 @@ See the endpoint docs at - 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 `UploadSession`. Returns a new upload session. - ## Create upload session for existing file Creates an upload session for an existing file. @@ -49,12 +47,12 @@ This operation is performed by calling function `create_file_upload_session_for_ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-id-upload-sessions/). -*Currently we don't have an example for calling `create_file_upload_session_for_existing_file` in integration tests* +_Currently we don't have an example for calling `create_file_upload_session_for_existing_file` in integration tests_ ### Arguments - 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" + - 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" - file_size `int` - The total number of bytes of the file to be uploaded - file_name `Optional[str]` @@ -62,14 +60,12 @@ See the endpoint docs at - 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 `UploadSession`. Returns a new upload session. - ## Get upload session Return information about an upload session. @@ -79,7 +75,7 @@ This operation is performed by calling function `get_file_upload_session_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-upload-sessions-id/). -*Currently we don't have an example for calling `get_file_upload_session_by_id` in integration tests* +_Currently we don't have an example for calling `get_file_upload_session_by_id` in integration tests_ ### Arguments @@ -88,14 +84,12 @@ See the endpoint docs at - 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 `UploadSession`. Returns an upload session object. - ## Upload part of file Updates a chunk of an upload session for a file. @@ -105,7 +99,7 @@ This operation is performed by calling function `upload_file_part`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-upload-sessions-id/). -*Currently we don't have an example for calling `upload_file_part` in integration tests* +_Currently we don't have an example for calling `upload_file_part` in integration tests_ ### Arguments @@ -114,20 +108,18 @@ See the endpoint docs at - request_body `ByteStream` - Request body of uploadFilePart method - digest `str` - - The [RFC3230][1] message digest of the chunk uploaded. Only SHA1 is supported. The SHA1 digest must be base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. To get the value for the `SHA` digest, use the openSSL command to encode the file part: `openssl sha1 -binary | base64` [1]: https://tools.ietf.org/html/rfc3230 + - The [RFC3230][1] message digest of the chunk uploaded. Only SHA1 is supported. The SHA1 digest must be base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. To get the value for the `SHA` digest, use the openSSL command to encode the file part: `openssl sha1 -binary | base64` [1]: https://tools.ietf.org/html/rfc3230 - content_range `str` - - The byte range of the chunk. Must not overlap with the range of a part already uploaded this session. Each part’s size must be exactly equal in size to the part size specified in the upload session that you created. One exception is the last part of the file, as this can be smaller. When providing the value for `content-range`, remember that: * The lower bound of each part's byte range must be a multiple of the part size. * The higher bound must be a multiple of the part size - 1. + - The byte range of the chunk. Must not overlap with the range of a part already uploaded this session. Each part’s size must be exactly equal in size to the part size specified in the upload session that you created. One exception is the last part of the file, as this can be smaller. When providing the value for `content-range`, remember that: _ The lower bound of each part's byte range must be a multiple of the part size. _ The higher bound must be a multiple of the part size - 1. - 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 `UploadedPart`. Chunk has been uploaded successfully. - ## Remove upload session Abort an upload session and discard all data uploaded. @@ -139,7 +131,7 @@ This operation is performed by calling function `delete_file_upload_session_by_i See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-upload-sessions-id/). -*Currently we don't have an example for calling `delete_file_upload_session_by_id` in integration tests* +_Currently we don't have an example for calling `delete_file_upload_session_by_id` in integration tests_ ### Arguments @@ -148,7 +140,6 @@ See the endpoint docs at - 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`. @@ -156,7 +147,6 @@ This function returns a value of type `None`. A blank response is returned if the session was successfully aborted. - ## List parts Return a list of the chunks uploaded to the upload @@ -167,27 +157,25 @@ This operation is performed by calling function `get_file_upload_session_parts`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-upload-sessions-id-parts/). -*Currently we don't have an example for calling `get_file_upload_session_parts` in integration tests* +_Currently we don't have an example for calling `get_file_upload_session_parts` in integration tests_ ### Arguments - upload_session_id `str` - The ID of the upload session. Example: "D5E3F7A" - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `UploadParts`. Returns a list of parts that have been uploaded. - ## Commit upload session Close an upload session and create a file from the @@ -198,7 +186,7 @@ This operation is performed by calling function `create_file_upload_session_comm See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-upload-sessions-id-commit/). -*Currently we don't have an example for calling `create_file_upload_session_commit` in integration tests* +_Currently we don't have an example for calling `create_file_upload_session_commit` in integration tests_ ### Arguments @@ -207,15 +195,14 @@ See the endpoint docs at - parts `List[UploadPart]` - The list details for the uploaded parts - digest `str` - - The [RFC3230][1] message digest of the whole file. Only SHA1 is supported. The SHA1 digest must be Base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. [1]: https://tools.ietf.org/html/rfc3230 + - The [RFC3230][1] message digest of the whole file. Only SHA1 is supported. The SHA1 digest must be Base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. [1]: https://tools.ietf.org/html/rfc3230 - if_match `Optional[str]` - - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since. + - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since. - if_none_match `Optional[str]` - - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since. + - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since. - 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 `Files`. @@ -225,5 +212,3 @@ Returns the file object in a list.Returns when all chunks have been uploaded but Inspect the upload session to get more information about the progress of processing the chunks, then retry committing the file when all chunks have processed. - - diff --git a/docs/classifications.md b/docs/classifications.md index d5e65758..518db777 100644 --- a/docs/classifications.md +++ b/docs/classifications.md @@ -1,6 +1,5 @@ # ClassificationsManager - - [List all classifications](#list-all-classifications) - [Delete all classifications](#delete-all-classifications) - [Add classification](#add-classification) @@ -22,14 +21,13 @@ This operation is performed by calling function `get_metadata_template_enterpris See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-templates-enterprise-security-classification-6-vm-vochw-u-wo-schema/). -*Currently we don't have an example for calling `get_metadata_template_enterprise_security_classification_schema` in integration tests* +_Currently we don't have an example for calling `get_metadata_template_enterprise_security_classification_schema` in integration tests_ ### Arguments - 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 `ClassificationTemplate`. @@ -38,7 +36,6 @@ Returns the `securityClassification` metadata template, which contains a `Box__Security__Classification__Key` field that lists all the classifications available to this enterprise. - ## Delete all classifications Delete all classifications by deleting the classification @@ -49,14 +46,13 @@ This operation is performed by calling function `delete_metadata_template_enterp See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-metadata-templates-enterprise-security-classification-6-vm-vochw-u-wo-schema/). -*Currently we don't have an example for calling `delete_metadata_template_enterprise_security_classification_schema` in integration tests* +_Currently we don't have an example for calling `delete_metadata_template_enterprise_security_classification_schema` in integration tests_ ### Arguments - 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`. @@ -64,7 +60,6 @@ This function returns a value of type `None`. Returns an empty response when the metadata template for classifications is successfully deleted. - ## Add classification Adds one or more new classifications to the list of classifications @@ -79,7 +74,7 @@ This operation is performed by calling function `update_metadata_template_enterp See the endpoint docs at [API Reference](https://developer.box.com/reference/put-metadata-templates-enterprise-security-classification-6-vm-vochw-u-wo-schema-add/). -*Currently we don't have an example for calling `update_metadata_template_enterprise_security_classification_schema_add` in integration tests* +_Currently we don't have an example for calling `update_metadata_template_enterprise_security_classification_schema_add` in integration tests_ ### Arguments @@ -88,7 +83,6 @@ See the endpoint docs at - 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 `ClassificationTemplate`. @@ -97,7 +91,6 @@ Returns the updated `securityClassification` metadata template, which contains a `Box__Security__Classification__Key` field that lists all the classifications available to this enterprise. - ## Update classification Updates the labels and descriptions of one or more classifications @@ -112,7 +105,7 @@ This operation is performed by calling function `update_metadata_template_enterp See the endpoint docs at [API Reference](https://developer.box.com/reference/put-metadata-templates-enterprise-security-classification-6-vm-vochw-u-wo-schema-update/). -*Currently we don't have an example for calling `update_metadata_template_enterprise_security_classification_schema_update` in integration tests* +_Currently we don't have an example for calling `update_metadata_template_enterprise_security_classification_schema_update` in integration tests_ ### Arguments @@ -121,7 +114,6 @@ See the endpoint docs at - 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 `ClassificationTemplate`. @@ -130,7 +122,6 @@ Returns the updated `securityClassification` metadata template, which contains a `Box__Security__Classification__Key` field that lists all the classifications available to this enterprise. - ## Delete classification Removes a classification from the list of classifications @@ -145,7 +136,7 @@ This operation is performed by calling function `update_metadata_template_enterp See the endpoint docs at [API Reference](https://developer.box.com/reference/put-metadata-templates-enterprise-security-classification-6-vm-vochw-u-wo-schema-delete/). -*Currently we don't have an example for calling `update_metadata_template_enterprise_security_classification_schema_delete` in integration tests* +_Currently we don't have an example for calling `update_metadata_template_enterprise_security_classification_schema_delete` in integration tests_ ### Arguments @@ -154,7 +145,6 @@ See the endpoint docs at - 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 `ClassificationTemplate`. @@ -163,7 +153,6 @@ Returns the updated `securityClassification` metadata template, which contains a `Box__Security__Classification__Key` field that lists all the classifications available to this enterprise. - ## Add initial classifications When an enterprise does not yet have any classifications, this API call @@ -179,7 +168,7 @@ This operation is performed by calling function `create_metadata_template_schema See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-templates-schema-classifications/). -*Currently we don't have an example for calling `create_metadata_template_schema_classification` in integration tests* +_Currently we don't have an example for calling `create_metadata_template_schema_classification` in integration tests_ ### Arguments @@ -198,7 +187,6 @@ See the endpoint docs at - 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 `ClassificationTemplate`. @@ -206,5 +194,3 @@ This function returns a value of type `ClassificationTemplate`. Returns a new `securityClassification` metadata template, which contains a `Box__Security__Classification__Key` field that lists all the classifications available to this enterprise. - - diff --git a/docs/collaboration_allowlist_entries.md b/docs/collaboration_allowlist_entries.md index 0ab8d9a4..f8b03a75 100644 --- a/docs/collaboration_allowlist_entries.md +++ b/docs/collaboration_allowlist_entries.md @@ -1,6 +1,5 @@ # CollaborationAllowlistEntriesManager - - [List allowed collaboration domains](#list-allowed-collaboration-domains) - [Add domain to list of allowed collaboration domains](#add-domain-to-list-of-allowed-collaboration-domains) - [Get allowed collaboration domain](#get-allowed-collaboration-domain) @@ -16,25 +15,23 @@ This operation is performed by calling function `get_collaboration_whitelist_ent See the endpoint docs at [API Reference](https://developer.box.com/reference/get-collaboration-whitelist-entries/). -*Currently we don't have an example for calling `get_collaboration_whitelist_entries` in integration tests* +_Currently we don't have an example for calling `get_collaboration_whitelist_entries` in integration tests_ ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `CollaborationAllowlistEntries`. Returns a collection of domains that are allowed for collaboration. - ## Add domain to list of allowed collaboration domains Creates a new entry in the list of allowed domains to allow @@ -45,7 +42,7 @@ This operation is performed by calling function `create_collaboration_whitelist_ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-collaboration-whitelist-entries/). -*Currently we don't have an example for calling `create_collaboration_whitelist_entry` in integration tests* +_Currently we don't have an example for calling `create_collaboration_whitelist_entry` in integration tests_ ### Arguments @@ -56,14 +53,12 @@ See the endpoint docs at - 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 `CollaborationAllowlistEntry`. Returns a new entry on the list of allowed domains. - ## Get allowed collaboration domain Returns a domain that has been deemed safe to create collaborations @@ -74,7 +69,7 @@ This operation is performed by calling function `get_collaboration_whitelist_ent See the endpoint docs at [API Reference](https://developer.box.com/reference/get-collaboration-whitelist-entries-id/). -*Currently we don't have an example for calling `get_collaboration_whitelist_entry_by_id` in integration tests* +_Currently we don't have an example for calling `get_collaboration_whitelist_entry_by_id` in integration tests_ ### Arguments @@ -83,14 +78,12 @@ See the endpoint docs at - 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 `CollaborationAllowlistEntry`. Returns an entry on the list of allowed domains. - ## Remove domain from list of allowed collaboration domains Removes a domain from the list of domains that have been deemed safe to create @@ -101,7 +94,7 @@ This operation is performed by calling function `delete_collaboration_whitelist_ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-collaboration-whitelist-entries-id/). -*Currently we don't have an example for calling `delete_collaboration_whitelist_entry_by_id` in integration tests* +_Currently we don't have an example for calling `delete_collaboration_whitelist_entry_by_id` in integration tests_ ### Arguments @@ -110,12 +103,9 @@ See the endpoint docs at - 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`. A blank response is returned if the entry was successfully deleted. - - diff --git a/docs/collaboration_allowlist_exempt_targets.md b/docs/collaboration_allowlist_exempt_targets.md index d0fc74ee..a5cfdf08 100644 --- a/docs/collaboration_allowlist_exempt_targets.md +++ b/docs/collaboration_allowlist_exempt_targets.md @@ -1,6 +1,5 @@ # CollaborationAllowlistExemptTargetsManager - - [List users exempt from collaboration domain restrictions](#list-users-exempt-from-collaboration-domain-restrictions) - [Create user exemption from collaboration domain restrictions](#create-user-exemption-from-collaboration-domain-restrictions) - [Get user exempt from collaboration domain restrictions](#get-user-exempt-from-collaboration-domain-restrictions) @@ -16,25 +15,23 @@ This operation is performed by calling function `get_collaboration_whitelist_exe See the endpoint docs at [API Reference](https://developer.box.com/reference/get-collaboration-whitelist-exempt-targets/). -*Currently we don't have an example for calling `get_collaboration_whitelist_exempt_targets` in integration tests* +_Currently we don't have an example for calling `get_collaboration_whitelist_exempt_targets` in integration tests_ ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `CollaborationAllowlistExemptTargets`. Returns a collection of user exemptions. - ## Create user exemption from collaboration domain restrictions Exempts a user from the restrictions set out by the allowed list of domains @@ -45,7 +42,7 @@ This operation is performed by calling function `create_collaboration_whitelist_ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-collaboration-whitelist-exempt-targets/). -*Currently we don't have an example for calling `create_collaboration_whitelist_exempt_target` in integration tests* +_Currently we don't have an example for calling `create_collaboration_whitelist_exempt_target` in integration tests_ ### Arguments @@ -54,14 +51,12 @@ See the endpoint docs at - 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 `CollaborationAllowlistExemptTarget`. Returns a new exemption entry. - ## Get user exempt from collaboration domain restrictions Returns a users who has been exempt from the collaboration @@ -72,7 +67,7 @@ This operation is performed by calling function `get_collaboration_whitelist_exe See the endpoint docs at [API Reference](https://developer.box.com/reference/get-collaboration-whitelist-exempt-targets-id/). -*Currently we don't have an example for calling `get_collaboration_whitelist_exempt_target_by_id` in integration tests* +_Currently we don't have an example for calling `get_collaboration_whitelist_exempt_target_by_id` in integration tests_ ### Arguments @@ -81,14 +76,12 @@ See the endpoint docs at - 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 `CollaborationAllowlistExemptTarget`. Returns the user's exempted from the list of collaboration domains. - ## Remove user from list of users exempt from domain restrictions Removes a user's exemption from the restrictions set out by the allowed list @@ -99,7 +92,7 @@ This operation is performed by calling function `delete_collaboration_whitelist_ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-collaboration-whitelist-exempt-targets-id/). -*Currently we don't have an example for calling `delete_collaboration_whitelist_exempt_target_by_id` in integration tests* +_Currently we don't have an example for calling `delete_collaboration_whitelist_exempt_target_by_id` in integration tests_ ### Arguments @@ -108,12 +101,9 @@ See the endpoint docs at - 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`. A blank response is returned if the exemption was successfully deleted. - - diff --git a/docs/collections.md b/docs/collections.md index e2f34f1d..2b4f1f18 100644 --- a/docs/collections.md +++ b/docs/collections.md @@ -1,6 +1,5 @@ # CollectionsManager - - [List all collections](#list-all-collections) - [List collection items](#list-collection-items) @@ -17,6 +16,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-collections/). + ```python client.collections.get_collections() ``` @@ -24,22 +24,20 @@ client.collections.get_collections() ### Arguments - fields `Optional[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. + - 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. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `Collections`. Returns all collections for the given user - ## List collection items Retrieves the files and/or folders contained within @@ -51,6 +49,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-collections-id-items/). + ```python client.collections.get_collection_items(collection_id=favourite_collection.id) ``` @@ -60,19 +59,16 @@ client.collections.get_collection_items(collection_id=favourite_collection.id) - collection_id `str` - The ID of the collection. Example: "926489" - fields `Optional[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. + - 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. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `Items`. Returns an array of items in the collection. - - diff --git a/docs/comments.md b/docs/comments.md index 445e8e3d..1e47a845 100644 --- a/docs/comments.md +++ b/docs/comments.md @@ -1,6 +1,5 @@ # CommentsManager - - [List file comments](#list-file-comments) - [Get comment](#get-comment) - [Update comment](#update-comment) @@ -17,6 +16,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-comments/). + ```python client.comments.get_file_comments(file_id=file_id) ``` @@ -24,17 +24,16 @@ client.comments.get_file_comments(file_id=file_id) ### Arguments - 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" + - 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" - fields `Optional[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. + - 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. - limit `Optional[int]` - The maximum number of items to return per page. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - 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 `Comments`. @@ -42,7 +41,6 @@ This function returns a value of type `Comments`. Returns a collection of comment objects. If there are no comments on this file an empty collection will be returned. - ## Get comment Retrieves the message and metadata for a specific comment, as well @@ -54,6 +52,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-comments-id/). + ```python client.comments.get_comment_by_id(comment_id=new_comment.id) ``` @@ -63,18 +62,16 @@ client.comments.get_comment_by_id(comment_id=new_comment.id) - comment_id `str` - The ID of the comment. Example: "12345" - fields `Optional[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. + - 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. - 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 `CommentFull`. Returns a full comment object. - ## Update comment Update the message of a comment. @@ -85,6 +82,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/put-comments-id/). + ```python client.comments.update_comment_by_id(comment_id=new_reply_comment.id, message=new_message) ``` @@ -96,18 +94,16 @@ client.comments.update_comment_by_id(comment_id=new_reply_comment.id, message=ne - message `Optional[str]` - The text of the comment to update - fields `Optional[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. + - 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. - 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 `CommentFull`. Returns the updated comment object. - ## Remove comment Permanently deletes a comment. @@ -118,6 +114,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-comments-id/). + ```python client.comments.delete_comment_by_id(comment_id=new_comment.id) ``` @@ -129,14 +126,12 @@ client.comments.delete_comment_by_id(comment_id=new_comment.id) - 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`. Returns an empty response when the comment has been deleted. - ## Create comment Adds a comment by the user to a specific file, or @@ -148,6 +143,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-comments/). + ```python client.comments.create_comment(message=message, item=CreateCommentItemArg(id=new_comment.id, type=CreateCommentItemArgTypeField.COMMENT.value)) ``` @@ -155,17 +151,16 @@ client.comments.create_comment(message=message, item=CreateCommentItemArg(id=new ### Arguments - message `str` - - The text of the comment. To mention a user, use the `tagged_message` parameter instead. + - The text of the comment. To mention a user, use the `tagged_message` parameter instead. - tagged_message `Optional[str]` - - The text of the comment, including `@[user_id:name]` somewhere in the message to mention another user, which will send them an email notification, letting them know they have been mentioned. The `user_id` is the target user's ID, where the `name` can be any custom phrase. In the Box UI this name will link to the user's profile. If you are not mentioning another user, use `message` instead. + - The text of the comment, including `@[user_id:name]` somewhere in the message to mention another user, which will send them an email notification, letting them know they have been mentioned. The `user_id` is the target user's ID, where the `name` can be any custom phrase. In the Box UI this name will link to the user's profile. If you are not mentioning another user, use `message` instead. - item `CreateCommentItemArg` - The item to attach the comment to. - fields `Optional[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. + - 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. - 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 `Comment`. @@ -175,5 +170,3 @@ Returns the newly created comment object. Not all available fields are returned by default. Use the [fields](#param-fields) query parameter to explicitly request any specific fields. - - diff --git a/docs/device_pinners.md b/docs/device_pinners.md index 5c81d839..f16d69b8 100644 --- a/docs/device_pinners.md +++ b/docs/device_pinners.md @@ -1,6 +1,5 @@ # DevicePinnersManager - - [Get device pin](#get-device-pin) - [Remove device pin](#remove-device-pin) - [List enterprise device pins](#list-enterprise-device-pins) @@ -14,7 +13,7 @@ This operation is performed by calling function `get_device_pinner_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-device-pinners-id/). -*Currently we don't have an example for calling `get_device_pinner_by_id` in integration tests* +_Currently we don't have an example for calling `get_device_pinner_by_id` in integration tests_ ### Arguments @@ -23,14 +22,12 @@ See the endpoint docs at - 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 `DevicePinner`. Returns information about a single device pin. - ## Remove device pin Deletes an individual device pin. @@ -40,7 +37,7 @@ This operation is performed by calling function `delete_device_pinner_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-device-pinners-id/). -*Currently we don't have an example for calling `delete_device_pinner_by_id` in integration tests* +_Currently we don't have an example for calling `delete_device_pinner_by_id` in integration tests_ ### Arguments @@ -49,14 +46,12 @@ See the endpoint docs at - 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`. Returns an empty response when the pin has been deleted. - ## List enterprise device pins Retrieves all the device pins within an enterprise. @@ -69,14 +64,14 @@ This operation is performed by calling function `get_enterprise_device_pinners`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-enterprises-id-device-pinners/). -*Currently we don't have an example for calling `get_enterprise_device_pinners` in integration tests* +_Currently we don't have an example for calling `get_enterprise_device_pinners` in integration tests_ ### Arguments - enterprise_id `str` - The ID of the enterprise Example: "3442311" - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - direction `Optional[GetEnterpriseDevicePinnersDirectionArg]` @@ -84,11 +79,8 @@ See the endpoint docs at - 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 `DevicePinners`. Returns a list of device pins for a given enterprise. - - diff --git a/docs/email_aliases.md b/docs/email_aliases.md index 4b690a80..ea6f2ab5 100644 --- a/docs/email_aliases.md +++ b/docs/email_aliases.md @@ -1,6 +1,5 @@ # EmailAliasesManager - - [List user's email aliases](#list-users-email-aliases) - [Create email alias](#create-email-alias) - [Remove email alias](#remove-email-alias) @@ -16,6 +15,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-users-id-email-aliases/). + ```python client.email_aliases.get_user_email_aliases(user_id=new_user.id) ``` @@ -27,14 +27,12 @@ client.email_aliases.get_user_email_aliases(user_id=new_user.id) - 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 `EmailAliases`. Returns a collection of email aliases. - ## Create email alias Adds a new email alias to a user account.. @@ -45,6 +43,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-users-id-email-aliases/). + ```python client.email_aliases.create_user_email_alias(user_id=new_user.id, email=new_alias_email) ``` @@ -54,18 +53,16 @@ client.email_aliases.create_user_email_alias(user_id=new_user.id, email=new_alia - user_id `str` - The ID of the user. Example: "12345" - email `str` - - The email address to add to the account as an alias. Note: The domain of the email alias needs to be registered to your enterprise. See the [domain verification guide]( https://support.box.com/hc/en-us/articles/4408619650579-Domain-Verification ) for steps to add a new domain. + - The email address to add to the account as an alias. Note: The domain of the email alias needs to be registered to your enterprise. See the [domain verification guide](https://support.box.com/hc/en-us/articles/4408619650579-Domain-Verification) for steps to add a new domain. - 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 `EmailAlias`. Returns the newly created email alias object. - ## Remove email alias Removes an email alias from a user. @@ -76,6 +73,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-users-id-email-aliases-id/). + ```python client.email_aliases.delete_user_email_alias_by_id(user_id=new_user.id, email_alias_id=new_alias.id) ``` @@ -89,11 +87,8 @@ client.email_aliases.delete_user_email_alias_by_id(user_id=new_user.id, email_al - 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`. Removes the alias and returns an empty response. - - diff --git a/docs/events.md b/docs/events.md index 936c4b79..16344c0e 100644 --- a/docs/events.md +++ b/docs/events.md @@ -1,6 +1,5 @@ # EventsManager - - [List user and enterprise events](#list-user-and-enterprise-events) - [Get events long poll endpoint](#get-events-long-poll-endpoint) @@ -21,16 +20,16 @@ This operation is performed by calling function `get_events`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-events/). -*Currently we don't have an example for calling `get_events` in integration tests* +_Currently we don't have an example for calling `get_events` in integration tests_ ### Arguments - stream_type `Optional[GetEventsStreamTypeArg]` - - Defines the type of events that are returned * `all` returns everything for a user and is the default * `changes` returns events that may cause file tree changes such as file updates or collaborations. * `sync` is similar to `changes` but only applies to synced folders * `admin_logs` returns all events for an entire enterprise and requires the user making the API call to have admin permissions. This stream type is for programmatically pulling from a 1 year history of events across all users within the enterprise and within a `created_after` and `created_before` time frame. The complete history of events will be returned in chronological order based on the event time, but latency will be much higher than `admin_logs_streaming`. * `admin_logs_streaming` returns all events for an entire enterprise and requires the user making the API call to have admin permissions. This stream type is for polling for recent events across all users within the enterprise. Latency will be much lower than `admin_logs`, but events will not be returned in chronological order and may contain duplicates. + - Defines the type of events that are returned _ `all` returns everything for a user and is the default _ `changes` returns events that may cause file tree changes such as file updates or collaborations. _ `sync` is similar to `changes` but only applies to synced folders _ `admin_logs` returns all events for an entire enterprise and requires the user making the API call to have admin permissions. This stream type is for programmatically pulling from a 1 year history of events across all users within the enterprise and within a `created_after` and `created_before` time frame. The complete history of events will be returned in chronological order based on the event time, but latency will be much higher than `admin_logs_streaming`. \* `admin_logs_streaming` returns all events for an entire enterprise and requires the user making the API call to have admin permissions. This stream type is for polling for recent events across all users within the enterprise. Latency will be much lower than `admin_logs`, but events will not be returned in chronological order and may contain duplicates. - stream_position `Optional[str]` - - The location in the event stream to start receiving events from. * `now` will return an empty list events and the latest stream position for initialization. * `0` or `null` will return all events. + - The location in the event stream to start receiving events from. _ `now` will return an empty list events and the latest stream position for initialization. _ `0` or `null` will return all events. - limit `Optional[int]` - - Limits the number of events returned Note: Sometimes, the events less than the limit requested can be returned even when there may be more events remaining. This is primarily done in the case where a number of events have already been retrieved and these retrieved events are returned rather than delaying for an unknown amount of time to see if there are any more results. + - Limits the number of events returned Note: Sometimes, the events less than the limit requested can be returned even when there may be more events remaining. This is primarily done in the case where a number of events have already been retrieved and these retrieved events are returned rather than delaying for an unknown amount of time to see if there are any more results. - event_type `Optional[str]` - A comma-separated list of events to filter by. This can only be used when requesting the events with a `stream_type` of `admin_logs` or `adming_logs_streaming`. For any other `stream_type` this value will be ignored. - created_after `Optional[str]` @@ -40,7 +39,6 @@ See the endpoint docs at - 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 `Events`. @@ -53,7 +51,6 @@ including a list of event objects. The response includes a chunk, as well as the next `stream_position` that can be queried. - ## Get events long poll endpoint Returns a list of real-time servers that can be used for long-polling updates @@ -95,19 +92,16 @@ This operation is performed by calling function `get_events_with_long_polling`. See the endpoint docs at [API Reference](https://developer.box.com/reference/options-events/). -*Currently we don't have an example for calling `get_events_with_long_polling` in integration tests* +_Currently we don't have an example for calling `get_events_with_long_polling` in integration tests_ ### Arguments - 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 `RealtimeServers`. Returns a paginated array of servers that can be used instead of the regular endpoints for long-polling events. - - diff --git a/docs/file_classifications.md b/docs/file_classifications.md index 08845079..0773566c 100644 --- a/docs/file_classifications.md +++ b/docs/file_classifications.md @@ -1,6 +1,5 @@ # FileClassificationsManager - - [Get classification on file](#get-classification-on-file) - [Add classification to file](#add-classification-to-file) - [Update classification on file](#update-classification-on-file) @@ -20,16 +19,15 @@ This operation is performed by calling function `get_file_metadata_enterprise_se See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-metadata-enterprise-security-classification-6-vm-vochw-u-wo/). -*Currently we don't have an example for calling `get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo` in integration tests* +_Currently we don't have an example for calling `get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo` in integration tests_ ### Arguments - 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" + - 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" - 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 `Classification`. @@ -39,7 +37,6 @@ template, which contains a `Box__Security__Classification__Key` field that lists all the classifications available to this enterprise. - ## Add classification to file Adds a classification to a file by specifying the label of the @@ -54,18 +51,17 @@ This operation is performed by calling function `create_file_metadata_enterprise See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-id-metadata-enterprise-security-classification-6-vm-vochw-u-wo/). -*Currently we don't have an example for calling `create_file_metadata_enterprise_security_classification` in integration tests* +_Currently we don't have an example for calling `create_file_metadata_enterprise_security_classification` in integration tests_ ### Arguments - 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" + - 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" - box_security_classification_key `Optional[str]` - - The name of the classification to apply to this file. To list the available classifications in an enterprise, use the classification API to retrieve the [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema) which lists all available classification keys. + - The name of the classification to apply to this file. To list the available classifications in an enterprise, use the classification API to retrieve the [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema) which lists all available classification keys. - 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 `Classification`. @@ -73,7 +69,6 @@ This function returns a value of type `Classification`. Returns the classification template instance that was applied to the file. - ## Update classification on file Updates a classification on a file. @@ -87,25 +82,23 @@ This operation is performed by calling function `update_file_metadata_enterprise See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-metadata-enterprise-security-classification-6-vm-vochw-u-wo/). -*Currently we don't have an example for calling `update_file_metadata_enterprise_security_classification` in integration tests* +_Currently we don't have an example for calling `update_file_metadata_enterprise_security_classification` in integration tests_ ### Arguments - 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" + - 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" - request_body `List[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArg]` - Request body of updateFileMetadataEnterpriseSecurityClassification method - 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 `Classification`. Returns the updated classification metadata template instance. - ## Remove classification from file Removes any classifications from a file. @@ -119,21 +112,18 @@ This operation is performed by calling function `delete_file_metadata_enterprise See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-id-metadata-enterprise-security-classification-6-vm-vochw-u-wo/). -*Currently we don't have an example for calling `delete_file_metadata_enterprise_security_classification` in integration tests* +_Currently we don't have an example for calling `delete_file_metadata_enterprise_security_classification` in integration tests_ ### Arguments - 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" + - 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" - 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`. Returns an empty response when the classification is successfully deleted. - - diff --git a/docs/file_metadata.md b/docs/file_metadata.md index 3b7b2e56..83d8451b 100644 --- a/docs/file_metadata.md +++ b/docs/file_metadata.md @@ -1,6 +1,5 @@ # FileMetadataManager - - [List metadata instances on file](#list-metadata-instances-on-file) - [Get metadata instance on file](#get-metadata-instance-on-file) - [Create metadata instance on file](#create-metadata-instance-on-file) @@ -16,16 +15,15 @@ This operation is performed by calling function `get_file_metadata`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-metadata/). -*Currently we don't have an example for calling `get_file_metadata` in integration tests* +_Currently we don't have an example for calling `get_file_metadata` in integration tests_ ### Arguments - 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" + - 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" - 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 `Metadatas`. @@ -35,7 +33,6 @@ Returns all the metadata associated with a file. This API does not support pagination and will therefore always return all of the metadata associated to the file. - ## Get metadata instance on file Retrieves the instance of a metadata template that has been applied to a @@ -46,12 +43,12 @@ This operation is performed by calling function `get_file_metadata_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-metadata-id-id/). -*Currently we don't have an example for calling `get_file_metadata_by_id` in integration tests* +_Currently we don't have an example for calling `get_file_metadata_by_id` in integration tests_ ### Arguments - 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" + - 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" - scope `GetFileMetadataByIdScopeArg` - The scope of the metadata template Example: "global" - template_key `str` @@ -59,7 +56,6 @@ See the endpoint docs at - 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 `MetadataFull`. @@ -68,7 +64,6 @@ An instance of the metadata template that includes additional "key:value" pairs defined by the user or an application. - ## Create metadata instance on file Applies an instance of a metadata template to a file. @@ -82,12 +77,12 @@ This operation is performed by calling function `create_file_metadata_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-id-metadata-id-id/). -*Currently we don't have an example for calling `create_file_metadata_by_id` in integration tests* +_Currently we don't have an example for calling `create_file_metadata_by_id` in integration tests_ ### Arguments - 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" + - 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" - scope `CreateFileMetadataByIdScopeArg` - The scope of the metadata template Example: "global" - template_key `str` @@ -97,7 +92,6 @@ See the endpoint docs at - 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 `Metadata`. @@ -105,7 +99,6 @@ This function returns a value of type `Metadata`. Returns the instance of the template that was applied to the file, including the data that was applied to the template. - ## Update metadata instance on file Updates a piece of metadata on a file. @@ -122,12 +115,12 @@ This operation is performed by calling function `update_file_metadata_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-metadata-id-id/). -*Currently we don't have an example for calling `update_file_metadata_by_id` in integration tests* +_Currently we don't have an example for calling `update_file_metadata_by_id` in integration tests_ ### Arguments - 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" + - 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" - scope `UpdateFileMetadataByIdScopeArg` - The scope of the metadata template Example: "global" - template_key `str` @@ -137,7 +130,6 @@ See the endpoint docs at - 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 `Metadata`. @@ -145,7 +137,6 @@ This function returns a value of type `Metadata`. Returns the updated metadata template instance, with the custom template data included. - ## Remove metadata instance from file Deletes a piece of file metadata. @@ -155,12 +146,12 @@ This operation is performed by calling function `delete_file_metadata_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-id-metadata-id-id/). -*Currently we don't have an example for calling `delete_file_metadata_by_id` in integration tests* +_Currently we don't have an example for calling `delete_file_metadata_by_id` in integration tests_ ### Arguments - 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" + - 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" - scope `DeleteFileMetadataByIdScopeArg` - The scope of the metadata template Example: "global" - template_key `str` @@ -168,12 +159,9 @@ See the endpoint docs at - 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`. Returns an empty response when the metadata is successfully deleted. - - diff --git a/docs/file_requests.md b/docs/file_requests.md index 5f7da164..d7180df2 100644 --- a/docs/file_requests.md +++ b/docs/file_requests.md @@ -1,6 +1,5 @@ # FileRequestsManager - - [Get file request](#get-file-request) - [Update file request](#update-file-request) - [Delete file request](#delete-file-request) @@ -15,23 +14,21 @@ This operation is performed by calling function `get_file_request_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-file-requests-id/). -*Currently we don't have an example for calling `get_file_request_by_id` in integration tests* +_Currently we don't have an example for calling `get_file_request_by_id` in integration tests_ ### Arguments - file_request_id `str` - - The unique identifier that represent a file request. The ID for any file request can be determined by visiting a file request builder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123" + - The unique identifier that represent a file request. The ID for any file request can be determined by visiting a file request builder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123" - 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 `FileRequest`. Returns a file request object. - ## Update file request Updates a file request. This can be used to activate or @@ -42,37 +39,35 @@ This operation is performed by calling function `update_file_request_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-file-requests-id/). -*Currently we don't have an example for calling `update_file_request_by_id` in integration tests* +_Currently we don't have an example for calling `update_file_request_by_id` in integration tests_ ### Arguments - file_request_id `str` - - The unique identifier that represent a file request. The ID for any file request can be determined by visiting a file request builder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123" + - The unique identifier that represent a file request. The ID for any file request can be determined by visiting a file request builder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123" - title `Optional[str]` - - An optional new title for the file request. This can be used to change the title of the file request. This will default to the value on the existing file request. + - An optional new title for the file request. This can be used to change the title of the file request. This will default to the value on the existing file request. - description `Optional[str]` - - An optional new description for the file request. This can be used to change the description of the file request. This will default to the value on the existing file request. + - An optional new description for the file request. This can be used to change the description of the file request. This will default to the value on the existing file request. - status `Optional[UpdateFileRequestByIdStatusArg]` - - An optional new status of the file request. When the status is set to `inactive`, the file request will no longer accept new submissions, and any visitor to the file request URL will receive a `HTTP 404` status code. This will default to the value on the existing file request. + - An optional new status of the file request. When the status is set to `inactive`, the file request will no longer accept new submissions, and any visitor to the file request URL will receive a `HTTP 404` status code. This will default to the value on the existing file request. - is_email_required `Optional[bool]` - - Whether a file request submitter is required to provide their email address. When this setting is set to true, the Box UI will show an email field on the file request form. This will default to the value on the existing file request. + - Whether a file request submitter is required to provide their email address. When this setting is set to true, the Box UI will show an email field on the file request form. This will default to the value on the existing file request. - is_description_required `Optional[bool]` - - Whether a file request submitter is required to provide a description of the files they are submitting. When this setting is set to true, the Box UI will show a description field on the file request form. This will default to the value on the existing file request. + - Whether a file request submitter is required to provide a description of the files they are submitting. When this setting is set to true, the Box UI will show a description field on the file request form. This will default to the value on the existing file request. - expires_at `Optional[str]` - - The date after which a file request will no longer accept new submissions. After this date, the `status` will automatically be set to `inactive`. This will default to the value on the existing file request. + - The date after which a file request will no longer accept new submissions. After this date, the `status` will automatically be set to `inactive`. This will default to the value on the existing file request. - if_match `Optional[str]` - - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since. + - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since. - 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 `FileRequest`. Returns the updated file request object. - ## Delete file request Deletes a file request permanently. @@ -82,16 +77,15 @@ This operation is performed by calling function `delete_file_request_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-file-requests-id/). -*Currently we don't have an example for calling `delete_file_request_by_id` in integration tests* +_Currently we don't have an example for calling `delete_file_request_by_id` in integration tests_ ### Arguments - file_request_id `str` - - The unique identifier that represent a file request. The ID for any file request can be determined by visiting a file request builder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123" + - The unique identifier that represent a file request. The ID for any file request can be determined by visiting a file request builder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123" - 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`. @@ -99,7 +93,6 @@ This function returns a value of type `None`. Returns an empty response when the file request has been successfully deleted. - ## Copy file request Copies an existing file request that is already present on one folder, @@ -110,34 +103,31 @@ This operation is performed by calling function `create_file_request_copy`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-file-requests-id-copy/). -*Currently we don't have an example for calling `create_file_request_copy` in integration tests* +_Currently we don't have an example for calling `create_file_request_copy` in integration tests_ ### Arguments - file_request_id `str` - - The unique identifier that represent a file request. The ID for any file request can be determined by visiting a file request builder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123" + - The unique identifier that represent a file request. The ID for any file request can be determined by visiting a file request builder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/filerequest/123` the `file_request_id` is `123`. Example: "123" - folder `CreateFileRequestCopyFolderArg` - The folder to associate the new file request to. - title `Optional[str]` - - An optional new title for the file request. This can be used to change the title of the file request. This will default to the value on the existing file request. + - An optional new title for the file request. This can be used to change the title of the file request. This will default to the value on the existing file request. - description `Optional[str]` - - An optional new description for the file request. This can be used to change the description of the file request. This will default to the value on the existing file request. + - An optional new description for the file request. This can be used to change the description of the file request. This will default to the value on the existing file request. - status `Optional[CreateFileRequestCopyStatusArg]` - - An optional new status of the file request. When the status is set to `inactive`, the file request will no longer accept new submissions, and any visitor to the file request URL will receive a `HTTP 404` status code. This will default to the value on the existing file request. + - An optional new status of the file request. When the status is set to `inactive`, the file request will no longer accept new submissions, and any visitor to the file request URL will receive a `HTTP 404` status code. This will default to the value on the existing file request. - is_email_required `Optional[bool]` - - Whether a file request submitter is required to provide their email address. When this setting is set to true, the Box UI will show an email field on the file request form. This will default to the value on the existing file request. + - Whether a file request submitter is required to provide their email address. When this setting is set to true, the Box UI will show an email field on the file request form. This will default to the value on the existing file request. - is_description_required `Optional[bool]` - - Whether a file request submitter is required to provide a description of the files they are submitting. When this setting is set to true, the Box UI will show a description field on the file request form. This will default to the value on the existing file request. + - Whether a file request submitter is required to provide a description of the files they are submitting. When this setting is set to true, the Box UI will show a description field on the file request form. This will default to the value on the existing file request. - expires_at `Optional[str]` - - The date after which a file request will no longer accept new submissions. After this date, the `status` will automatically be set to `inactive`. This will default to the value on the existing file request. + - The date after which a file request will no longer accept new submissions. After this date, the `status` will automatically be set to `inactive`. This will default to the value on the existing file request. - 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 `FileRequest`. Returns updated file request object. - - diff --git a/docs/file_version_legal_holds.md b/docs/file_version_legal_holds.md index dfa38142..0142a5d3 100644 --- a/docs/file_version_legal_holds.md +++ b/docs/file_version_legal_holds.md @@ -1,6 +1,5 @@ # FileVersionLegalHoldsManager - - [Get file version legal hold](#get-file-version-legal-hold) - [List file version legal holds](#list-file-version-legal-holds) @@ -14,7 +13,7 @@ This operation is performed by calling function `get_file_version_legal_hold_by_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-file-version-legal-holds-id/). -*Currently we don't have an example for calling `get_file_version_legal_hold_by_id` in integration tests* +_Currently we don't have an example for calling `get_file_version_legal_hold_by_id` in integration tests_ ### Arguments @@ -23,14 +22,12 @@ See the endpoint docs at - 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 `FileVersionLegalHold`. Returns the legal hold policy assignments for the file version. - ## List file version legal holds Get a list of file versions on legal hold for a legal hold @@ -59,25 +56,22 @@ This operation is performed by calling function `get_file_version_legal_holds`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-file-version-legal-holds/). -*Currently we don't have an example for calling `get_file_version_legal_holds` in integration tests* +_Currently we don't have an example for calling `get_file_version_legal_holds` in integration tests_ ### Arguments - policy_id `str` - The ID of the legal hold policy to get the file version legal holds for. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `FileVersionLegalHolds`. Returns the list of file version legal holds for a specific legal hold policy. - - diff --git a/docs/file_version_retentions.md b/docs/file_version_retentions.md index 99c5e028..b59cf22e 100644 --- a/docs/file_version_retentions.md +++ b/docs/file_version_retentions.md @@ -1,6 +1,5 @@ # FileVersionRetentionsManager - - [List file version retentions](#list-file-version-retentions) - [Get retention on file](#get-retention-on-file) @@ -13,7 +12,7 @@ This operation is performed by calling function `get_file_version_retentions`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-file-version-retentions/). -*Currently we don't have an example for calling `get_file_version_retentions` in integration tests* +_Currently we don't have an example for calling `get_file_version_retentions` in integration tests_ ### Arguments @@ -32,18 +31,16 @@ See the endpoint docs at - limit `Optional[int]` - The maximum number of items to return per page. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - 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 `FileVersionRetentions`. Returns a list of all file version retentions for the enterprise. - ## Get retention on file Returns information about a file version retention. @@ -53,7 +50,7 @@ This operation is performed by calling function `get_file_version_retention_by_i See the endpoint docs at [API Reference](https://developer.box.com/reference/get-file-version-retentions-id/). -*Currently we don't have an example for calling `get_file_version_retention_by_id` in integration tests* +_Currently we don't have an example for calling `get_file_version_retention_by_id` in integration tests_ ### Arguments @@ -62,11 +59,8 @@ See the endpoint docs at - 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 `FileVersionRetention`. Returns a file version retention object. - - diff --git a/docs/file_versions.md b/docs/file_versions.md index 5328b5ee..dbd6cdd5 100644 --- a/docs/file_versions.md +++ b/docs/file_versions.md @@ -1,6 +1,5 @@ # FileVersionsManager - - [List all file versions](#list-all-file-versions) - [Get file version](#get-file-version) - [Restore file version](#restore-file-version) @@ -19,29 +18,27 @@ This operation is performed by calling function `get_file_versions`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-versions/). -*Currently we don't have an example for calling `get_file_versions` in integration tests* +_Currently we don't have an example for calling `get_file_versions` in integration tests_ ### Arguments - 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" + - 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" - fields `Optional[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. + - 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. - limit `Optional[int]` - The maximum number of items to return per page. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - 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 `FileVersions`. Returns an array of past versions for this file. - ## Get file version Retrieve a specific version of a file. @@ -53,20 +50,19 @@ This operation is performed by calling function `get_file_version_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-versions-id/). -*Currently we don't have an example for calling `get_file_version_by_id` in integration tests* +_Currently we don't have an example for calling `get_file_version_by_id` in integration tests_ ### Arguments - 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" + - 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" - file_version_id `str` - The ID of the file version Example: "1234" - fields `Optional[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. + - 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. - 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 `FileVersionFull`. @@ -77,7 +73,6 @@ Not all available fields are returned by default. Use the [fields](#param-fields) query parameter to explicitly request any specific fields. - ## Restore file version Restores a specific version of a file after it was deleted. @@ -90,12 +85,12 @@ This operation is performed by calling function `update_file_version_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-versions-id/). -*Currently we don't have an example for calling `update_file_version_by_id` in integration tests* +_Currently we don't have an example for calling `update_file_version_by_id` in integration tests_ ### Arguments - 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" + - 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" - file_version_id `str` - The ID of the file version Example: "1234" - trashed_at `Optional[str]` @@ -103,14 +98,12 @@ See the endpoint docs at - 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 `FileVersionFull`. Returns a restored file version object. - ## Remove file version Move a file version to the trash. @@ -122,20 +115,19 @@ This operation is performed by calling function `delete_file_version_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-id-versions-id/). -*Currently we don't have an example for calling `delete_file_version_by_id` in integration tests* +_Currently we don't have an example for calling `delete_file_version_by_id` in integration tests_ ### Arguments - 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" + - 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" - file_version_id `str` - The ID of the file version Example: "1234" - if_match `Optional[str]` - - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since. + - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since. - 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`. @@ -143,7 +135,6 @@ This function returns a value of type `None`. Returns an empty response when the file has been successfully deleted. - ## Promote file version Promote a specific version of a file. @@ -168,26 +159,23 @@ This operation is performed by calling function `promote_file_version`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-id-versions-current/). -*Currently we don't have an example for calling `promote_file_version` in integration tests* +_Currently we don't have an example for calling `promote_file_version` in integration tests_ ### Arguments - 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" + - 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" - id `Optional[str]` - The file version ID - type `Optional[PromoteFileVersionTypeArg]` - The type to promote - fields `Optional[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. + - 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. - 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 `FileVersionFull`. Returns a newly created file version object. - - diff --git a/docs/file_watermarks.md b/docs/file_watermarks.md index 273dc9d1..d2885f33 100644 --- a/docs/file_watermarks.md +++ b/docs/file_watermarks.md @@ -1,6 +1,5 @@ # FileWatermarksManager - - [Get watermark on file](#get-watermark-on-file) - [Apply watermark to file](#apply-watermark-to-file) - [Remove watermark from file](#remove-watermark-from-file) @@ -14,16 +13,15 @@ This operation is performed by calling function `get_file_watermark`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-watermark/). -*Currently we don't have an example for calling `get_file_watermark` in integration tests* +_Currently we don't have an example for calling `get_file_watermark` in integration tests_ ### Arguments - 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" + - 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" - 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 `Watermark`. @@ -31,7 +29,6 @@ This function returns a value of type `Watermark`. Returns an object containing information about the watermark associated for to this file. - ## Apply watermark to file Applies or update a watermark on a file. @@ -41,18 +38,17 @@ This operation is performed by calling function `update_file_watermark`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-watermark/). -*Currently we don't have an example for calling `update_file_watermark` in integration tests* +_Currently we don't have an example for calling `update_file_watermark` in integration tests_ ### Arguments - 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" + - 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" - watermark `UpdateFileWatermarkWatermarkArg` - The watermark to imprint on the file - 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 `Watermark`. @@ -61,7 +57,6 @@ Returns an updated watermark if a watermark already existed on this file.Returns a new watermark if no watermark existed on this file yet. - ## Remove watermark from file Removes the watermark from a file. @@ -71,20 +66,17 @@ This operation is performed by calling function `delete_file_watermark`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-id-watermark/). -*Currently we don't have an example for calling `delete_file_watermark` in integration tests* +_Currently we don't have an example for calling `delete_file_watermark` in integration tests_ ### Arguments - 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" + - 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" - 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`. Removes the watermark and returns an empty response. - - diff --git a/docs/folder_classifications.md b/docs/folder_classifications.md index 09375428..2417544c 100644 --- a/docs/folder_classifications.md +++ b/docs/folder_classifications.md @@ -1,6 +1,5 @@ # FolderClassificationsManager - - [Get classification on folder](#get-classification-on-folder) - [Add classification to folder](#add-classification-to-folder) - [Update classification on folder](#update-classification-on-folder) @@ -20,16 +19,15 @@ This operation is performed by calling function `get_folder_metadata_enterprise_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-metadata-enterprise-security-classification-6-vm-vochw-u-wo/). -*Currently we don't have an example for calling `get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo` in integration tests* +_Currently we don't have an example for calling `get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo` in integration tests_ ### Arguments - 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" + - 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" - 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 `Classification`. @@ -39,7 +37,6 @@ template, which contains a `Box__Security__Classification__Key` field that lists all the classifications available to this enterprise. - ## Add classification to folder Adds a classification to a folder by specifying the label of the @@ -54,18 +51,17 @@ This operation is performed by calling function `create_folder_metadata_enterpri See the endpoint docs at [API Reference](https://developer.box.com/reference/post-folders-id-metadata-enterprise-security-classification-6-vm-vochw-u-wo/). -*Currently we don't have an example for calling `create_folder_metadata_enterprise_security_classification` in integration tests* +_Currently we don't have an example for calling `create_folder_metadata_enterprise_security_classification` in integration tests_ ### Arguments - 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" + - 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" - box_security_classification_key `Optional[str]` - - The name of the classification to apply to this folder. To list the available classifications in an enterprise, use the classification API to retrieve the [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema) which lists all available classification keys. + - The name of the classification to apply to this folder. To list the available classifications in an enterprise, use the classification API to retrieve the [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema) which lists all available classification keys. - 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 `Classification`. @@ -73,7 +69,6 @@ This function returns a value of type `Classification`. Returns the classification template instance that was applied to the folder. - ## Update classification on folder Updates a classification on a folder. @@ -87,25 +82,23 @@ This operation is performed by calling function `update_folder_metadata_enterpri See the endpoint docs at [API Reference](https://developer.box.com/reference/put-folders-id-metadata-enterprise-security-classification-6-vm-vochw-u-wo/). -*Currently we don't have an example for calling `update_folder_metadata_enterprise_security_classification` in integration tests* +_Currently we don't have an example for calling `update_folder_metadata_enterprise_security_classification` in integration tests_ ### Arguments - 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" + - 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" - request_body `List[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArg]` - Request body of updateFolderMetadataEnterpriseSecurityClassification method - 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 `Classification`. Returns the updated classification metadata template instance. - ## Remove classification from folder Removes any classifications from a folder. @@ -119,21 +112,18 @@ This operation is performed by calling function `delete_folder_metadata_enterpri See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-folders-id-metadata-enterprise-security-classification-6-vm-vochw-u-wo/). -*Currently we don't have an example for calling `delete_folder_metadata_enterprise_security_classification` in integration tests* +_Currently we don't have an example for calling `delete_folder_metadata_enterprise_security_classification` in integration tests_ ### Arguments - 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" + - 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" - 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`. Returns an empty response when the classification is successfully deleted. - - diff --git a/docs/folder_locks.md b/docs/folder_locks.md index 754ccf90..854c185c 100644 --- a/docs/folder_locks.md +++ b/docs/folder_locks.md @@ -1,6 +1,5 @@ # FolderLocksManager - - [List folder locks](#list-folder-locks) - [Create folder lock](#create-folder-lock) - [Delete folder lock](#delete-folder-lock) @@ -18,6 +17,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folder-locks/). + ```python client.folder_locks.get_folder_locks(folder_id=folder.id) ``` @@ -25,11 +25,10 @@ client.folder_locks.get_folder_locks(folder_id=folder.id) ### Arguments - 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`. + - 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`. - 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 `FolderLocks`. @@ -37,7 +36,6 @@ This function returns a value of type `FolderLocks`. Returns details for all folder locks applied to the folder, including the lock type and user that applied the lock. - ## Create folder lock Creates a folder lock on a folder, preventing it from being moved and/or @@ -52,6 +50,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-folder-locks/). + ```python client.folder_locks.create_folder_lock(locked_operations=CreateFolderLockLockedOperationsArg(move=True, delete=True), folder=CreateFolderLockFolderArg(id=folder.id, type='folder')) ``` @@ -65,7 +64,6 @@ client.folder_locks.create_folder_lock(locked_operations=CreateFolderLockLockedO - 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 `FolderLock`. @@ -73,7 +71,6 @@ This function returns a value of type `FolderLock`. Returns the instance of the folder lock that was applied to the folder, including the user that applied the lock and the operations set. - ## Delete folder lock Deletes a folder lock on a given folder. @@ -87,6 +84,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-folder-locks-id/). + ```python client.folder_locks.delete_folder_lock_by_id(folder_lock_id=folder_lock.id) ``` @@ -98,11 +96,8 @@ client.folder_locks.delete_folder_lock_by_id(folder_lock_id=folder_lock.id) - 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`. Returns an empty response when the folder lock is successfully deleted. - - diff --git a/docs/folder_metadata.md b/docs/folder_metadata.md index 198933cd..fde70048 100644 --- a/docs/folder_metadata.md +++ b/docs/folder_metadata.md @@ -1,6 +1,5 @@ # FolderMetadataManager - - [List metadata instances on folder](#list-metadata-instances-on-folder) - [Get metadata instance on folder](#get-metadata-instance-on-folder) - [Create metadata instance on folder](#create-metadata-instance-on-folder) @@ -17,16 +16,15 @@ This operation is performed by calling function `get_folder_metadata`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-metadata/). -*Currently we don't have an example for calling `get_folder_metadata` in integration tests* +_Currently we don't have an example for calling `get_folder_metadata` in integration tests_ ### Arguments - 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" + - 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" - 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 `Metadatas`. @@ -36,7 +34,6 @@ Returns all the metadata associated with a folder. This API does not support pagination and will therefore always return all of the metadata associated to the folder. - ## Get metadata instance on folder Retrieves the instance of a metadata template that has been applied to a @@ -47,12 +44,12 @@ This operation is performed by calling function `get_folder_metadata_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-metadata-id-id/). -*Currently we don't have an example for calling `get_folder_metadata_by_id` in integration tests* +_Currently we don't have an example for calling `get_folder_metadata_by_id` in integration tests_ ### Arguments - 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" + - 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" - scope `GetFolderMetadataByIdScopeArg` - The scope of the metadata template Example: "global" - template_key `str` @@ -60,7 +57,6 @@ See the endpoint docs at - 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 `Metadata`. @@ -69,7 +65,6 @@ An instance of the metadata template that includes additional "key:value" pairs defined by the user or an application. - ## Create metadata instance on folder Applies an instance of a metadata template to a folder. @@ -87,12 +82,12 @@ This operation is performed by calling function `create_folder_metadata_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-folders-id-metadata-id-id/). -*Currently we don't have an example for calling `create_folder_metadata_by_id` in integration tests* +_Currently we don't have an example for calling `create_folder_metadata_by_id` in integration tests_ ### Arguments - 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" + - 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" - scope `CreateFolderMetadataByIdScopeArg` - The scope of the metadata template Example: "global" - template_key `str` @@ -102,7 +97,6 @@ See the endpoint docs at - 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 `Metadata`. @@ -110,7 +104,6 @@ This function returns a value of type `Metadata`. Returns the instance of the template that was applied to the folder, including the data that was applied to the template. - ## Update metadata instance on folder Updates a piece of metadata on a folder. @@ -127,12 +120,12 @@ This operation is performed by calling function `update_folder_metadata_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-folders-id-metadata-id-id/). -*Currently we don't have an example for calling `update_folder_metadata_by_id` in integration tests* +_Currently we don't have an example for calling `update_folder_metadata_by_id` in integration tests_ ### Arguments - 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" + - 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" - scope `UpdateFolderMetadataByIdScopeArg` - The scope of the metadata template Example: "global" - template_key `str` @@ -142,7 +135,6 @@ See the endpoint docs at - 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 `Metadata`. @@ -150,7 +142,6 @@ This function returns a value of type `Metadata`. Returns the updated metadata template instance, with the custom template data included. - ## Remove metadata instance from folder Deletes a piece of folder metadata. @@ -160,12 +151,12 @@ This operation is performed by calling function `delete_folder_metadata_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-folders-id-metadata-id-id/). -*Currently we don't have an example for calling `delete_folder_metadata_by_id` in integration tests* +_Currently we don't have an example for calling `delete_folder_metadata_by_id` in integration tests_ ### Arguments - 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" + - 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" - scope `DeleteFolderMetadataByIdScopeArg` - The scope of the metadata template Example: "global" - template_key `str` @@ -173,12 +164,9 @@ See the endpoint docs at - 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`. Returns an empty response when the metadata is successfully deleted. - - diff --git a/docs/folder_watermarks.md b/docs/folder_watermarks.md index a75caa18..0e4be029 100644 --- a/docs/folder_watermarks.md +++ b/docs/folder_watermarks.md @@ -1,6 +1,5 @@ # FolderWatermarksManager - - [Get watermark for folder](#get-watermark-for-folder) - [Apply watermark to folder](#apply-watermark-to-folder) - [Remove watermark from folder](#remove-watermark-from-folder) @@ -14,16 +13,15 @@ This operation is performed by calling function `get_folder_watermark`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-watermark/). -*Currently we don't have an example for calling `get_folder_watermark` in integration tests* +_Currently we don't have an example for calling `get_folder_watermark` in integration tests_ ### Arguments - 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" + - 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" - 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 `Watermark`. @@ -31,7 +29,6 @@ This function returns a value of type `Watermark`. Returns an object containing information about the watermark associated for to this folder. - ## Apply watermark to folder Applies or update a watermark on a folder. @@ -41,18 +38,17 @@ This operation is performed by calling function `update_folder_watermark`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-folders-id-watermark/). -*Currently we don't have an example for calling `update_folder_watermark` in integration tests* +_Currently we don't have an example for calling `update_folder_watermark` in integration tests_ ### Arguments - 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" + - 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" - watermark `UpdateFolderWatermarkWatermarkArg` - The watermark to imprint on the folder - 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 `Watermark`. @@ -61,7 +57,6 @@ Returns an updated watermark if a watermark already existed on this folder.Returns a new watermark if no watermark existed on this folder yet. - ## Remove watermark from folder Removes the watermark from a folder. @@ -71,21 +66,18 @@ This operation is performed by calling function `delete_folder_watermark`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-folders-id-watermark/). -*Currently we don't have an example for calling `delete_folder_watermark` in integration tests* +_Currently we don't have an example for calling `delete_folder_watermark` in integration tests_ ### Arguments - 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" + - 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" - 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`. An empty response will be returned when the watermark was successfully deleted. - - diff --git a/docs/groups.md b/docs/groups.md index 1189c368..9777db1a 100644 --- a/docs/groups.md +++ b/docs/groups.md @@ -1,6 +1,5 @@ # GroupsManager - - [List groups for enterprise](#list-groups-for-enterprise) - [Create group](#create-group) - [Get group](#get-group) @@ -18,6 +17,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-groups/). + ```python client.groups.get_groups() ``` @@ -27,15 +27,14 @@ client.groups.get_groups() - filter_term `Optional[str]` - Limits the results to only groups whose `name` starts with the search term. - fields `Optional[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. + - 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. - limit `Optional[int]` - The maximum number of items to return per page. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - 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 `Groups`. @@ -43,7 +42,6 @@ This function returns a value of type `Groups`. Returns a collection of group objects. If there are no groups, an empty collection will be returned. - ## Create group Creates a new group of users in an enterprise. Only users with admin @@ -55,6 +53,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-groups/). + ```python client.groups.create_group(name=get_uuid()) ``` @@ -64,28 +63,26 @@ client.groups.create_group(name=get_uuid()) - name `str` - The name of the new group to be created. This name must be unique within the enterprise. - provenance `Optional[str]` - - Keeps track of which external source this group is coming, for example `Active Directory`, or `Okta`. Setting this will also prevent Box admins from editing the group name and its members directly via the Box web application. This is desirable for one-way syncing of groups. + - Keeps track of which external source this group is coming, for example `Active Directory`, or `Okta`. Setting this will also prevent Box admins from editing the group name and its members directly via the Box web application. This is desirable for one-way syncing of groups. - external_sync_identifier `Optional[str]` - - An arbitrary identifier that can be used by external group sync tools to link this Box Group to an external group. Example values of this field could be an **Active Directory Object ID** or a **Google Group ID**. We recommend you use of this field in order to avoid issues when group names are updated in either Box or external systems. + - An arbitrary identifier that can be used by external group sync tools to link this Box Group to an external group. Example values of this field could be an **Active Directory Object ID** or a **Google Group ID**. We recommend you use of this field in order to avoid issues when group names are updated in either Box or external systems. - description `Optional[str]` - A human readable description of the group. - invitability_level `Optional[CreateGroupInvitabilityLevelArg]` - - Specifies who can invite the group to collaborate on folders. When set to `admins_only` the enterprise admin, co-admins, and the group's admin can invite the group. When set to `admins_and_members` all the admins listed above and group members can invite the group. When set to `all_managed_users` all managed users in the enterprise can invite the group. + - Specifies who can invite the group to collaborate on folders. When set to `admins_only` the enterprise admin, co-admins, and the group's admin can invite the group. When set to `admins_and_members` all the admins listed above and group members can invite the group. When set to `all_managed_users` all managed users in the enterprise can invite the group. - member_viewability_level `Optional[CreateGroupMemberViewabilityLevelArg]` - - Specifies who can see the members of the group. * `admins_only` - the enterprise admin, co-admins, group's group admin * `admins_and_members` - all admins and group members * `all_managed_users` - all managed users in the enterprise + - Specifies who can see the members of the group. _ `admins_only` - the enterprise admin, co-admins, group's group admin _ `admins_and_members` - all admins and group members \* `all_managed_users` - all managed users in the enterprise - fields `Optional[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. + - 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. - 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 `Group`. Returns the new group object. - ## Get group Retrieves information about a group. Only members of this @@ -98,6 +95,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-groups-id/). + ```python client.groups.get_group_by_id(group_id=group.id) ``` @@ -107,18 +105,16 @@ client.groups.get_group_by_id(group_id=group.id) - group_id `str` - The ID of the group. Example: "57645" - fields `Optional[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. + - 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. - 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 `GroupFull`. Returns the group object - ## Update group Updates a specific group. Only admins of this @@ -131,6 +127,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/put-groups-id/). + ```python client.groups.update_group_by_id(group_id=group.id, name=updated_group_name) ``` @@ -142,28 +139,26 @@ client.groups.update_group_by_id(group_id=group.id, name=updated_group_name) - name `Optional[str]` - The name of the new group to be created. Must be unique within the enterprise. - provenance `Optional[str]` - - Keeps track of which external source this group is coming, for example `Active Directory`, or `Okta`. Setting this will also prevent Box admins from editing the group name and its members directly via the Box web application. This is desirable for one-way syncing of groups. + - Keeps track of which external source this group is coming, for example `Active Directory`, or `Okta`. Setting this will also prevent Box admins from editing the group name and its members directly via the Box web application. This is desirable for one-way syncing of groups. - external_sync_identifier `Optional[str]` - - An arbitrary identifier that can be used by external group sync tools to link this Box Group to an external group. Example values of this field could be an **Active Directory Object ID** or a **Google Group ID**. We recommend you use of this field in order to avoid issues when group names are updated in either Box or external systems. + - An arbitrary identifier that can be used by external group sync tools to link this Box Group to an external group. Example values of this field could be an **Active Directory Object ID** or a **Google Group ID**. We recommend you use of this field in order to avoid issues when group names are updated in either Box or external systems. - description `Optional[str]` - A human readable description of the group. - invitability_level `Optional[UpdateGroupByIdInvitabilityLevelArg]` - - Specifies who can invite the group to collaborate on folders. When set to `admins_only` the enterprise admin, co-admins, and the group's admin can invite the group. When set to `admins_and_members` all the admins listed above and group members can invite the group. When set to `all_managed_users` all managed users in the enterprise can invite the group. + - Specifies who can invite the group to collaborate on folders. When set to `admins_only` the enterprise admin, co-admins, and the group's admin can invite the group. When set to `admins_and_members` all the admins listed above and group members can invite the group. When set to `all_managed_users` all managed users in the enterprise can invite the group. - member_viewability_level `Optional[UpdateGroupByIdMemberViewabilityLevelArg]` - - Specifies who can see the members of the group. * `admins_only` - the enterprise admin, co-admins, group's group admin * `admins_and_members` - all admins and group members * `all_managed_users` - all managed users in the enterprise + - Specifies who can see the members of the group. _ `admins_only` - the enterprise admin, co-admins, group's group admin _ `admins_and_members` - all admins and group members \* `all_managed_users` - all managed users in the enterprise - fields `Optional[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. + - 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. - 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 `GroupFull`. Returns the updated group object. - ## Remove group Permanently deletes a group. Only users with @@ -175,6 +170,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-groups-id/). + ```python client.groups.delete_group_by_id(group_id=group.id) ``` @@ -186,12 +182,9 @@ client.groups.delete_group_by_id(group_id=group.id) - 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`. A blank response is returned if the group was successfully deleted. - - diff --git a/docs/integration_mappings.md b/docs/integration_mappings.md index 768add9a..ac972110 100644 --- a/docs/integration_mappings.md +++ b/docs/integration_mappings.md @@ -1,6 +1,5 @@ # IntegrationMappingsManager - - [List Slack integration mappings](#list-slack-integration-mappings) - [Create Slack integration mapping](#create-slack-integration-mapping) - [Update Slack integration mapping](#update-slack-integration-mapping) @@ -18,12 +17,12 @@ This operation is performed by calling function `get_integration_mapping_slack`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-integration-mappings-slack/). -*Currently we don't have an example for calling `get_integration_mapping_slack` in integration tests* +_Currently we don't have an example for calling `get_integration_mapping_slack` in integration tests_ ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - partner_item_type `Optional[GetIntegrationMappingSlackPartnerItemTypeArg]` @@ -39,14 +38,12 @@ See the endpoint docs at - 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 `IntegrationMappings`. Returns a collection of integration mappings - ## Create Slack integration mapping Creates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack) @@ -60,27 +57,25 @@ This operation is performed by calling function `create_integration_mapping_slac See the endpoint docs at [API Reference](https://developer.box.com/reference/post-integration-mappings-slack/). -*Currently we don't have an example for calling `create_integration_mapping_slack` in integration tests* +_Currently we don't have an example for calling `create_integration_mapping_slack` in integration tests_ ### Arguments - partner_item `IntegrationMappingPartnerItemSlack` - - + - - box_item `IntegrationMappingBoxItemSlack` - - + - - options `Optional[IntegrationMappingSlackOptions]` - - + - - 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 `IntegrationMapping`. Returns the created integration mapping. - ## Update Slack integration mapping Updates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack). @@ -94,32 +89,29 @@ This operation is performed by calling function `update_integration_mapping_slac See the endpoint docs at [API Reference](https://developer.box.com/reference/put-integration-mappings-slack-id/). -*Currently we don't have an example for calling `update_integration_mapping_slack_by_id` in integration tests* +_Currently we don't have an example for calling `update_integration_mapping_slack_by_id` in integration tests_ ### Arguments - integration_mapping_id `str` - An ID of an integration mapping Example: "11235432" - box_item `Optional[IntegrationMappingBoxItemSlack]` - - + - - options `Optional[IntegrationMappingSlackOptions]` - - + - - 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 `IntegrationMapping`. Returns the updated integration mapping object. - ## Delete Slack integration mapping Deletes a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack). - You need Admin or Co-Admin role to use this endpoint. @@ -128,7 +120,7 @@ This operation is performed by calling function `delete_integration_mapping_slac See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-integration-mappings-slack-id/). -*Currently we don't have an example for calling `delete_integration_mapping_slack_by_id` in integration tests* +_Currently we don't have an example for calling `delete_integration_mapping_slack_by_id` in integration tests_ ### Arguments @@ -137,11 +129,8 @@ See the endpoint docs at - 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`. Empty body in response - - diff --git a/docs/invites.md b/docs/invites.md index 9cfa9c1b..8c00b72d 100644 --- a/docs/invites.md +++ b/docs/invites.md @@ -1,6 +1,5 @@ # InvitesManager - - [Create user invite](#create-user-invite) - [Get user invite status](#get-user-invite-status) @@ -21,7 +20,7 @@ This operation is performed by calling function `create_invite`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-invites/). -*Currently we don't have an example for calling `create_invite` in integration tests* +_Currently we don't have an example for calling `create_invite` in integration tests_ ### Arguments @@ -30,18 +29,16 @@ See the endpoint docs at - actionable_by `CreateInviteActionableByArg` - The user to invite - fields `Optional[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. + - 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. - 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 `Invite`. Returns a new invite object. - ## Get user invite status Returns the status of a user invite. @@ -51,22 +48,19 @@ This operation is performed by calling function `get_invite_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-invites-id/). -*Currently we don't have an example for calling `get_invite_by_id` in integration tests* +_Currently we don't have an example for calling `get_invite_by_id` in integration tests_ ### Arguments - invite_id `str` - The ID of an invite. Example: "213723" - fields `Optional[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. + - 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. - 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 `Invite`. Returns an invite object - - diff --git a/docs/legal_hold_policies.md b/docs/legal_hold_policies.md index 3c9d9beb..bd716dfc 100644 --- a/docs/legal_hold_policies.md +++ b/docs/legal_hold_policies.md @@ -1,6 +1,5 @@ # LegalHoldPoliciesManager - - [List all legal hold policies](#list-all-legal-hold-policies) - [Create legal hold policy](#create-legal-hold-policy) - [Get legal hold policy](#get-legal-hold-policy) @@ -17,29 +16,27 @@ This operation is performed by calling function `get_legal_hold_policies`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-legal-hold-policies/). -*Currently we don't have an example for calling `get_legal_hold_policies` in integration tests* +_Currently we don't have an example for calling `get_legal_hold_policies` in integration tests_ ### Arguments - policy_name `Optional[str]` - Limits results to policies for which the names start with this search term. This is a case-insensitive prefix. - fields `Optional[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. + - 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. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `LegalHoldPolicies`. Returns a list of legal hold policies. - ## Create legal hold policy Create a new legal hold policy. @@ -49,7 +46,7 @@ This operation is performed by calling function `create_legal_hold_policy`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-legal-hold-policies/). -*Currently we don't have an example for calling `create_legal_hold_policy` in integration tests* +_Currently we don't have an example for calling `create_legal_hold_policy` in integration tests_ ### Arguments @@ -58,22 +55,20 @@ See the endpoint docs at - description `Optional[str]` - A description for the policy. - filter_started_at `Optional[str]` - - The filter start date. When this policy is applied using a `custodian` legal hold assignments, it will only apply to file versions created or uploaded inside of the date range. Other assignment types, such as folders and files, will ignore the date filter. Required if `is_ongoing` is set to `false`. + - The filter start date. When this policy is applied using a `custodian` legal hold assignments, it will only apply to file versions created or uploaded inside of the date range. Other assignment types, such as folders and files, will ignore the date filter. Required if `is_ongoing` is set to `false`. - filter_ended_at `Optional[str]` - - The filter end date. When this policy is applied using a `custodian` legal hold assignments, it will only apply to file versions created or uploaded inside of the date range. Other assignment types, such as folders and files, will ignore the date filter. Required if `is_ongoing` is set to `false`. + - The filter end date. When this policy is applied using a `custodian` legal hold assignments, it will only apply to file versions created or uploaded inside of the date range. Other assignment types, such as folders and files, will ignore the date filter. Required if `is_ongoing` is set to `false`. - is_ongoing `Optional[bool]` - - Whether new assignments under this policy should continue applying to files even after initialization. When this policy is applied using a legal hold assignment, it will continue applying the policy to any new file versions even after it has been applied. For example, if a legal hold assignment is placed on a user today, and that user uploads a file tomorrow, that file will get held. This will continue until the policy is retired. Required if no filter dates are set. + - Whether new assignments under this policy should continue applying to files even after initialization. When this policy is applied using a legal hold assignment, it will continue applying the policy to any new file versions even after it has been applied. For example, if a legal hold assignment is placed on a user today, and that user uploads a file tomorrow, that file will get held. This will continue until the policy is retired. Required if no filter dates are set. - 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 `LegalHoldPolicy`. Returns a new legal hold policy object. - ## Get legal hold policy Retrieve a legal hold policy. @@ -83,7 +78,7 @@ This operation is performed by calling function `get_legal_hold_policy_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-legal-hold-policies-id/). -*Currently we don't have an example for calling `get_legal_hold_policy_by_id` in integration tests* +_Currently we don't have an example for calling `get_legal_hold_policy_by_id` in integration tests_ ### Arguments @@ -92,14 +87,12 @@ See the endpoint docs at - 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 `LegalHoldPolicy`. Returns a legal hold policy object. - ## Update legal hold policy Update legal hold policy. @@ -109,7 +102,7 @@ This operation is performed by calling function `update_legal_hold_policy_by_id` See the endpoint docs at [API Reference](https://developer.box.com/reference/put-legal-hold-policies-id/). -*Currently we don't have an example for calling `update_legal_hold_policy_by_id` in integration tests* +_Currently we don't have an example for calling `update_legal_hold_policy_by_id` in integration tests_ ### Arguments @@ -124,14 +117,12 @@ See the endpoint docs at - 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 `LegalHoldPolicy`. Returns a new legal hold policy object. - ## Remove legal hold policy Delete an existing legal hold policy. @@ -144,7 +135,7 @@ This operation is performed by calling function `delete_legal_hold_policy_by_id` See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-legal-hold-policies-id/). -*Currently we don't have an example for calling `delete_legal_hold_policy_by_id` in integration tests* +_Currently we don't have an example for calling `delete_legal_hold_policy_by_id` in integration tests_ ### Arguments @@ -153,12 +144,9 @@ See the endpoint docs at - 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`. A blank response is returned if the policy was successfully deleted. - - diff --git a/docs/legal_hold_policy_assignments.md b/docs/legal_hold_policy_assignments.md index 71f3f6e1..d7729b8f 100644 --- a/docs/legal_hold_policy_assignments.md +++ b/docs/legal_hold_policy_assignments.md @@ -1,6 +1,5 @@ # LegalHoldPolicyAssignmentsManager - - [List legal hold policy assignments](#list-legal-hold-policy-assignments) - [Assign legal hold policy](#assign-legal-hold-policy) - [Get legal hold policy assignment](#get-legal-hold-policy-assignment) @@ -17,7 +16,7 @@ This operation is performed by calling function `get_legal_hold_policy_assignmen See the endpoint docs at [API Reference](https://developer.box.com/reference/get-legal-hold-policy-assignments/). -*Currently we don't have an example for calling `get_legal_hold_policy_assignments` in integration tests* +_Currently we don't have an example for calling `get_legal_hold_policy_assignments` in integration tests_ ### Arguments @@ -28,22 +27,20 @@ See the endpoint docs at - assign_to_id `Optional[str]` - Filters the results by the ID of item the policy was applied to. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - fields `Optional[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. + - 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. - 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 `LegalHoldPolicyAssignments`. Returns a list of legal hold policy assignments. - ## Assign legal hold policy Assign a legal hold to a file, file version, folder, or user. @@ -53,7 +50,7 @@ This operation is performed by calling function `create_legal_hold_policy_assign See the endpoint docs at [API Reference](https://developer.box.com/reference/post-legal-hold-policy-assignments/). -*Currently we don't have an example for calling `create_legal_hold_policy_assignment` in integration tests* +_Currently we don't have an example for calling `create_legal_hold_policy_assignment` in integration tests_ ### Arguments @@ -64,14 +61,12 @@ See the endpoint docs at - 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 `LegalHoldPolicyAssignment`. Returns a new legal hold policy assignment. - ## Get legal hold policy assignment Retrieve a legal hold policy assignment. @@ -81,7 +76,7 @@ This operation is performed by calling function `get_legal_hold_policy_assignmen See the endpoint docs at [API Reference](https://developer.box.com/reference/get-legal-hold-policy-assignments-id/). -*Currently we don't have an example for calling `get_legal_hold_policy_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `get_legal_hold_policy_assignment_by_id` in integration tests_ ### Arguments @@ -90,14 +85,12 @@ See the endpoint docs at - 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 `LegalHoldPolicyAssignment`. Returns a legal hold policy object. - ## Unassign legal hold policy Remove a legal hold from an item. @@ -110,7 +103,7 @@ This operation is performed by calling function `delete_legal_hold_policy_assign See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-legal-hold-policy-assignments-id/). -*Currently we don't have an example for calling `delete_legal_hold_policy_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `delete_legal_hold_policy_assignment_by_id` in integration tests_ ### Arguments @@ -119,7 +112,6 @@ See the endpoint docs at - 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`. @@ -127,7 +119,6 @@ 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 Get a list of current file versions for a legal hold @@ -152,22 +143,21 @@ This operation is performed by calling function `get_legal_hold_policy_assignmen See the endpoint docs at [API Reference](https://developer.box.com/reference/get-legal-hold-policy-assignments-id-files-on-hold/). -*Currently we don't have an example for calling `get_legal_hold_policy_assignment_file_on_hold` in integration tests* +_Currently we don't have an example for calling `get_legal_hold_policy_assignment_file_on_hold` in integration tests_ ### Arguments - legal_hold_policy_assignment_id `str` - The ID of the legal hold policy assignment Example: "753465" - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - fields `Optional[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. + - 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. - 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 `FileVersionLegalHolds`. @@ -175,7 +165,6 @@ This function returns a value of type `FileVersionLegalHolds`. Returns the list of current file versions held under legal hold for a specific legal hold policy assignment. - ## List previous file versions for legal hold policy assignment Get a list of previous file versions for a legal hold @@ -200,27 +189,24 @@ This operation is performed by calling function `get_legal_hold_policy_assignmen See the endpoint docs at [API Reference](https://developer.box.com/reference/get-legal-hold-policy-assignments-id-file-versions-on-hold/). -*Currently we don't have an example for calling `get_legal_hold_policy_assignment_file_version_on_hold` in integration tests* +_Currently we don't have an example for calling `get_legal_hold_policy_assignment_file_version_on_hold` in integration tests_ ### Arguments - legal_hold_policy_assignment_id `str` - The ID of the legal hold policy assignment Example: "753465" - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - fields `Optional[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. + - 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. - 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 `FileVersionLegalHolds`. Returns the list of previous file versions held under legal hold for a specific legal hold policy assignment. - - diff --git a/docs/list_collaborations.md b/docs/list_collaborations.md index 1e6dd50a..8d7ed96d 100644 --- a/docs/list_collaborations.md +++ b/docs/list_collaborations.md @@ -1,6 +1,5 @@ # ListCollaborationsManager - - [List file collaborations](#list-file-collaborations) - [List folder collaborations](#list-folder-collaborations) - [List pending collaborations](#list-pending-collaborations) @@ -17,22 +16,21 @@ This operation is performed by calling function `get_file_collaborations`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-collaborations/). -*Currently we don't have an example for calling `get_file_collaborations` in integration tests* +_Currently we don't have an example for calling `get_file_collaborations` in integration tests_ ### Arguments - 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" + - 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" - fields `Optional[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. + - 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. - limit `Optional[int]` - The maximum number of items to return per page. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - 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 `Collaborations`. @@ -44,7 +42,6 @@ This list includes pending collaborations, for which the `status` is set to `pending`, indicating invitations that have been sent but not yet accepted. - ## List folder collaborations Retrieves a list of pending and active collaborations for a @@ -56,18 +53,17 @@ This operation is performed by calling function `get_folder_collaborations`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-collaborations/). -*Currently we don't have an example for calling `get_folder_collaborations` in integration tests* +_Currently we don't have an example for calling `get_folder_collaborations` in integration tests_ ### Arguments - 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`. Example: "12345" + - 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`. Example: "12345" - fields `Optional[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. + - 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. - 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 `Collaborations`. @@ -79,7 +75,6 @@ This list includes pending collaborations, for which the `status` is set to `pending`, indicating invitations that have been sent but not yet accepted. - ## List pending collaborations Retrieves all pending collaboration invites for this user. @@ -89,22 +84,21 @@ This operation is performed by calling function `get_collaborations`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-collaborations/). -*Currently we don't have an example for calling `get_collaborations` in integration tests* +_Currently we don't have an example for calling `get_collaborations` in integration tests_ ### Arguments - status `GetCollaborationsStatusArg` - The status of the collaborations to retrieve - fields `Optional[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. + - 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. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `Collaborations`. @@ -114,7 +108,6 @@ Returns a collection of pending collaboration objects. If the user has no pending collaborations, the collection will be empty. - ## List group collaborations Retrieves all the collaborations for a group. The user @@ -128,7 +121,7 @@ This operation is performed by calling function `get_group_collaborations`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-groups-id-collaborations/). -*Currently we don't have an example for calling `get_group_collaborations` in integration tests* +_Currently we don't have an example for calling `get_group_collaborations` in integration tests_ ### Arguments @@ -137,16 +130,13 @@ See the endpoint docs at - limit `Optional[int]` - The maximum number of items to return per page. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - 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 `Collaborations`. Returns a collection of collaboration objects. If there are no collaborations, an empty collection will be returned. - - diff --git a/docs/memberships.md b/docs/memberships.md index 478caa81..fc24eabd 100644 --- a/docs/memberships.md +++ b/docs/memberships.md @@ -1,6 +1,5 @@ # MembershipsManager - - [List user's groups](#list-users-groups) - [List members of group](#list-members-of-group) - [Add user to group](#add-user-to-group) @@ -20,6 +19,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-users-id-memberships/). + ```python client.memberships.get_user_memberships(user_id=user.id) ``` @@ -31,11 +31,10 @@ client.memberships.get_user_memberships(user_id=user.id) - limit `Optional[int]` - The maximum number of items to return per page. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - 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 `GroupMemberships`. @@ -43,7 +42,6 @@ This function returns a value of type `GroupMemberships`. Returns a collection of membership objects. If there are no memberships, an empty collection will be returned. - ## List members of group Retrieves all the members for a group. Only members of this @@ -56,6 +54,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-groups-id-memberships/). + ```python client.memberships.get_group_memberships(group_id=group.id) ``` @@ -67,11 +66,10 @@ client.memberships.get_group_memberships(group_id=group.id) - limit `Optional[int]` - The maximum number of items to return per page. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - 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 `GroupMemberships`. @@ -79,7 +77,6 @@ This function returns a value of type `GroupMemberships`. Returns a collection of membership objects. If there are no memberships, an empty collection will be returned. - ## Add user to group Creates a group membership. Only users with @@ -91,6 +88,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-group-memberships/). + ```python client.memberships.create_group_membership(user=user, group=group) ``` @@ -104,20 +102,18 @@ client.memberships.create_group_membership(user=user, group=group) - role `Optional[CreateGroupMembershipRoleArg]` - The role of the user in the group. - configurable_permissions `Optional[Dict[str, bool]]` - - Custom configuration for the permissions an admin if a group will receive. This option has no effect on members with a role of `member`. Setting these permissions overwrites the default access levels of an admin. Specifying a value of "null" for this object will deactivate all configurable permissions. Specifying permissions will set them accordingly, omitted permissions will be enabled by default. + - Custom configuration for the permissions an admin if a group will receive. This option has no effect on members with a role of `member`. Setting these permissions overwrites the default access levels of an admin. Specifying a value of "null" for this object will deactivate all configurable permissions. Specifying permissions will set them accordingly, omitted permissions will be enabled by default. - fields `Optional[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. + - 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. - 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 `GroupMembership`. Returns a new group membership object. - ## Get group membership Retrieves a specific group membership. Only admins of this @@ -130,6 +126,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-group-memberships-id/). + ```python client.memberships.get_group_membership_by_id(group_membership_id=group_membership.id) ``` @@ -139,18 +136,16 @@ client.memberships.get_group_membership_by_id(group_membership_id=group_membersh - group_membership_id `str` - The ID of the group membership. Example: "434534" - fields `Optional[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. + - 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. - 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 `GroupMembership`. Returns the group membership object. - ## Update group membership Updates a user's group membership. Only admins of this @@ -163,6 +158,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/put-group-memberships-id/). + ```python client.memberships.update_group_membership_by_id(group_membership_id=group_membership.id, role=UpdateGroupMembershipByIdRoleArg.ADMIN.value) ``` @@ -174,20 +170,18 @@ client.memberships.update_group_membership_by_id(group_membership_id=group_membe - role `Optional[UpdateGroupMembershipByIdRoleArg]` - The role of the user in the group. - configurable_permissions `Optional[Dict[str, bool]]` - - Custom configuration for the permissions an admin if a group will receive. This option has no effect on members with a role of `member`. Setting these permissions overwrites the default access levels of an admin. Specifying a value of "null" for this object will deactivate all configurable permissions. Specifying permissions will set them accordingly, omitted permissions will be enabled by default. + - Custom configuration for the permissions an admin if a group will receive. This option has no effect on members with a role of `member`. Setting these permissions overwrites the default access levels of an admin. Specifying a value of "null" for this object will deactivate all configurable permissions. Specifying permissions will set them accordingly, omitted permissions will be enabled by default. - fields `Optional[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. + - 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. - 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 `GroupMembership`. Returns a new group membership object. - ## Remove user from group Deletes a specific group membership. Only admins of this @@ -200,6 +194,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-group-memberships-id/). + ```python client.memberships.delete_group_membership_by_id(group_membership_id=group_membership.id) ``` @@ -211,12 +206,9 @@ client.memberships.delete_group_membership_by_id(group_membership_id=group_membe - 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`. A blank response is returned if the membership was successfully deleted. - - diff --git a/docs/metadata_cascade_policies.md b/docs/metadata_cascade_policies.md index 18cef615..0740bdc6 100644 --- a/docs/metadata_cascade_policies.md +++ b/docs/metadata_cascade_policies.md @@ -1,6 +1,5 @@ # MetadataCascadePoliciesManager - - [List metadata cascade policies](#list-metadata-cascade-policies) - [Create metadata cascade policy](#create-metadata-cascade-policy) - [Get metadata cascade policy](#get-metadata-cascade-policy) @@ -18,7 +17,7 @@ This operation is performed by calling function `get_metadata_cascade_policies`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-cascade-policies/). -*Currently we don't have an example for calling `get_metadata_cascade_policies` in integration tests* +_Currently we don't have an example for calling `get_metadata_cascade_policies` in integration tests_ ### Arguments @@ -27,20 +26,18 @@ See the endpoint docs at - owner_enterprise_id `Optional[str]` - The ID of the enterprise ID for which to find metadata cascade policies. If not specified, it defaults to the current enterprise. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - 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 `MetadataCascadePolicies`. Returns a list of metadata cascade policies - ## Create metadata cascade policy Creates a new metadata cascade policy that applies a given @@ -55,7 +52,7 @@ This operation is performed by calling function `create_metadata_cascade_policy` See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-cascade-policies/). -*Currently we don't have an example for calling `create_metadata_cascade_policy` in integration tests* +_Currently we don't have an example for calling `create_metadata_cascade_policy` in integration tests_ ### Arguments @@ -64,18 +61,16 @@ See the endpoint docs at - scope `CreateMetadataCascadePolicyScopeArg` - The scope of the targeted metadata template. This template will need to already have an instance applied to the targeted folder. - template_key `str` - - The key of the targeted metadata template. This template will need to already have an instance applied to the targeted folder. In many cases the template key is automatically derived of its display name, for example `Contract Template` would become `contractTemplate`. In some cases the creator of the template will have provided its own template key. Please [list the templates for an enterprise][list], or get all instances on a [file][file] or [folder][folder] to inspect a template's key. [list]: e://get-metadata-templates-enterprise [file]: e://get-files-id-metadata [folder]: e://get-folders-id-metadata + - The key of the targeted metadata template. This template will need to already have an instance applied to the targeted folder. In many cases the template key is automatically derived of its display name, for example `Contract Template` would become `contractTemplate`. In some cases the creator of the template will have provided its own template key. Please [list the templates for an enterprise][list], or get all instances on a [file][file] or [folder][folder] to inspect a template's key. [list]: e://get-metadata-templates-enterprise [file]: e://get-files-id-metadata [folder]: e://get-folders-id-metadata - 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 `MetadataCascadePolicy`. Returns a new of metadata cascade policy - ## Get metadata cascade policy Retrieve a specific metadata cascade policy assigned to a folder. @@ -85,7 +80,7 @@ This operation is performed by calling function `get_metadata_cascade_policy_by_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-cascade-policies-id/). -*Currently we don't have an example for calling `get_metadata_cascade_policy_by_id` in integration tests* +_Currently we don't have an example for calling `get_metadata_cascade_policy_by_id` in integration tests_ ### Arguments @@ -94,14 +89,12 @@ See the endpoint docs at - 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 `MetadataCascadePolicy`. Returns a metadata cascade policy - ## Remove metadata cascade policy Deletes a metadata cascade policy. @@ -111,7 +104,7 @@ This operation is performed by calling function `delete_metadata_cascade_policy_ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-metadata-cascade-policies-id/). -*Currently we don't have an example for calling `delete_metadata_cascade_policy_by_id` in integration tests* +_Currently we don't have an example for calling `delete_metadata_cascade_policy_by_id` in integration tests_ ### Arguments @@ -120,7 +113,6 @@ See the endpoint docs at - 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`. @@ -128,7 +120,6 @@ This function returns a value of type `None`. Returns an empty response when the policy is successfully deleted. - ## Force-apply metadata cascade policy to folder Force the metadata on a folder with a metadata cascade policy to be applied to @@ -141,18 +132,17 @@ This operation is performed by calling function `create_metadata_cascade_policy_ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-cascade-policies-id-apply/). -*Currently we don't have an example for calling `create_metadata_cascade_policy_apply` in integration tests* +_Currently we don't have an example for calling `create_metadata_cascade_policy_apply` in integration tests_ ### Arguments - metadata_cascade_policy_id `str` - The ID of the cascade policy to force-apply. Example: "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7" - conflict_resolution `CreateMetadataCascadePolicyApplyConflictResolutionArg` - - Describes the desired behavior when dealing with the conflict where a metadata template already has an instance applied to a child. * `none` will preserve the existing value on the file * `overwrite` will force-apply the templates values over any existing values. + - Describes the desired behavior when dealing with the conflict where a metadata template already has an instance applied to a child. _ `none` will preserve the existing value on the file _ `overwrite` will force-apply the templates values over any existing values. - 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`. @@ -163,5 +153,3 @@ cascade operation will be performed asynchronously. The API call will return directly, before the cascade operation is complete. There is currently no API to check for the status of this operation. - - diff --git a/docs/metadata_templates.md b/docs/metadata_templates.md index 2790ed40..56ec1fa8 100644 --- a/docs/metadata_templates.md +++ b/docs/metadata_templates.md @@ -1,6 +1,5 @@ # MetadataTemplatesManager - - [Find metadata template by instance ID](#find-metadata-template-by-instance-id) - [Get metadata template by name](#get-metadata-template-by-name) - [Update metadata template](#update-metadata-template) @@ -20,7 +19,7 @@ This operation is performed by calling function `get_metadata_templates`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-templates/). -*Currently we don't have an example for calling `get_metadata_templates` in integration tests* +_Currently we don't have an example for calling `get_metadata_templates` in integration tests_ ### Arguments @@ -29,7 +28,6 @@ See the endpoint docs at - 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 `MetadataTemplates`. @@ -37,7 +35,6 @@ This function returns a value of type `MetadataTemplates`. Returns a list containing the 1 metadata template that matches the instance ID. - ## Get metadata template by name Retrieves a metadata template by its `scope` and `templateKey` values. @@ -51,6 +48,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-templates-id-id-schema/). + ```python client.metadata_templates.get_metadata_template_schema(scope=GetMetadataTemplateSchemaScopeArg.ENTERPRISE.value, template_key=template.template_key) ``` @@ -64,7 +62,6 @@ client.metadata_templates.get_metadata_template_schema(scope=GetMetadataTemplate - 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 `MetadataTemplate`. @@ -72,7 +69,6 @@ This function returns a value of type `MetadataTemplate`. Returns the metadata template matching the `scope` and `template` name. - ## Update metadata template Updates a metadata template. @@ -88,7 +84,7 @@ This operation is performed by calling function `update_metadata_template_schema See the endpoint docs at [API Reference](https://developer.box.com/reference/put-metadata-templates-id-id-schema/). -*Currently we don't have an example for calling `update_metadata_template_schema` in integration tests* +_Currently we don't have an example for calling `update_metadata_template_schema` in integration tests_ ### Arguments @@ -101,7 +97,6 @@ See the endpoint docs at - 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 `MetadataTemplate`. @@ -109,7 +104,6 @@ This function returns a value of type `MetadataTemplate`. Returns the updated metadata template, with the custom template data included. - ## Remove metadata template Delete a metadata template and its instances. @@ -121,6 +115,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-metadata-templates-id-id-schema/). + ```python client.metadata_templates.delete_metadata_template_schema(scope=DeleteMetadataTemplateSchemaScopeArg.ENTERPRISE.value, template_key=template.template_key) ``` @@ -134,7 +129,6 @@ client.metadata_templates.delete_metadata_template_schema(scope=DeleteMetadataTe - 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`. @@ -142,7 +136,6 @@ This function returns a value of type `None`. Returns an empty response when the metadata template is successfully deleted. - ## Get metadata template by ID Retrieves a metadata template by its ID. @@ -153,6 +146,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-templates-id/). + ```python client.metadata_templates.get_metadata_template_by_id(template_id=template.id) ``` @@ -164,14 +158,12 @@ client.metadata_templates.get_metadata_template_by_id(template_id=template.id) - 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 `MetadataTemplate`. Returns the metadata template that matches the ID. - ## List all global metadata templates Used to retrieve all generic, global metadata templates available to all @@ -183,6 +175,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-templates-global/). + ```python client.metadata_templates.get_metadata_template_global() ``` @@ -190,13 +183,12 @@ client.metadata_templates.get_metadata_template_global() ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `MetadataTemplates`. @@ -204,7 +196,6 @@ This function returns a value of type `MetadataTemplates`. Returns all of the metadata templates available to all enterprises and their corresponding schema. - ## List all metadata templates for enterprise Used to retrieve all metadata templates created to be used specifically within @@ -216,6 +207,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-templates-enterprise/). + ```python client.metadata_templates.get_metadata_template_enterprise() ``` @@ -223,13 +215,12 @@ client.metadata_templates.get_metadata_template_enterprise() ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `MetadataTemplates`. @@ -237,7 +228,6 @@ This function returns a value of type `MetadataTemplates`. Returns all of the metadata templates within an enterprise and their corresponding schema. - ## Create metadata template Creates a new metadata template that can be applied to @@ -249,6 +239,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-templates-schema/). + ```python client.metadata_templates.create_metadata_template_schema(scope='enterprise', template_key=template_key, display_name=template_key, fields=[CreateMetadataTemplateSchemaFieldsArg(type=CreateMetadataTemplateSchemaFieldsArgTypeField.STRING.value, key='testName', display_name='testName')]) ``` @@ -256,9 +247,9 @@ client.metadata_templates.create_metadata_template_schema(scope='enterprise', te ### Arguments - scope `str` - - The scope of the metadata template to create. Applications can only create templates for use within the authenticated user's enterprise. This value needs to be set to `enterprise`, as `global` scopes can not be created by applications. + - The scope of the metadata template to create. Applications can only create templates for use within the authenticated user's enterprise. This value needs to be set to `enterprise`, as `global` scopes can not be created by applications. - template_key `Optional[str]` - - A unique identifier for the template. This identifier needs to be unique across the enterprise for which the metadata template is being created. When not provided, the API will create a unique `templateKey` based on the value of the `displayName`. + - A unique identifier for the template. This identifier needs to be unique across the enterprise for which the metadata template is being created. When not provided, the API will create a unique `templateKey` based on the value of the `displayName`. - display_name `str` - The display name of the template. - hidden `Optional[bool]` @@ -270,11 +261,8 @@ client.metadata_templates.create_metadata_template_schema(scope='enterprise', te - 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 `MetadataTemplate`. The schema representing the metadata template created. - - diff --git a/docs/recent_items.md b/docs/recent_items.md index 93807314..1116ce2b 100644 --- a/docs/recent_items.md +++ b/docs/recent_items.md @@ -1,6 +1,5 @@ # RecentItemsManager - - [List recently accessed items](#list-recently-accessed-items) ## List recently accessed items @@ -15,6 +14,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-recent-items/). + ```python client.recent_items.get_recent_items() ``` @@ -22,19 +22,16 @@ client.recent_items.get_recent_items() ### Arguments - fields `Optional[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. + - 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. - limit `Optional[int]` - The maximum number of items to return per page. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - 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 `RecentItems`. Returns a list recent items access by a user. - - diff --git a/docs/retention_policies.md b/docs/retention_policies.md index 8941363f..cfbb3721 100644 --- a/docs/retention_policies.md +++ b/docs/retention_policies.md @@ -1,6 +1,5 @@ # RetentionPoliciesManager - - [List retention policies](#list-retention-policies) - [Create retention policy](#create-retention-policy) - [Get retention policy](#get-retention-policy) @@ -17,6 +16,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-retention-policies/). + ```python client.retention_policies.get_retention_policies() ``` @@ -30,7 +30,7 @@ client.retention_policies.get_retention_policies() - created_by_user_id `Optional[str]` - Filters results by the ID of the user who created policy. - fields `Optional[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. + - 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. - limit `Optional[int]` - The maximum number of items to return per page. - marker `Optional[str]` @@ -38,14 +38,12 @@ client.retention_policies.get_retention_policies() - 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 `RetentionPolicies`. Returns a list retention policies in the enterprise. - ## Create retention policy Creates a retention policy. @@ -56,6 +54,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-retention-policies/). + ```python 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) ``` @@ -71,9 +70,9 @@ client.retention_policies.create_retention_policy(policy_name=retention_policy_n - disposition_action `CreateRetentionPolicyDispositionActionArg` - The disposition action of the retention policy. `permanently_delete` deletes the content retained by the policy permanently. `remove_retention` lifts retention policy from the content, allowing it to be deleted by users once the retention policy has expired. - retention_length `Optional[str]` - - The length of the retention policy. This value specifies the duration in days that the retention policy will be active for after being assigned to content. If the policy has a `policy_type` of `indefinite`, the `retention_length` will also be `indefinite`. + - The length of the retention policy. This value specifies the duration in days that the retention policy will be active for after being assigned to content. If the policy has a `policy_type` of `indefinite`, the `retention_length` will also be `indefinite`. - retention_type `Optional[CreateRetentionPolicyRetentionTypeArg]` - - Specifies the retention type: * `modifiable`: You can modify the retention policy. For example, you can add or remove folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if your retention policy is not related to any regulatory purposes. * `non-modifiable`: You can modify the retention policy only in a limited way: add a folder, lengthen the duration, retire the policy, change the disposition action or notification settings. You cannot perform other actions, such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies. + - Specifies the retention type: _ `modifiable`: You can modify the retention policy. For example, you can add or remove folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if your retention policy is not related to any regulatory purposes. _ `non-modifiable`: You can modify the retention policy only in a limited way: add a folder, lengthen the duration, retire the policy, change the disposition action or notification settings. You cannot perform other actions, such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies. - can_owner_extend_retention `Optional[bool]` - Whether the owner of a file will be allowed to extend the retention. - are_owners_notified `Optional[bool]` @@ -83,14 +82,12 @@ client.retention_policies.create_retention_policy(policy_name=retention_policy_n - 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 `RetentionPolicy`. Returns a new retention policy object. - ## Get retention policy Retrieves a retention policy. @@ -101,6 +98,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-retention-policies-id/). + ```python client.retention_policies.get_retention_policy_by_id(retention_policy_id=retention_policy.id) ``` @@ -110,18 +108,16 @@ client.retention_policies.get_retention_policy_by_id(retention_policy_id=retenti - retention_policy_id `str` - The ID of the retention policy. Example: "982312" - fields `Optional[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. + - 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. - 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 `RetentionPolicy`. Returns the retention policy object. - ## Update retention policy Updates a retention policy. @@ -132,6 +128,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/put-retention-policies-id/). + ```python client.retention_policies.update_retention_policy_by_id(retention_policy_id=retention_policy.id, policy_name=updated_retention_policy_name) ``` @@ -147,11 +144,11 @@ client.retention_policies.update_retention_policy_by_id(retention_policy_id=rete - disposition_action `Optional[UpdateRetentionPolicyByIdDispositionActionArg]` - The disposition action of the retention policy. `permanently_delete` deletes the content retained by the policy permanently. `remove_retention` lifts retention policy from the content, allowing it to be deleted by users once the retention policy has expired. - retention_type `Optional[str]` - - Specifies the retention type: * `modifiable`: You can modify the retention policy. For example, you can add or remove folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if your retention policy is not related to any regulatory purposes. * `non-modifiable`: You can modify the retention policy only in a limited way: add a folder, lengthen the duration, retire the policy, change the disposition action or notification settings. You cannot perform other actions, such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies. When updating a retention policy, you can use `non-modifiable` type only. You can convert a `modifiable` policy to `non-modifiable`, but not the other way around. + - Specifies the retention type: _ `modifiable`: You can modify the retention policy. For example, you can add or remove folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if your retention policy is not related to any regulatory purposes. _ `non-modifiable`: You can modify the retention policy only in a limited way: add a folder, lengthen the duration, retire the policy, change the disposition action or notification settings. You cannot perform other actions, such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies. When updating a retention policy, you can use `non-modifiable` type only. You can convert a `modifiable` policy to `non-modifiable`, but not the other way around. - retention_length `Optional[str]` - - The length of the retention policy. This value specifies the duration in days that the retention policy will be active for after being assigned to content. If the policy has a `policy_type` of `indefinite`, the `retention_length` will also be `indefinite`. + - The length of the retention policy. This value specifies the duration in days that the retention policy will be active for after being assigned to content. If the policy has a `policy_type` of `indefinite`, the `retention_length` will also be `indefinite`. - status `Optional[str]` - - Used to retire a retention policy. If not retiring a policy, do not include this parameter or set it to `null`. + - Used to retire a retention policy. If not retiring a policy, do not include this parameter or set it to `null`. - can_owner_extend_retention `Optional[bool]` - Determines if the owner of items under the policy can extend the retention when the original retention duration is about to end. - are_owners_notified `Optional[bool]` @@ -161,14 +158,12 @@ client.retention_policies.update_retention_policy_by_id(retention_policy_id=rete - 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 `RetentionPolicy`. Returns the updated retention policy object. - ## Delete retention policy Permanently deletes a retention policy. @@ -179,6 +174,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-retention-policies-id/). + ```python client.retention_policies.delete_retention_policy_by_id(retention_policy_id=retention_policy.id) ``` @@ -190,11 +186,8 @@ client.retention_policies.delete_retention_policy_by_id(retention_policy_id=rete - 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`. Returns an empty response when the policy has been deleted. - - diff --git a/docs/retention_policy_assignments.md b/docs/retention_policy_assignments.md index b69d8c2a..ae25640e 100644 --- a/docs/retention_policy_assignments.md +++ b/docs/retention_policy_assignments.md @@ -1,6 +1,5 @@ # RetentionPolicyAssignmentsManager - - [List retention policy assignments](#list-retention-policy-assignments) - [Assign retention policy](#assign-retention-policy) - [Get retention policy assignment](#get-retention-policy-assignment) @@ -18,7 +17,7 @@ This operation is performed by calling function `get_retention_policy_assignment See the endpoint docs at [API Reference](https://developer.box.com/reference/get-retention-policies-id-assignments/). -*Currently we don't have an example for calling `get_retention_policy_assignments` in integration tests* +_Currently we don't have an example for calling `get_retention_policy_assignments` in integration tests_ ### Arguments @@ -27,7 +26,7 @@ See the endpoint docs at - type `Optional[GetRetentionPolicyAssignmentsTypeArg]` - The type of the retention policy assignment to retrieve. - fields `Optional[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. + - 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. - marker `Optional[str]` - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. - limit `Optional[int]` @@ -35,7 +34,6 @@ See the endpoint docs at - 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 `RetentionPolicyAssignments`. @@ -43,7 +41,6 @@ This function returns a value of type `RetentionPolicyAssignments`. Returns a list of the retention policy assignments associated with the specified retention policy. - ## Assign retention policy Assigns a retention policy to an item. @@ -53,7 +50,7 @@ This operation is performed by calling function `create_retention_policy_assignm See the endpoint docs at [API Reference](https://developer.box.com/reference/post-retention-policy-assignments/). -*Currently we don't have an example for calling `create_retention_policy_assignment` in integration tests* +_Currently we don't have an example for calling `create_retention_policy_assignment` in integration tests_ ### Arguments @@ -64,18 +61,16 @@ See the endpoint docs at - filter_fields `Optional[List[CreateRetentionPolicyAssignmentFilterFieldsArg]]` - If the `assign_to` type is `metadata_template`, then optionally add the `filter_fields` parameter which will require an array of objects with a field entry and a value entry. Currently only one object of `field` and `value` is supported. - start_date_field `Optional[str]` - - The date the retention policy assignment begins. If the `assigned_to` type is `metadata_template`, this field can be a date field's metadata attribute key id. + - The date the retention policy assignment begins. If the `assigned_to` type is `metadata_template`, this field can be a date field's metadata attribute key id. - 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 `RetentionPolicyAssignment`. Returns a new retention policy assignment object. - ## Get retention policy assignment Retrieves a retention policy assignment @@ -85,25 +80,23 @@ This operation is performed by calling function `get_retention_policy_assignment See the endpoint docs at [API Reference](https://developer.box.com/reference/get-retention-policy-assignments-id/). -*Currently we don't have an example for calling `get_retention_policy_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `get_retention_policy_assignment_by_id` in integration tests_ ### Arguments - retention_policy_assignment_id `str` - The ID of the retention policy assignment. Example: "1233123" - fields `Optional[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. + - 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. - 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 `RetentionPolicyAssignment`. Returns the retention policy assignment object. - ## Remove retention policy assignment Removes a retention policy assignment @@ -114,7 +107,7 @@ This operation is performed by calling function `delete_retention_policy_assignm See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-retention-policy-assignments-id/). -*Currently we don't have an example for calling `delete_retention_policy_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `delete_retention_policy_assignment_by_id` in integration tests_ ### Arguments @@ -123,7 +116,6 @@ See the endpoint docs at - 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`. @@ -131,7 +123,6 @@ This function returns a value of type `None`. Returns an empty response when the policy assignment is successfully deleted. - ## Get files under retention Returns a list of files under retention for a retention policy assignment. @@ -141,20 +132,19 @@ This operation is performed by calling function `get_retention_policy_assignment See the endpoint docs at [API Reference](https://developer.box.com/reference/get-retention-policy-assignments-id-files-under-retention/). -*Currently we don't have an example for calling `get_retention_policy_assignment_file_under_retention` in integration tests* +_Currently we don't have an example for calling `get_retention_policy_assignment_file_under_retention` in integration tests_ ### Arguments - retention_policy_assignment_id `str` - The ID of the retention policy assignment. Example: "1233123" - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `FilesUnderRetention`. @@ -162,7 +152,6 @@ This function returns a value of type `FilesUnderRetention`. Returns a list of files under retention that are associated with the specified retention policy assignment. - ## Get file versions under retention Returns a list of file versions under retention for a retention policy @@ -173,25 +162,22 @@ This operation is performed by calling function `get_retention_policy_assignment See the endpoint docs at [API Reference](https://developer.box.com/reference/get-retention-policy-assignments-id-file-versions-under-retention/). -*Currently we don't have an example for calling `get_retention_policy_assignment_file_version_under_retention` in integration tests* +_Currently we don't have an example for calling `get_retention_policy_assignment_file_version_under_retention` in integration tests_ ### Arguments - retention_policy_assignment_id `str` - The ID of the retention policy assignment. Example: "1233123" - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `FilesUnderRetention`. Returns a list of file versions under retention that are associated with the specified retention policy assignment. - - diff --git a/docs/search.md b/docs/search.md index 3adaedbc..11e6bb1e 100644 --- a/docs/search.md +++ b/docs/search.md @@ -1,6 +1,5 @@ # SearchManager - - [Query files/folders by metadata](#query-files-folders-by-metadata) - [List metadata query indices](#list-metadata-query-indices) - [Search for content](#search-for-content) @@ -19,37 +18,35 @@ This operation is performed by calling function `create_metadata_query_execute_r See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-queries-execute-read/). -*Currently we don't have an example for calling `create_metadata_query_execute_read` in integration tests* +_Currently we don't have an example for calling `create_metadata_query_execute_read` in integration tests_ ### Arguments -- from_ `str` +- from\_ `str` - Specifies the template used in the query. Must be in the form `scope.templateKey`. Not all templates can be used in this field, most notably the built-in, Box-provided classification templates can not be used in a query. - query `Optional[str]` - - The query to perform. A query is a logical expression that is very similar to a SQL `SELECT` statement. Values in the search query can be turned into parameters specified in the `query_param` arguments list to prevent having to manually insert search values into the query string. For example, a value of `:amount` would represent the `amount` value in `query_params` object. + - The query to perform. A query is a logical expression that is very similar to a SQL `SELECT` statement. Values in the search query can be turned into parameters specified in the `query_param` arguments list to prevent having to manually insert search values into the query string. For example, a value of `:amount` would represent the `amount` value in `query_params` object. - query_params `Optional[Dict[str, str]]` - Set of arguments corresponding to the parameters specified in the `query`. The type of each parameter used in the `query_params` must match the type of the corresponding metadata template field. - ancestor_folder_id `str` - The ID of the folder that you are restricting the query to. A value of zero will return results from all folders you have access to. A non-zero value will only return results found in the folder corresponding to the ID or in any of its subfolders. - order_by `Optional[List[CreateMetadataQueryExecuteReadOrderByArg]]` - - A list of template fields and directions to sort the metadata query results by. The ordering `direction` must be the same for each item in the array. + - A list of template fields and directions to sort the metadata query results by. The ordering `direction` must be the same for each item in the array. - limit `Optional[int]` - A value between 0 and 100 that indicates the maximum number of results to return for a single request. This only specifies a maximum boundary and will not guarantee the minimum number of results returned. - marker `Optional[str]` - Marker to use for requesting the next page. - fields `Optional[List[str]]` - - By default, this endpoint returns only the most basic info about the items for which the query matches. This attribute can be used to specify a list of additional attributes to return for any item, including its metadata. This attribute takes a list of item fields, metadata template identifiers, or metadata template field identifiers. For example: * `created_by` will add the details of the user who created the item to the response. * `metadata..` will return the mini-representation of the metadata instance identified by the `scope` and `templateKey`. * `metadata...` will return all the mini-representation of the metadata instance identified by the `scope` and `templateKey` plus the field specified by the `field` name. Multiple fields for the same `scope` and `templateKey` can be defined. + - By default, this endpoint returns only the most basic info about the items for which the query matches. This attribute can be used to specify a list of additional attributes to return for any item, including its metadata. This attribute takes a list of item fields, metadata template identifiers, or metadata template field identifiers. For example: _ `created_by` will add the details of the user who created the item to the response. _ `metadata..` will return the mini-representation of the metadata instance identified by the `scope` and `templateKey`. \* `metadata...` will return all the mini-representation of the metadata instance identified by the `scope` and `templateKey` plus the field specified by the `field` name. Multiple fields for the same `scope` and `templateKey` can be defined. - 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 `MetadataQueryResults`. Returns a list of files and folders that match this metadata query. - ## List metadata query indices Retrieves the metadata query indices for a given scope and template key. @@ -59,7 +56,7 @@ This operation is performed by calling function `get_metadata_query_indices`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-query-indices/). -*Currently we don't have an example for calling `get_metadata_query_indices` in integration tests* +_Currently we don't have an example for calling `get_metadata_query_indices` in integration tests_ ### Arguments @@ -70,14 +67,12 @@ See the endpoint docs at - 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 `MetadataQueryIndices`. Returns a collection of metadata query indices for scope and template key. - ## Search for content Searches for files, folders, web links, and shared files across the @@ -88,61 +83,58 @@ This operation is performed by calling function `get_search`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-search/). -*Currently we don't have an example for calling `get_search` in integration tests* +_Currently we don't have an example for calling `get_search` in integration tests_ ### Arguments - query `Optional[str]` - - The string to search for. This query is matched against item names, descriptions, text content of files, and various other fields of the different item types. This parameter supports a variety of operators to further refine the results returns. * `""` - by wrapping a query in double quotes only exact matches are returned by the API. Exact searches do not return search matches based on specific character sequences. Instead, they return matches based on phrases, that is, word sequences. For example: A search for `"Blue-Box"` may return search results including the sequence `"blue.box"`, `"Blue Box"`, and `"Blue-Box"`; any item containing the words `Blue` and `Box` consecutively, in the order specified. * `AND` - returns items that contain both the search terms. For example, a search for `marketing AND BoxWorks` returns items that have both `marketing` and `BoxWorks` within its text in any order. It does not return a result that only has `BoxWorks` in its text. * `OR` - returns items that contain either of the search terms. For example, a search for `marketing OR BoxWorks` returns a result that has either `marketing` or `BoxWorks` within its text. Using this operator is not necessary as we implicitly interpret multi-word queries as `OR` unless another supported boolean term is used. * `NOT` - returns items that do not contain the search term provided. For example, a search for `marketing AND NOT BoxWorks` returns a result that has only `marketing` within its text. Results containing `BoxWorks` are omitted. We do not support lower case (that is, `and`, `or`, and `not`) or mixed case (that is, `And`, `Or`, and `Not`) operators. This field is required unless the `mdfilters` parameter is defined. + - The string to search for. This query is matched against item names, descriptions, text content of files, and various other fields of the different item types. This parameter supports a variety of operators to further refine the results returns. _ `""` - by wrapping a query in double quotes only exact matches are returned by the API. Exact searches do not return search matches based on specific character sequences. Instead, they return matches based on phrases, that is, word sequences. For example: A search for `"Blue-Box"` may return search results including the sequence `"blue.box"`, `"Blue Box"`, and `"Blue-Box"`; any item containing the words `Blue` and `Box` consecutively, in the order specified. _ `AND` - returns items that contain both the search terms. For example, a search for `marketing AND BoxWorks` returns items that have both `marketing` and `BoxWorks` within its text in any order. It does not return a result that only has `BoxWorks` in its text. _ `OR` - returns items that contain either of the search terms. For example, a search for `marketing OR BoxWorks` returns a result that has either `marketing` or `BoxWorks` within its text. Using this operator is not necessary as we implicitly interpret multi-word queries as `OR` unless another supported boolean term is used. _ `NOT` - returns items that do not contain the search term provided. For example, a search for `marketing AND NOT BoxWorks` returns a result that has only `marketing` within its text. Results containing `BoxWorks` are omitted. We do not support lower case (that is, `and`, `or`, and `not`) or mixed case (that is, `And`, `Or`, and `Not`) operators. This field is required unless the `mdfilters` parameter is defined. - scope `Optional[GetSearchScopeArg]` - - Limits the search results to either the files that the user has access to, or to files available to the entire enterprise. The scope defaults to `user_content`, which limits the search results to content that is available to the currently authenticated user. The `enterprise_content` can be requested by an admin through our support channels. Once this scope has been enabled for a user, it will allow that use to query for content across the entire enterprise and not only the content that they have access to. + - Limits the search results to either the files that the user has access to, or to files available to the entire enterprise. The scope defaults to `user_content`, which limits the search results to content that is available to the currently authenticated user. The `enterprise_content` can be requested by an admin through our support channels. Once this scope has been enabled for a user, it will allow that use to query for content across the entire enterprise and not only the content that they have access to. - file_extensions `Optional[str]` - Limits the search results to any files that match any of the provided file extensions. This list is a comma-separated list of file extensions without the dots. - created_at_range `Optional[str]` - - Limits the search results to any items created within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the the start date is omitted (`,2014-05-17T13:35:01-07:00`) anything created before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the current date will be used as the end date instead. + - Limits the search results to any items created within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the the start date is omitted (`,2014-05-17T13:35:01-07:00`) anything created before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the current date will be used as the end date instead. - updated_at_range `Optional[str]` - - Limits the search results to any items updated within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the start date is omitted (`,2014-05-17T13:35:01-07:00`) anything updated before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the current date will be used as the end date instead. + - Limits the search results to any items updated within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the start date is omitted (`,2014-05-17T13:35:01-07:00`) anything updated before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the current date will be used as the end date instead. - size_range `Optional[str]` - - Limits the search results to any items with a size within a given file size range. This applied to files and folders. Size ranges are defined as comma separated list of a lower and upper byte size limit (inclusive). The upper and lower bound can be omitted to create open ranges. + - Limits the search results to any items with a size within a given file size range. This applied to files and folders. Size ranges are defined as comma separated list of a lower and upper byte size limit (inclusive). The upper and lower bound can be omitted to create open ranges. - owner_user_ids `Optional[str]` - - Limits the search results to any items that are owned by the given list of owners, defined as a list of comma separated user IDs. The items still need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users an empty result set will be returned. To search across an entire enterprise, we recommend using the `enterprise_content` scope parameter which can be requested with our support team. + - Limits the search results to any items that are owned by the given list of owners, defined as a list of comma separated user IDs. The items still need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users an empty result set will be returned. To search across an entire enterprise, we recommend using the `enterprise_content` scope parameter which can be requested with our support team. - recent_updater_user_ids `Optional[str]` - - Limits the search results to any items that have been updated by the given list of users, defined as a list of comma separated user IDs. The items still need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users an empty result set will be returned. This feature only searches back to the last 10 versions of an item. + - Limits the search results to any items that have been updated by the given list of users, defined as a list of comma separated user IDs. The items still need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users an empty result set will be returned. This feature only searches back to the last 10 versions of an item. - ancestor_folder_ids `Optional[str]` - - Limits the search results to items within the given list of folders, defined as a comma separated lists of folder IDs. Search results will also include items within any subfolders of those ancestor folders. The folders still need to be owned or shared with the currently authenticated user. If the folder is not accessible by this user, or it does not exist, a `HTTP 404` error code will be returned instead. To search across an entire enterprise, we recommend using the `enterprise_content` scope parameter which can be requested with our support team. + - Limits the search results to items within the given list of folders, defined as a comma separated lists of folder IDs. Search results will also include items within any subfolders of those ancestor folders. The folders still need to be owned or shared with the currently authenticated user. If the folder is not accessible by this user, or it does not exist, a `HTTP 404` error code will be returned instead. To search across an entire enterprise, we recommend using the `enterprise_content` scope parameter which can be requested with our support team. - content_types `Optional[str]` - - Limits the search results to any items that match the search query for a specific part of the file, for example the file description. Content types are defined as a comma separated lists of Box recognized content types. The allowed content types are as follows. * `name` - The name of the item, as defined by its `name` field. * `description` - The description of the item, as defined by its `description` field. * `file_content` - The actual content of the file. * `comments` - The content of any of the comments on a file or folder. * `tags` - Any tags that are applied to an item, as defined by its `tags` field. + - Limits the search results to any items that match the search query for a specific part of the file, for example the file description. Content types are defined as a comma separated lists of Box recognized content types. The allowed content types are as follows. _ `name` - The name of the item, as defined by its `name` field. _ `description` - The description of the item, as defined by its `description` field. _ `file_content` - The actual content of the file. _ `comments` - The content of any of the comments on a file or folder. \* `tags` - Any tags that are applied to an item, as defined by its `tags` field. - type `Optional[GetSearchTypeArg]` - - Limits the search results to any items of this type. This parameter only takes one value. By default the API returns items that match any of these types. * `file` - Limits the search results to files * `folder` - Limits the search results to folders * `web_link` - Limits the search results to web links, also known as bookmarks + - Limits the search results to any items of this type. This parameter only takes one value. By default the API returns items that match any of these types. _ `file` - Limits the search results to files _ `folder` - Limits the search results to folders \* `web_link` - Limits the search results to web links, also known as bookmarks - trash_content `Optional[GetSearchTrashContentArg]` - - 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. + - 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[str]` - - Limits the search results to any items for which the metadata matches the provided filter. This parameter contains a list of 1 metadata template to filter the search results by. This list can currently only contain one entry, though this might be expanded in the future. This parameter is required unless the `query` parameter is provided. + - Limits the search results to any items for which the metadata matches the provided filter. This parameter contains a list of 1 metadata template to filter the search results by. This list can currently only contain one entry, though this might be expanded in the future. This parameter is required unless the `query` parameter is provided. - sort `Optional[GetSearchSortArg]` - - 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. + - 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[GetSearchDirectionArg]` - - Defines the direction in which search results are ordered. This API defaults to returning items in descending (`DESC`) order unless this parameter is explicitly specified. When results are sorted by `relevance` the ordering is locked to returning items in descending order of relevance, and this parameter is ignored. + - Defines the direction in which search results are ordered. This API defaults to returning items in descending (`DESC`) order unless this parameter is explicitly specified. When results are sorted by `relevance` the ordering is locked to returning items in descending order of relevance, and this parameter is ignored. - limit `Optional[int]` - Defines the maximum number of items to return as part of a page of results. - include_recent_shared_links `Optional[bool]` - - Defines whether the search results should include any items that the user recently accessed through a shared link. When this parameter has been set to true, the format of the response of this API changes to return a list of [Search Results with Shared Links](r://search_results_with_shared_links) + - Defines whether the search results should include any items that the user recently accessed through a shared link. When this parameter has been set to true, the format of the response of this API changes to return a list of [Search Results with Shared Links](r://search_results_with_shared_links) - fields `Optional[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. + - 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. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - deleted_user_ids `Optional[str]` - - Limits the search results to items that were deleted by the given list of users, defined as a list of comma separated user IDs. The `trash_content` parameter needs to be set to `trashed_only`. If searching in trash is not performed, an empty result set is returned. The items need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users, an empty result set is returned. Data available from 2023-02-01 onwards. + - Limits the search results to items that were deleted by the given list of users, defined as a list of comma separated user IDs. The `trash_content` parameter needs to be set to `trashed_only`. If searching in trash is not performed, an empty result set is returned. The items need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users, an empty result set is returned. Data available from 2023-02-01 onwards. - deleted_at_range `Optional[str]` - - Limits the search results to any items deleted within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the the start date is omitted (`2014-05-17T13:35:01-07:00`), anything deleted before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00`), the current date will be used as the end date instead. The `trash_content` parameter needs to be set to `trashed_only`. If searching in trash is not performed, then an empty result is returned. Data available from 2023-02-01 onwards. + - Limits the search results to any items deleted within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the the start date is omitted (`2014-05-17T13:35:01-07:00`), anything deleted before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00`), the current date will be used as the end date instead. The `trash_content` parameter needs to be set to `trashed_only`. If searching in trash is not performed, then an empty result is returned. Data available from 2023-02-01 onwards. - 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`. Returns a collection of search results. If there are no matching search results, the `entries` array will be empty. - - diff --git a/docs/session_termination.md b/docs/session_termination.md index 76f3e1b9..a68bcf01 100644 --- a/docs/session_termination.md +++ b/docs/session_termination.md @@ -1,6 +1,5 @@ # SessionTerminationManager - - [Create jobs to terminate users session](#create-jobs-to-terminate-users-session) - [Create jobs to terminate user group session](#create-jobs-to-terminate-user-group-session) @@ -16,7 +15,7 @@ This operation is performed by calling function `create_user_terminate_session`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-users-terminate-sessions/). -*Currently we don't have an example for calling `create_user_terminate_session` in integration tests* +_Currently we don't have an example for calling `create_user_terminate_session` in integration tests_ ### Arguments @@ -27,14 +26,12 @@ See the endpoint docs at - 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 `SessionTerminationMessage`. Returns a message about the request status. - ## Create jobs to terminate user group session Validates the roles and permissions of the group, @@ -47,7 +44,7 @@ This operation is performed by calling function `create_group_terminate_session` See the endpoint docs at [API Reference](https://developer.box.com/reference/post-groups-terminate-sessions/). -*Currently we don't have an example for calling `create_group_terminate_session` in integration tests* +_Currently we don't have an example for calling `create_group_terminate_session` in integration tests_ ### Arguments @@ -56,11 +53,8 @@ See the endpoint docs at - 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 `SessionTerminationMessage`. Returns a message about the request status. - - diff --git a/docs/shared_links_files.md b/docs/shared_links_files.md index f7690f81..467eb0b4 100644 --- a/docs/shared_links_files.md +++ b/docs/shared_links_files.md @@ -1,6 +1,5 @@ # SharedLinksFilesManager - - [Find file for shared link](#find-file-for-shared-link) - [Get shared link for file](#get-shared-link-for-file) - [Add shared link to file](#add-shared-link-to-file) @@ -25,20 +24,19 @@ This operation is performed by calling function `get_shared_items`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shared-items/). -*Currently we don't have an example for calling `get_shared_items` in integration tests* +_Currently we don't have an example for calling `get_shared_items` in integration tests_ ### Arguments - fields `Optional[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. + - 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. - if_none_match `Optional[str]` - - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since. + - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since. - boxapi `str` - - A header containing the shared link and optional password for the shared link. The format for this header is as follows. `shared_link=[link]&shared_link_password=[password]` + - A header containing the shared link and optional password for the shared link. The format for this header is as follows. `shared_link=[link]&shared_link_password=[password]` - 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 `FileFull`. @@ -46,7 +44,6 @@ This function returns a value of type `FileFull`. Returns a full file resource if the shared link is valid and the user has access to it. - ## Get shared link for file Gets the information for a shared link on a file. @@ -56,18 +53,17 @@ This operation is performed by calling function `get_file_get_shared_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-get-shared-link/). -*Currently we don't have an example for calling `get_file_get_shared_link` in integration tests* +_Currently we don't have an example for calling `get_file_get_shared_link` in integration tests_ ### Arguments - 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" + - 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" - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. - 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 `FileFull`. @@ -75,7 +71,6 @@ This function returns a value of type `FileFull`. Returns the base representation of a file with the additional shared link information. - ## Add shared link to file Adds a shared link to a file. @@ -85,12 +80,12 @@ This operation is performed by calling function `update_file_add_shared_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-add-shared-link/). -*Currently we don't have an example for calling `update_file_add_shared_link` in integration tests* +_Currently we don't have an example for calling `update_file_add_shared_link` in integration tests_ ### Arguments - 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" + - 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" - shared_link `Optional[UpdateFileAddSharedLinkSharedLinkArg]` - The settings for the shared link to create on the file. Use an empty object (`{}`) to use the default settings for shared links. - fields `str` @@ -98,7 +93,6 @@ See the endpoint docs at - 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 `FileFull`. @@ -106,7 +100,6 @@ This function returns a value of type `FileFull`. Returns the base representation of a file with a new shared link attached. - ## Update shared link on file Updates a shared link on a file. @@ -116,12 +109,12 @@ This operation is performed by calling function `update_file_update_shared_link` See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-update-shared-link/). -*Currently we don't have an example for calling `update_file_update_shared_link` in integration tests* +_Currently we don't have an example for calling `update_file_update_shared_link` in integration tests_ ### Arguments - 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" + - 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" - shared_link `Optional[UpdateFileUpdateSharedLinkSharedLinkArg]` - The settings for the shared link to update. - fields `str` @@ -129,7 +122,6 @@ See the endpoint docs at - 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 `FileFull`. @@ -137,7 +129,6 @@ This function returns a value of type `FileFull`. Returns a basic representation of the file, with the updated shared link attached. - ## Remove shared link from file Removes a shared link from a file. @@ -147,12 +138,12 @@ This operation is performed by calling function `update_file_remove_shared_link` See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-remove-shared-link/). -*Currently we don't have an example for calling `update_file_remove_shared_link` in integration tests* +_Currently we don't have an example for calling `update_file_remove_shared_link` in integration tests_ ### Arguments - 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" + - 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" - shared_link `Optional[UpdateFileRemoveSharedLinkSharedLinkArg]` - By setting this value to `null`, the shared link is removed from the file. - fields `str` @@ -160,11 +151,8 @@ See the endpoint docs at - 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 `FileFull`. Returns a basic representation of a file, with the shared link removed. - - diff --git a/docs/shared_links_folders.md b/docs/shared_links_folders.md index c8f02ed0..d7c37fd3 100644 --- a/docs/shared_links_folders.md +++ b/docs/shared_links_folders.md @@ -1,6 +1,5 @@ # SharedLinksFoldersManager - - [Find folder for shared link](#find-folder-for-shared-link) - [Get shared link for folder](#get-shared-link-for-folder) - [Add shared link to folder](#add-shared-link-to-folder) @@ -22,20 +21,19 @@ This operation is performed by calling function `get_shared_item_folders`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shared-items-folders/). -*Currently we don't have an example for calling `get_shared_item_folders` in integration tests* +_Currently we don't have an example for calling `get_shared_item_folders` in integration tests_ ### Arguments - fields `Optional[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. + - 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. - if_none_match `Optional[str]` - - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since. + - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since. - boxapi `str` - - A header containing the shared link and optional password for the shared link. The format for this header is as follows. `shared_link=[link]&shared_link_password=[password]` + - A header containing the shared link and optional password for the shared link. The format for this header is as follows. `shared_link=[link]&shared_link_password=[password]` - 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 `FolderFull`. @@ -43,7 +41,6 @@ This function returns a value of type `FolderFull`. Returns a full folder resource if the shared link is valid and the user has access to it. - ## Get shared link for folder Gets the information for a shared link on a folder. @@ -53,18 +50,17 @@ This operation is performed by calling function `get_folder_get_shared_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-get-shared-link/). -*Currently we don't have an example for calling `get_folder_get_shared_link` in integration tests* +_Currently we don't have an example for calling `get_folder_get_shared_link` in integration tests_ ### Arguments - 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" + - 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" - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. - 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 `FolderFull`. @@ -72,7 +68,6 @@ This function returns a value of type `FolderFull`. Returns the base representation of a folder with the additional shared link information. - ## Add shared link to folder Adds a shared link to a folder. @@ -82,20 +77,19 @@ This operation is performed by calling function `update_folder_add_shared_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-folders-id-add-shared-link/). -*Currently we don't have an example for calling `update_folder_add_shared_link` in integration tests* +_Currently we don't have an example for calling `update_folder_add_shared_link` in integration tests_ ### Arguments - 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" + - 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" - shared_link `Optional[UpdateFolderAddSharedLinkSharedLinkArg]` - - The settings for the shared link to create on the folder. Use an empty object (`{}`) to use the default settings for shared links. + - The settings for the shared link to create on the folder. Use an empty object (`{}`) to use the default settings for shared links. - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. - 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 `FolderFull`. @@ -103,7 +97,6 @@ This function returns a value of type `FolderFull`. Returns the base representation of a folder with a new shared link attached. - ## Update shared link on folder Updates a shared link on a folder. @@ -113,12 +106,12 @@ This operation is performed by calling function `update_folder_update_shared_lin See the endpoint docs at [API Reference](https://developer.box.com/reference/put-folders-id-update-shared-link/). -*Currently we don't have an example for calling `update_folder_update_shared_link` in integration tests* +_Currently we don't have an example for calling `update_folder_update_shared_link` in integration tests_ ### Arguments - 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" + - 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" - shared_link `Optional[UpdateFolderUpdateSharedLinkSharedLinkArg]` - The settings for the shared link to update. - fields `str` @@ -126,7 +119,6 @@ See the endpoint docs at - 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 `FolderFull`. @@ -134,7 +126,6 @@ This function returns a value of type `FolderFull`. Returns a basic representation of the folder, with the updated shared link attached. - ## Remove shared link from folder Removes a shared link from a folder. @@ -144,12 +135,12 @@ This operation is performed by calling function `update_folder_remove_shared_lin See the endpoint docs at [API Reference](https://developer.box.com/reference/put-folders-id-remove-shared-link/). -*Currently we don't have an example for calling `update_folder_remove_shared_link` in integration tests* +_Currently we don't have an example for calling `update_folder_remove_shared_link` in integration tests_ ### Arguments - 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" + - 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" - shared_link `Optional[UpdateFolderRemoveSharedLinkSharedLinkArg]` - By setting this value to `null`, the shared link is removed from the folder. - fields `str` @@ -157,11 +148,8 @@ See the endpoint docs at - 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 `FolderFull`. Returns a basic representation of a folder, with the shared link removed. - - diff --git a/docs/shared_links_web_links.md b/docs/shared_links_web_links.md index 46b7fe9c..4a894482 100644 --- a/docs/shared_links_web_links.md +++ b/docs/shared_links_web_links.md @@ -1,6 +1,5 @@ # SharedLinksWebLinksManager - - [Find web link for shared link](#find-web-link-for-shared-link) - [Get shared link for web link](#get-shared-link-for-web-link) - [Add shared link to web link](#add-shared-link-to-web-link) @@ -22,20 +21,19 @@ This operation is performed by calling function `get_shared_item_web_links`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shared-items-web-links/). -*Currently we don't have an example for calling `get_shared_item_web_links` in integration tests* +_Currently we don't have an example for calling `get_shared_item_web_links` in integration tests_ ### Arguments - fields `Optional[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. + - 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. - if_none_match `Optional[str]` - - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since. + - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since. - boxapi `str` - - A header containing the shared link and optional password for the shared link. The format for this header is as follows. `shared_link=[link]&shared_link_password=[password]` + - A header containing the shared link and optional password for the shared link. The format for this header is as follows. `shared_link=[link]&shared_link_password=[password]` - 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 `WebLink`. @@ -43,7 +41,6 @@ This function returns a value of type `WebLink`. Returns a full file resource if the shared link is valid and the user has access to it. - ## Get shared link for web link Gets the information for a shared link on a web link. @@ -53,7 +50,7 @@ This operation is performed by calling function `get_web_link_get_shared_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-web-links-id-get-shared-link/). -*Currently we don't have an example for calling `get_web_link_get_shared_link` in integration tests* +_Currently we don't have an example for calling `get_web_link_get_shared_link` in integration tests_ ### Arguments @@ -64,7 +61,6 @@ See the endpoint docs at - 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 `WebLink`. @@ -72,7 +68,6 @@ This function returns a value of type `WebLink`. Returns the base representation of a web link with the additional shared link information. - ## Add shared link to web link Adds a shared link to a web link. @@ -82,20 +77,19 @@ This operation is performed by calling function `update_web_link_add_shared_link See the endpoint docs at [API Reference](https://developer.box.com/reference/put-web-links-id-add-shared-link/). -*Currently we don't have an example for calling `update_web_link_add_shared_link` in integration tests* +_Currently we don't have an example for calling `update_web_link_add_shared_link` in integration tests_ ### Arguments - web_link_id `str` - The ID of the web link. Example: "12345" - shared_link `Optional[UpdateWebLinkAddSharedLinkSharedLinkArg]` - - The settings for the shared link to create on the web link. Use an empty object (`{}`) to use the default settings for shared links. + - The settings for the shared link to create on the web link. Use an empty object (`{}`) to use the default settings for shared links. - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. - 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 `WebLink`. @@ -103,7 +97,6 @@ This function returns a value of type `WebLink`. Returns the base representation of a web link with a new shared link attached. - ## Update shared link on web link Updates a shared link on a web link. @@ -113,7 +106,7 @@ This operation is performed by calling function `update_web_link_update_shared_l See the endpoint docs at [API Reference](https://developer.box.com/reference/put-web-links-id-update-shared-link/). -*Currently we don't have an example for calling `update_web_link_update_shared_link` in integration tests* +_Currently we don't have an example for calling `update_web_link_update_shared_link` in integration tests_ ### Arguments @@ -126,7 +119,6 @@ See the endpoint docs at - 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 `WebLink`. @@ -134,7 +126,6 @@ This function returns a value of type `WebLink`. Returns a basic representation of the web link, with the updated shared link attached. - ## Remove shared link from web link Removes a shared link from a web link. @@ -144,7 +135,7 @@ This operation is performed by calling function `update_web_link_remove_shared_l See the endpoint docs at [API Reference](https://developer.box.com/reference/put-web-links-id-remove-shared-link/). -*Currently we don't have an example for calling `update_web_link_remove_shared_link` in integration tests* +_Currently we don't have an example for calling `update_web_link_remove_shared_link` in integration tests_ ### Arguments @@ -157,12 +148,9 @@ See the endpoint docs at - 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 `WebLink`. Returns a basic representation of a web link, with the shared link removed. - - diff --git a/docs/shield_information_barrier_reports.md b/docs/shield_information_barrier_reports.md index 5e392562..cf6ab7a3 100644 --- a/docs/shield_information_barrier_reports.md +++ b/docs/shield_information_barrier_reports.md @@ -1,6 +1,5 @@ # ShieldInformationBarrierReportsManager - - [List shield information barrier reports](#list-shield-information-barrier-reports) - [Create shield information barrier report](#create-shield-information-barrier-report) - [Get shield information barrier report by ID](#get-shield-information-barrier-report-by-id) @@ -14,27 +13,25 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barrier-reports/). -*Currently we don't have an example for calling `get_shield_information_barrier_reports` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_reports` in integration tests_ ### Arguments - shield_information_barrier_id `str` - The ID of the shield information barrier. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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`. Returns a paginated list of shield information barrier report objects. - ## Create shield information barrier report Creates a shield information barrier report for a given barrier. @@ -44,23 +41,21 @@ This operation is performed by calling function `create_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/post-shield-information-barrier-reports/). -*Currently we don't have an example for calling `create_shield_information_barrier_report` in integration tests* +_Currently we don't have an example for calling `create_shield_information_barrier_report` in integration tests_ ### Arguments - shield_information_barrier `Optional[ShieldInformationBarrierBase]` - - + - - 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 `ShieldInformationBarrierReport`. Returns the shield information barrier report information object. - ## Get shield information barrier report by ID Retrieves a shield information barrier report by its ID. @@ -70,7 +65,7 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barrier-reports-id/). -*Currently we don't have an example for calling `get_shield_information_barrier_report_by_id` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_report_by_id` in integration tests_ ### Arguments @@ -79,11 +74,8 @@ See the endpoint docs at - 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 `ShieldInformationBarrierReport`. -Returns the shield information barrier report object. - - +Returns the shield information barrier report object. diff --git a/docs/shield_information_barrier_segment_members.md b/docs/shield_information_barrier_segment_members.md index 6bac9272..44a130e8 100644 --- a/docs/shield_information_barrier_segment_members.md +++ b/docs/shield_information_barrier_segment_members.md @@ -1,6 +1,5 @@ # ShieldInformationBarrierSegmentMembersManager - - [Get shield information barrier segment member by ID](#get-shield-information-barrier-segment-member-by-id) - [Delete shield information barrier segment member by ID](#delete-shield-information-barrier-segment-member-by-id) - [List shield information barrier segment members](#list-shield-information-barrier-segment-members) @@ -16,7 +15,7 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barrier-segment-members-id/). -*Currently we don't have an example for calling `get_shield_information_barrier_segment_member_by_id` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_segment_member_by_id` in integration tests_ ### Arguments @@ -25,14 +24,12 @@ See the endpoint docs at - 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 `ShieldInformationBarrierSegmentMember`. Returns the shield information barrier segment member object. - ## Delete shield information barrier segment member by ID Deletes a shield information barrier @@ -43,7 +40,7 @@ This operation is performed by calling function `delete_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-shield-information-barrier-segment-members-id/). -*Currently we don't have an example for calling `delete_shield_information_barrier_segment_member_by_id` in integration tests* +_Currently we don't have an example for calling `delete_shield_information_barrier_segment_member_by_id` in integration tests_ ### Arguments @@ -52,7 +49,6 @@ See the endpoint docs at - 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`. @@ -60,7 +56,6 @@ This function returns a value of type `None`. Returns an empty response if the segment member was deleted successfully. - ## List shield information barrier segment members Lists shield information barrier segment members @@ -71,20 +66,19 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barrier-segment-members/). -*Currently we don't have an example for calling `get_shield_information_barrier_segment_members` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_segment_members` in integration tests_ ### Arguments - shield_information_barrier_segment_id `str` - The ID of the shield information barrier segment. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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`. @@ -92,7 +86,6 @@ This function returns a value of type `None`. Returns a paginated list of shield information barrier segment member objects. - ## Create shield information barrier segment member Creates a new shield information barrier segment member. @@ -102,26 +95,23 @@ This operation is performed by calling function `create_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/post-shield-information-barrier-segment-members/). -*Currently we don't have an example for calling `create_shield_information_barrier_segment_member` in integration tests* +_Currently we don't have an example for calling `create_shield_information_barrier_segment_member` in integration tests_ ### Arguments - type `Optional[CreateShieldInformationBarrierSegmentMemberTypeArg]` - -| A type of the shield barrier segment member. - shield_information_barrier `Optional[ShieldInformationBarrierBase]` - - + - - shield_information_barrier_segment `CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg` - The `type` and `id` of the requested shield information barrier segment. - user `UserBase` - - + - - 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 `ShieldInformationBarrierSegmentMember`. Returns a new shield information barrier segment Member object. - - diff --git a/docs/shield_information_barrier_segment_restrictions.md b/docs/shield_information_barrier_segment_restrictions.md index dd0bf614..ad14d476 100644 --- a/docs/shield_information_barrier_segment_restrictions.md +++ b/docs/shield_information_barrier_segment_restrictions.md @@ -1,6 +1,5 @@ # ShieldInformationBarrierSegmentRestrictionsManager - - [Get shield information barrier segment restriction by ID](#get-shield-information-barrier-segment-restriction-by-id) - [Delete shield information barrier segment restriction by ID](#delete-shield-information-barrier-segment-restriction-by-id) - [List shield information barrier segment restrictions](#list-shield-information-barrier-segment-restrictions) @@ -16,7 +15,7 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barrier-segment-restrictions-id/). -*Currently we don't have an example for calling `get_shield_information_barrier_segment_restriction_by_id` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_segment_restriction_by_id` in integration tests_ ### Arguments @@ -25,7 +24,6 @@ See the endpoint docs at - 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 `ShieldInformationBarrierSegmentRestriction`. @@ -33,7 +31,6 @@ This function returns a value of type `ShieldInformationBarrierSegmentRestrictio Returns the shield information barrier segment restriction object. - ## Delete shield information barrier segment restriction by ID Delete shield information barrier segment restriction @@ -44,7 +41,7 @@ This operation is performed by calling function `delete_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-shield-information-barrier-segment-restrictions-id/). -*Currently we don't have an example for calling `delete_shield_information_barrier_segment_restriction_by_id` in integration tests* +_Currently we don't have an example for calling `delete_shield_information_barrier_segment_restriction_by_id` in integration tests_ ### Arguments @@ -53,14 +50,12 @@ See the endpoint docs at - 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`. Empty body in response - ## List shield information barrier segment restrictions Lists shield information barrier segment restrictions @@ -71,20 +66,19 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barrier-segment-restrictions/). -*Currently we don't have an example for calling `get_shield_information_barrier_segment_restrictions` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_segment_restrictions` in integration tests_ ### Arguments - shield_information_barrier_segment_id `str` - The ID of the shield information barrier segment. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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`. @@ -92,7 +86,6 @@ This function returns a value of type `None`. Returns a paginated list of shield information barrier segment restriction objects. - ## Create shield information barrier segment restriction Creates a shield information barrier @@ -103,14 +96,14 @@ This operation is performed by calling function `create_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/post-shield-information-barrier-segment-restrictions/). -*Currently we don't have an example for calling `create_shield_information_barrier_segment_restriction` in integration tests* +_Currently we don't have an example for calling `create_shield_information_barrier_segment_restriction` in integration tests_ ### Arguments - type `CreateShieldInformationBarrierSegmentRestrictionTypeArg` - The type of the shield barrier segment restriction for this member. - shield_information_barrier `Optional[ShieldInformationBarrierBase]` - - + - - shield_information_barrier_segment `CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg` - The `type` and `id` of the requested shield information barrier segment. - restricted_segment `CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg` @@ -118,12 +111,9 @@ See the endpoint docs at - 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 `ShieldInformationBarrierSegmentRestriction`. Returns the newly created Shield Information Barrier Segment Restriction object. - - diff --git a/docs/shield_information_barrier_segments.md b/docs/shield_information_barrier_segments.md index fe36608c..f502d291 100644 --- a/docs/shield_information_barrier_segments.md +++ b/docs/shield_information_barrier_segments.md @@ -1,6 +1,5 @@ # ShieldInformationBarrierSegmentsManager - - [Get shield information barrier segment with specified ID](#get-shield-information-barrier-segment-with-specified-id) - [Update shield information barrier segment with specified ID](#update-shield-information-barrier-segment-with-specified-id) - [Delete shield information barrier segment](#delete-shield-information-barrier-segment) @@ -16,7 +15,7 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barrier-segments-id/). -*Currently we don't have an example for calling `get_shield_information_barrier_segment_by_id` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_segment_by_id` in integration tests_ ### Arguments @@ -25,14 +24,12 @@ See the endpoint docs at - 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 `ShieldInformationBarrierSegment`. Returns the shield information barrier segment object. - ## Update shield information barrier segment with specified ID Updates the shield information barrier segment based on provided ID.. @@ -42,7 +39,7 @@ This operation is performed by calling function `update_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/put-shield-information-barrier-segments-id/). -*Currently we don't have an example for calling `update_shield_information_barrier_segment_by_id` in integration tests* +_Currently we don't have an example for calling `update_shield_information_barrier_segment_by_id` in integration tests_ ### Arguments @@ -55,14 +52,12 @@ See the endpoint docs at - 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 `ShieldInformationBarrierSegment`. Returns the updated shield information barrier segment object. - ## Delete shield information barrier segment Deletes the shield information barrier segment @@ -73,7 +68,7 @@ This operation is performed by calling function `delete_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-shield-information-barrier-segments-id/). -*Currently we don't have an example for calling `delete_shield_information_barrier_segment_by_id` in integration tests* +_Currently we don't have an example for calling `delete_shield_information_barrier_segment_by_id` in integration tests_ ### Arguments @@ -82,14 +77,12 @@ See the endpoint docs at - 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`. Empty body in response - ## List shield information barrier segments Retrieves a list of shield information barrier segment objects @@ -100,27 +93,25 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barrier-segments/). -*Currently we don't have an example for calling `get_shield_information_barrier_segments` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_segments` in integration tests_ ### Arguments - shield_information_barrier_id `str` - The ID of the shield information barrier. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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`. Returns a paginated list of shield information barrier segment objects. - ## Create shield information barrier segment Creates a shield information barrier segment. @@ -130,12 +121,12 @@ This operation is performed by calling function `create_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/post-shield-information-barrier-segments/). -*Currently we don't have an example for calling `create_shield_information_barrier_segment` in integration tests* +_Currently we don't have an example for calling `create_shield_information_barrier_segment` in integration tests_ ### Arguments - shield_information_barrier `ShieldInformationBarrierBase` - - + - - name `str` - Name of the shield information barrier segment - description `Optional[str]` @@ -143,11 +134,8 @@ See the endpoint docs at - 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 `ShieldInformationBarrierSegment`. Returns a new shield information barrier segment object. - - diff --git a/docs/shield_information_barriers.md b/docs/shield_information_barriers.md index f5957607..ba4381bc 100644 --- a/docs/shield_information_barriers.md +++ b/docs/shield_information_barriers.md @@ -1,6 +1,5 @@ # ShieldInformationBarriersManager - - [Get shield information barrier with specified ID](#get-shield-information-barrier-with-specified-id) - [Add changed status of shield information barrier with specified ID](#add-changed-status-of-shield-information-barrier-with-specified-id) - [List shield information barriers](#list-shield-information-barriers) @@ -15,7 +14,7 @@ This operation is performed by calling function `get_shield_information_barrier_ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barriers-id/). -*Currently we don't have an example for calling `get_shield_information_barrier_by_id` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barrier_by_id` in integration tests_ ### Arguments @@ -24,14 +23,12 @@ See the endpoint docs at - 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 `ShieldInformationBarrier`. Returns the shield information barrier object. - ## Add changed status of shield information barrier with specified ID Change status of shield information barrier with the specified ID. @@ -41,7 +38,7 @@ This operation is performed by calling function `create_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/post-shield-information-barriers-change-status/). -*Currently we don't have an example for calling `create_shield_information_barrier_change_status` in integration tests* +_Currently we don't have an example for calling `create_shield_information_barrier_change_status` in integration tests_ ### Arguments @@ -52,14 +49,12 @@ See the endpoint docs at - 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 `ShieldInformationBarrier`. Returns the updated shield information barrier object. - ## List shield information barriers Retrieves a list of shield information barrier objects @@ -70,18 +65,17 @@ This operation is performed by calling function `get_shield_information_barriers See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shield-information-barriers/). -*Currently we don't have an example for calling `get_shield_information_barriers` in integration tests* +_Currently we don't have an example for calling `get_shield_information_barriers` in integration tests_ ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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`. @@ -90,7 +84,6 @@ Returns a paginated list of shield information barrier objects, empty list if currently no barrier. - ## Create shield information barrier Creates a shield information barrier to @@ -102,7 +95,7 @@ This operation is performed by calling function `create_shield_information_barri See the endpoint docs at [API Reference](https://developer.box.com/reference/post-shield-information-barriers/). -*Currently we don't have an example for calling `create_shield_information_barrier` in integration tests* +_Currently we don't have an example for calling `create_shield_information_barrier` in integration tests_ ### Arguments @@ -111,29 +104,26 @@ See the endpoint docs at - type `Optional[CreateShieldInformationBarrierTypeArg]` - The type of the shield information barrier - enterprise `Optional[EnterpriseBase]` - - + - - status `Optional[CreateShieldInformationBarrierStatusArg]` - Status of the shield information barrier - created_at `Optional[str]` - ISO date time string when this shield information barrier object was created. - created_by `Optional[UserBase]` - - + - - updated_at `Optional[str]` - ISO date time string when this shield information barrier was updated. - updated_by `Optional[UserBase]` - - + - - enabled_at `Optional[str]` - ISO date time string when this shield information barrier was enabled. - enabled_by `Optional[UserBase]` - - + - - 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 `ShieldInformationBarrier`. Returns a new shield information barrier object. - - diff --git a/docs/sign_templates.md b/docs/sign_templates.md index 3d162d91..0a091e05 100644 --- a/docs/sign_templates.md +++ b/docs/sign_templates.md @@ -1,6 +1,5 @@ # SignTemplatesManager - - [List Box Sign templates](#list-box-sign-templates) - [Get Box Sign template by ID](#get-box-sign-template-by-id) @@ -13,25 +12,23 @@ 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* +_Currently we don't have an example for calling `get_sign_templates` in integration tests_ ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `SignTemplates`. Returns a collection of templates. - ## Get Box Sign template by ID Fetches details of a specific Box Sign template. @@ -41,7 +38,7 @@ 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* +_Currently we don't have an example for calling `get_sign_template_by_id` in integration tests_ ### Arguments @@ -50,11 +47,8 @@ See the endpoint docs at - 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 `SignTemplate`. Returns details of a template. - - diff --git a/docs/skills.md b/docs/skills.md index c090b10b..c957b309 100644 --- a/docs/skills.md +++ b/docs/skills.md @@ -1,6 +1,5 @@ # SkillsManager - - [List Box Skill cards on file](#list-box-skill-cards-on-file) - [Create Box Skill cards on file](#create-box-skill-cards-on-file) - [Update Box Skill cards on file](#update-box-skill-cards-on-file) @@ -16,16 +15,15 @@ This operation is performed by calling function `get_file_metadata_global_box_sk See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-metadata-global-box-skills-cards/). -*Currently we don't have an example for calling `get_file_metadata_global_box_skills_cards` in integration tests* +_Currently we don't have an example for calling `get_file_metadata_global_box_skills_cards` in integration tests_ ### Arguments - 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" + - 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" - 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 `SkillCardsMetadata`. @@ -35,7 +33,6 @@ Returns all the metadata associated with a file. This API does not support pagination and will therefore always return all of the metadata associated to the file. - ## Create Box Skill cards on file Applies one or more Box Skills metadata cards to a file. @@ -45,18 +42,17 @@ This operation is performed by calling function `create_file_metadata_global_box See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-id-metadata-global-box-skills-cards/). -*Currently we don't have an example for calling `create_file_metadata_global_box_skills_card` in integration tests* +_Currently we don't have an example for calling `create_file_metadata_global_box_skills_card` in integration tests_ ### Arguments - 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" + - 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" - cards `List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]` - A list of Box Skill cards to apply to this file. - 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 `SkillCardsMetadata`. @@ -64,7 +60,6 @@ This function returns a value of type `SkillCardsMetadata`. Returns the instance of the template that was applied to the file, including the data that was applied to the template. - ## Update Box Skill cards on file Updates one or more Box Skills metadata cards to a file. @@ -74,18 +69,17 @@ This operation is performed by calling function `update_file_metadata_global_box See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-metadata-global-box-skills-cards/). -*Currently we don't have an example for calling `update_file_metadata_global_box_skills_card` in integration tests* +_Currently we don't have an example for calling `update_file_metadata_global_box_skills_card` in integration tests_ ### Arguments - 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" + - 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" - request_body `List[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg]` - Request body of updateFileMetadataGlobalBoxSkillsCard method - 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 `SkillCardsMetadata`. @@ -93,7 +87,6 @@ This function returns a value of type `SkillCardsMetadata`. Returns the updated metadata template, with the custom template data included. - ## Remove Box Skill cards from file Removes any Box Skills cards metadata from a file. @@ -103,16 +96,15 @@ This operation is performed by calling function `delete_file_metadata_global_box See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-id-metadata-global-box-skills-cards/). -*Currently we don't have an example for calling `delete_file_metadata_global_box_skills_card` in integration tests* +_Currently we don't have an example for calling `delete_file_metadata_global_box_skills_card` in integration tests_ ### Arguments - 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" + - 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" - 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`. @@ -120,7 +112,6 @@ This function returns a value of type `None`. Returns an empty response when the cards are successfully deleted. - ## Update all Box Skill cards on file An alternative method that can be used to overwrite and update all Box Skill @@ -131,7 +122,7 @@ This operation is performed by calling function `update_skill_invocation_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-skill-invocations-id/). -*Currently we don't have an example for calling `update_skill_invocation_by_id` in integration tests* +_Currently we don't have an example for calling `update_skill_invocation_by_id` in integration tests_ ### Arguments @@ -146,15 +137,12 @@ See the endpoint docs at - file_version `Optional[UpdateSkillInvocationByIdFileVersionArg]` - The optional file version to assign the cards to. - usage `Optional[UpdateSkillInvocationByIdUsageArg]` - - A descriptor that defines what items are affected by this call. Set this to the default values when setting a card to a `success` state, and leave it out in most other situations. + - A descriptor that defines what items are affected by this call. Set this to the default values when setting a card to a `success` state, and leave it out in most other situations. - 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`. Returns an empty response when the card has been successfully updated. - - diff --git a/docs/storage_policies.md b/docs/storage_policies.md index c1bd84b9..8b5835ae 100644 --- a/docs/storage_policies.md +++ b/docs/storage_policies.md @@ -1,6 +1,5 @@ # StoragePoliciesManager - - [List storage policies](#list-storage-policies) - [Get storage policy](#get-storage-policy) @@ -15,27 +14,25 @@ This operation is performed by calling function `get_storage_policies`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-storage-policies/). -*Currently we don't have an example for calling `get_storage_policies` in integration tests* +_Currently we don't have an example for calling `get_storage_policies` in integration tests_ ### Arguments - fields `Optional[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. + - 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. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `StoragePolicies`. Returns a collection of storage policies. - ## Get storage policy Fetches a specific storage policy. Only a Primary Admin can access this endpoint. The user needs to generate a token for an account to authenticate this request. @@ -45,7 +42,7 @@ This operation is performed by calling function `get_storage_policy_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-storage-policies-id/). -*Currently we don't have an example for calling `get_storage_policy_by_id` in integration tests* +_Currently we don't have an example for calling `get_storage_policy_by_id` in integration tests_ ### Arguments @@ -54,11 +51,8 @@ See the endpoint docs at - 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 `StoragePolicy`. Returns a storage policy object. - - diff --git a/docs/storage_policy_assignments.md b/docs/storage_policy_assignments.md index 1015db0a..a85ec823 100644 --- a/docs/storage_policy_assignments.md +++ b/docs/storage_policy_assignments.md @@ -1,6 +1,5 @@ # StoragePolicyAssignmentsManager - - [List storage policy assignments](#list-storage-policy-assignments) - [Assign storage policy](#assign-storage-policy) - [Get storage policy assignment](#get-storage-policy-assignment) @@ -18,12 +17,12 @@ This operation is performed by calling function `get_storage_policy_assignments` See the endpoint docs at [API Reference](https://developer.box.com/reference/get-storage-policy-assignments/). -*Currently we don't have an example for calling `get_storage_policy_assignments` in integration tests* +_Currently we don't have an example for calling `get_storage_policy_assignments` in integration tests_ ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - resolved_for_type `GetStoragePolicyAssignmentsResolvedForTypeArg` - The target type to return assignments for - resolved_for_id `str` @@ -31,7 +30,6 @@ See the endpoint docs at - 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 `StoragePolicyAssignments`. @@ -39,7 +37,6 @@ This function returns a value of type `StoragePolicyAssignments`. Returns a collection of storage policies for the enterprise or user. - ## Assign storage policy Creates a storage policy assignment for an enterprise or user. @@ -51,7 +48,7 @@ This operation is performed by calling function `create_storage_policy_assignmen See the endpoint docs at [API Reference](https://developer.box.com/reference/post-storage-policy-assignments/). -*Currently we don't have an example for calling `create_storage_policy_assignment` in integration tests* +_Currently we don't have an example for calling `create_storage_policy_assignment` in integration tests_ ### Arguments @@ -62,14 +59,12 @@ See the endpoint docs at - 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 `StoragePolicyAssignment`. Returns the new storage policy assignment created. - ## Get storage policy assignment Fetches a specific storage policy assignment. Only a Primary Admin can access this endpoint. The user needs to generate a token for an account to authenticate this request. @@ -79,7 +74,7 @@ This operation is performed by calling function `get_storage_policy_assignment_b See the endpoint docs at [API Reference](https://developer.box.com/reference/get-storage-policy-assignments-id/). -*Currently we don't have an example for calling `get_storage_policy_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `get_storage_policy_assignment_by_id` in integration tests_ ### Arguments @@ -88,14 +83,12 @@ See the endpoint docs at - 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 `StoragePolicyAssignment`. Returns a storage policy assignment object. - ## Update storage policy assignment Updates a specific storage policy assignment. Only a Primary Admin can access this endpoint. The user needs to generate a token for an account to authenticate this request. @@ -105,7 +98,7 @@ This operation is performed by calling function `update_storage_policy_assignmen See the endpoint docs at [API Reference](https://developer.box.com/reference/put-storage-policy-assignments-id/). -*Currently we don't have an example for calling `update_storage_policy_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `update_storage_policy_assignment_by_id` in integration tests_ ### Arguments @@ -116,14 +109,12 @@ See the endpoint docs at - 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 `StoragePolicyAssignment`. Returns an updated storage policy assignment object. - ## Unassign storage policy Delete a storage policy assignment. @@ -143,7 +134,7 @@ This operation is performed by calling function `delete_storage_policy_assignmen See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-storage-policy-assignments-id/). -*Currently we don't have an example for calling `delete_storage_policy_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `delete_storage_policy_assignment_by_id` in integration tests_ ### Arguments @@ -152,12 +143,9 @@ See the endpoint docs at - 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`. Returns an empty response when the storage policy assignment is successfully deleted. - - diff --git a/docs/task_assignments.md b/docs/task_assignments.md index e6f00a44..90fe9d84 100644 --- a/docs/task_assignments.md +++ b/docs/task_assignments.md @@ -1,6 +1,5 @@ # TaskAssignmentsManager - - [List task assignments](#list-task-assignments) - [Assign task](#assign-task) - [Get task assignment](#get-task-assignment) @@ -16,7 +15,7 @@ This operation is performed by calling function `get_task_assignments`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-tasks-id-assignments/). -*Currently we don't have an example for calling `get_task_assignments` in integration tests* +_Currently we don't have an example for calling `get_task_assignments` in integration tests_ ### Arguments @@ -25,7 +24,6 @@ See the endpoint docs at - 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 `TaskAssignments`. @@ -33,7 +31,6 @@ This function returns a value of type `TaskAssignments`. Returns a collection of task assignment defining what task on a file has been assigned to which users and by who. - ## Assign task Assigns a task to a user. @@ -46,7 +43,7 @@ This operation is performed by calling function `create_task_assignment`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-task-assignments/). -*Currently we don't have an example for calling `create_task_assignment` in integration tests* +_Currently we don't have an example for calling `create_task_assignment` in integration tests_ ### Arguments @@ -57,14 +54,12 @@ See the endpoint docs at - 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 `TaskAssignment`. Returns a new task assignment object. - ## Get task assignment Retrieves information about a task assignment. @@ -74,7 +69,7 @@ This operation is performed by calling function `get_task_assignment_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-task-assignments-id/). -*Currently we don't have an example for calling `get_task_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `get_task_assignment_by_id` in integration tests_ ### Arguments @@ -83,7 +78,6 @@ See the endpoint docs at - 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 `TaskAssignment`. @@ -91,7 +85,6 @@ This function returns a value of type `TaskAssignment`. Returns a task assignment, specifying who the task has been assigned to and by whom. - ## Update task assignment Updates a task assignment. This endpoint can be @@ -102,7 +95,7 @@ This operation is performed by calling function `update_task_assignment_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-task-assignments-id/). -*Currently we don't have an example for calling `update_task_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `update_task_assignment_by_id` in integration tests_ ### Arguments @@ -111,18 +104,16 @@ See the endpoint docs at - message `Optional[str]` - An optional message by the assignee that can be added to the task. - resolution_state `Optional[UpdateTaskAssignmentByIdResolutionStateArg]` - - The state of the task assigned to the user. * For a task with an `action` value of `complete` this can be `incomplete` or `completed`. * For a task with an `action` of `review` this can be `incomplete`, `approved`, or `rejected`. + - The state of the task assigned to the user. _ For a task with an `action` value of `complete` this can be `incomplete` or `completed`. _ For a task with an `action` of `review` this can be `incomplete`, `approved`, or `rejected`. - 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 `TaskAssignment`. Returns the updated task assignment object. - ## Unassign task Deletes a specific task assignment. @@ -132,7 +123,7 @@ This operation is performed by calling function `delete_task_assignment_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-task-assignments-id/). -*Currently we don't have an example for calling `delete_task_assignment_by_id` in integration tests* +_Currently we don't have an example for calling `delete_task_assignment_by_id` in integration tests_ ### Arguments @@ -141,12 +132,9 @@ See the endpoint docs at - 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`. Returns an empty response when the task assignment was successfully deleted. - - diff --git a/docs/tasks.md b/docs/tasks.md index 6401e5c7..5631cbd8 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -1,6 +1,5 @@ # TasksManager - - [List tasks on file](#list-tasks-on-file) - [Create task](#create-task) - [Get task](#get-task) @@ -18,6 +17,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-tasks/). + ```python client.tasks.get_file_tasks(file_id=file.id) ``` @@ -25,11 +25,10 @@ client.tasks.get_file_tasks(file_id=file.id) ### Arguments - 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" + - 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" - 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 `Tasks`. @@ -39,7 +38,6 @@ Returns a list of tasks on a file. If there are no tasks on this file an empty collection is returned instead. - ## Create task Creates a single task on a file. This task is not assigned to any user and @@ -51,6 +49,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-tasks/). + ```python client.tasks.create_task(item=CreateTaskItemArg(type=CreateTaskItemArgTypeField.FILE.value, id=file.id), action=CreateTaskActionArg.REVIEW.value, message='test message', due_at='2035-01-01T00:00:00Z', completion_rule=CreateTaskCompletionRuleArg.ALL_ASSIGNEES.value) ``` @@ -60,24 +59,22 @@ client.tasks.create_task(item=CreateTaskItemArg(type=CreateTaskItemArgTypeField. - item `CreateTaskItemArg` - The file to attach the task to. - action `Optional[CreateTaskActionArg]` - - The action the task assignee will be prompted to do. Must be * `review` defines an approval task that can be approved or rejected * `complete` defines a general task which can be completed + - The action the task assignee will be prompted to do. Must be _ `review` defines an approval task that can be approved or rejected _ `complete` defines a general task which can be completed - message `Optional[str]` - An optional message to include with the task. - due_at `Optional[str]` - Defines when the task is due. Defaults to `null` if not provided. - completion_rule `Optional[CreateTaskCompletionRuleArg]` - - Defines which assignees need to complete this task before the task is considered completed. * `all_assignees` (default) requires all assignees to review or approve the the task in order for it to be considered completed. * `any_assignee` accepts any one assignee to review or approve the the task in order for it to be considered completed. + - Defines which assignees need to complete this task before the task is considered completed. _ `all_assignees` (default) requires all assignees to review or approve the the task in order for it to be considered completed. _ `any_assignee` accepts any one assignee to review or approve the the task in order for it to be considered completed. - 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 `Task`. Returns the newly created task. - ## Get task Retrieves information about a specific task. @@ -88,6 +85,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-tasks-id/). + ```python client.tasks.get_task_by_id(task_id=task.id) ``` @@ -99,14 +97,12 @@ client.tasks.get_task_by_id(task_id=task.id) - 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 `Task`. Returns a task object. - ## Update task Updates a task. This can be used to update a task's configuration, or to @@ -118,6 +114,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/put-tasks-id/). + ```python client.tasks.update_task_by_id(task_id=task.id, message='updated message') ``` @@ -127,24 +124,22 @@ client.tasks.update_task_by_id(task_id=task.id, message='updated message') - task_id `str` - The ID of the task. Example: "12345" - action `Optional[UpdateTaskByIdActionArg]` - - The action the task assignee will be prompted to do. Must be * `review` defines an approval task that can be approved or rejected * `complete` defines a general task which can be completed + - The action the task assignee will be prompted to do. Must be _ `review` defines an approval task that can be approved or rejected _ `complete` defines a general task which can be completed - message `Optional[str]` - The message included with the task. - due_at `Optional[str]` - When the task is due at. - completion_rule `Optional[UpdateTaskByIdCompletionRuleArg]` - - Defines which assignees need to complete this task before the task is considered completed. * `all_assignees` (default) requires all assignees to review or approve the the task in order for it to be considered completed. * `any_assignee` accepts any one assignee to review or approve the the task in order for it to be considered completed. + - Defines which assignees need to complete this task before the task is considered completed. _ `all_assignees` (default) requires all assignees to review or approve the the task in order for it to be considered completed. _ `any_assignee` accepts any one assignee to review or approve the the task in order for it to be considered completed. - 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 `Task`. Returns the updated task object - ## Remove task Removes a task from a file. @@ -155,6 +150,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-tasks-id/). + ```python client.tasks.delete_task_by_id(task_id=task.id) ``` @@ -166,11 +162,8 @@ client.tasks.delete_task_by_id(task_id=task.id) - 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`. Returns an empty response when the task was successfully deleted. - - diff --git a/docs/terms_of_service_user_statuses.md b/docs/terms_of_service_user_statuses.md index 1cee968c..f4cb6d91 100644 --- a/docs/terms_of_service_user_statuses.md +++ b/docs/terms_of_service_user_statuses.md @@ -1,6 +1,5 @@ # TermsOfServiceUserStatusesManager - - [List terms of service user statuses](#list-terms-of-service-user-statuses) - [Create terms of service status for new user](#create-terms-of-service-status-for-new-user) - [Update terms of service status for existing user](#update-terms-of-service-status-for-existing-user) @@ -16,7 +15,7 @@ This operation is performed by calling function `get_term_of_service_user_status See the endpoint docs at [API Reference](https://developer.box.com/reference/get-terms-of-service-user-statuses/). -*Currently we don't have an example for calling `get_term_of_service_user_statuses` in integration tests* +_Currently we don't have an example for calling `get_term_of_service_user_statuses` in integration tests_ ### Arguments @@ -27,14 +26,12 @@ See the endpoint docs at - 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 `TermsOfServiceUserStatuses`. Returns a list of terms of service statuses. - ## Create terms of service status for new user Sets the status for a terms of service for a user. @@ -44,7 +41,7 @@ This operation is performed by calling function `create_term_of_service_user_sta See the endpoint docs at [API Reference](https://developer.box.com/reference/post-terms-of-service-user-statuses/). -*Currently we don't have an example for calling `create_term_of_service_user_status` in integration tests* +_Currently we don't have an example for calling `create_term_of_service_user_status` in integration tests_ ### Arguments @@ -57,14 +54,12 @@ See the endpoint docs at - 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 `TermsOfServiceUserStatus`. Returns a terms of service status object. - ## Update terms of service status for existing user Updates the status for a terms of service for a user. @@ -74,7 +69,7 @@ This operation is performed by calling function `update_term_of_service_user_sta See the endpoint docs at [API Reference](https://developer.box.com/reference/put-terms-of-service-user-statuses-id/). -*Currently we don't have an example for calling `update_term_of_service_user_status_by_id` in integration tests* +_Currently we don't have an example for calling `update_term_of_service_user_status_by_id` in integration tests_ ### Arguments @@ -85,11 +80,8 @@ See the endpoint docs at - 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 `TermsOfServiceUserStatus`. Returns the updated terms of service status object. - - diff --git a/docs/terms_of_services.md b/docs/terms_of_services.md index ca799cbc..56d3524c 100644 --- a/docs/terms_of_services.md +++ b/docs/terms_of_services.md @@ -1,6 +1,5 @@ # TermsOfServicesManager - - [List terms of services](#list-terms-of-services) - [Create terms of service](#create-terms-of-service) - [Get terms of service](#get-terms-of-service) @@ -16,7 +15,7 @@ This operation is performed by calling function `get_term_of_services`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-terms-of-services/). -*Currently we don't have an example for calling `get_term_of_services` in integration tests* +_Currently we don't have an example for calling `get_term_of_services` in integration tests_ ### Arguments @@ -25,7 +24,6 @@ See the endpoint docs at - 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 `TermsOfServices`. @@ -33,7 +31,6 @@ This function returns a value of type `TermsOfServices`. Returns a collection of terms of service text and settings for the enterprise. - ## Create terms of service Creates a terms of service for a given enterprise @@ -44,7 +41,7 @@ This operation is performed by calling function `create_term_of_service`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-terms-of-services/). -*Currently we don't have an example for calling `create_term_of_service` in integration tests* +_Currently we don't have an example for calling `create_term_of_service` in integration tests_ ### Arguments @@ -53,18 +50,16 @@ See the endpoint docs at - tos_type `Optional[CreateTermOfServiceTosTypeArg]` - The type of user to set the terms of service for. - text `str` - - The terms of service text to display to users. The text can be set to empty if the `status` is set to `disabled`. + - The terms of service text to display to users. The text can be set to empty if the `status` is set to `disabled`. - 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 `Task`. Returns a new task object - ## Get terms of service Fetches a specific terms of service. @@ -74,7 +69,7 @@ This operation is performed by calling function `get_term_of_service_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-terms-of-services-id/). -*Currently we don't have an example for calling `get_term_of_service_by_id` in integration tests* +_Currently we don't have an example for calling `get_term_of_service_by_id` in integration tests_ ### Arguments @@ -83,14 +78,12 @@ See the endpoint docs at - 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 `TermsOfService`. Returns a terms of service object. - ## Update terms of service Updates a specific terms of service. @@ -100,7 +93,7 @@ This operation is performed by calling function `update_term_of_service_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-terms-of-services-id/). -*Currently we don't have an example for calling `update_term_of_service_by_id` in integration tests* +_Currently we don't have an example for calling `update_term_of_service_by_id` in integration tests_ ### Arguments @@ -109,15 +102,12 @@ See the endpoint docs at - status `UpdateTermOfServiceByIdStatusArg` - Whether this terms of service is active. - text `str` - - The terms of service text to display to users. The text can be set to empty if the `status` is set to `disabled`. + - The terms of service text to display to users. The text can be set to empty if the `status` is set to `disabled`. - 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 `TermsOfService`. Returns an updated terms of service object. - - diff --git a/docs/transfer.md b/docs/transfer.md index 505cde86..21d13bc1 100644 --- a/docs/transfer.md +++ b/docs/transfer.md @@ -1,6 +1,5 @@ # TransferManager - - [Transfer owned folders](#transfer-owned-folders) ## Transfer owned folders @@ -44,7 +43,7 @@ This operation is performed by calling function `transfer_owned_folder`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-users-id-folders-0/). -*Currently we don't have an example for calling `transfer_owned_folder` in integration tests* +_Currently we don't have an example for calling `transfer_owned_folder` in integration tests_ ### Arguments @@ -53,18 +52,15 @@ See the endpoint docs at - owned_by `TransferOwnedFolderOwnedByArg` - The user who the folder will be transferred to - fields `Optional[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. + - 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. - notify `Optional[bool]` - Determines if users should receive email notification for the action performed. - 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 `FolderFull`. Returns the information for the newly created destination folder. - - diff --git a/docs/trashed_files.md b/docs/trashed_files.md index 2da0e834..14ec8ea4 100644 --- a/docs/trashed_files.md +++ b/docs/trashed_files.md @@ -1,6 +1,5 @@ # TrashedFilesManager - - [Restore file](#restore-file) - [Get trashed file](#get-trashed-file) - [Permanently remove file](#permanently-remove-file) @@ -18,6 +17,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-id/). + ```python client.trashed_files.restore_file_from_trash(file_id=file.id) ``` @@ -25,24 +25,22 @@ client.trashed_files.restore_file_from_trash(file_id=file.id) ### Arguments - 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" + - 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 new name for the file. - parent `Optional[RestoreFileFromTrashParentArg]` - - + - - fields `Optional[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. + - 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. - 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 `TrashFileRestored`. Returns a file object when the file has been restored. - ## Get trashed file Retrieves a file that has been moved to the trash. @@ -63,6 +61,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-trash/). + ```python client.trashed_files.get_file_trash(file_id=file.id) ``` @@ -70,13 +69,12 @@ client.trashed_files.get_file_trash(file_id=file.id) ### Arguments - 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" + - 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" - fields `Optional[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. + - 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. - 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 `TrashFile`. @@ -85,7 +83,6 @@ Returns the file that was trashed, including information about when the it was moved to the trash. - ## Permanently remove file Permanently deletes a file that is in the trash. @@ -97,6 +94,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-id-trash/). + ```python client.trashed_files.delete_file_trash(file_id=file.id) ``` @@ -104,16 +102,13 @@ client.trashed_files.delete_file_trash(file_id=file.id) ### Arguments - 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" + - 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" - 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`. Returns an empty response when the file was permanently deleted. - - diff --git a/docs/trashed_folders.md b/docs/trashed_folders.md index 2c1383bf..d331f6e3 100644 --- a/docs/trashed_folders.md +++ b/docs/trashed_folders.md @@ -1,6 +1,5 @@ # TrashedFoldersManager - - [Restore folder](#restore-folder) - [Get trashed folder](#get-trashed-folder) - [Permanently remove folder](#permanently-remove-folder) @@ -27,6 +26,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-folders-id/). + ```python client.trashed_folders.restore_folder_from_trash(folder_id=folder.id) ``` @@ -34,24 +34,22 @@ client.trashed_folders.restore_folder_from_trash(folder_id=folder.id) ### Arguments - 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" + - 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]` - An optional new name for the folder. - parent `Optional[RestoreFolderFromTrashParentArg]` - - + - - fields `Optional[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. + - 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. - 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 `TrashFolderRestored`. Returns a folder object when the folder has been restored. - ## Get trashed folder Retrieves a folder that has been moved to the trash. @@ -72,6 +70,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-trash/). + ```python client.trashed_folders.get_folder_trash(folder_id=folder.id) ``` @@ -79,13 +78,12 @@ client.trashed_folders.get_folder_trash(folder_id=folder.id) ### Arguments - 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" + - 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" - fields `Optional[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. + - 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. - 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 `TrashFolder`. @@ -94,7 +92,6 @@ Returns the folder that was trashed, including information about when the it was moved to the trash. - ## Permanently remove folder Permanently deletes a folder that is in the trash. @@ -106,6 +103,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-folders-id-trash/). + ```python client.trashed_folders.delete_folder_trash(folder_id=folder.id) ``` @@ -113,16 +111,13 @@ client.trashed_folders.delete_folder_trash(folder_id=folder.id) ### Arguments - 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" + - 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" - 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`. Returns an empty response when the folder was permanently deleted. - - diff --git a/docs/trashed_items.md b/docs/trashed_items.md index 3eec1758..bcd5d6c9 100644 --- a/docs/trashed_items.md +++ b/docs/trashed_items.md @@ -1,6 +1,5 @@ # TrashedItemsManager - - [List trashed items](#list-trashed-items) ## List trashed items @@ -20,32 +19,29 @@ This operation is performed by calling function `get_folder_trash_items`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-trash-items/). -*Currently we don't have an example for calling `get_folder_trash_items` in integration tests* +_Currently we don't have an example for calling `get_folder_trash_items` in integration tests_ ### Arguments - fields `Optional[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. + - 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. - limit `Optional[int]` - The maximum number of items to return per page. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - usemarker `Optional[bool]` - - Specifies whether to use marker-based pagination instead of offset-based pagination. Only one pagination method can be used at a time. By setting this value to true, the API will return a `marker` field that can be passed as a parameter to this endpoint to get the next page of the response. + - Specifies whether to use marker-based pagination instead of offset-based pagination. Only one pagination method can be used at a time. By setting this value to true, the API will return a `marker` field that can be passed as a parameter to this endpoint to get the next page of the response. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - direction `Optional[GetFolderTrashItemsDirectionArg]` - The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order. - sort `Optional[GetFolderTrashItemsSortArg]` - - Defines the **second** attribute by which items are sorted. Items are always sorted by their `type` first, with folders listed before files, and files listed before web links. This parameter is not supported when using marker-based pagination. + - Defines the **second** attribute by which items are sorted. Items are always sorted by their `type` first, with folders listed before files, and files listed before web links. This parameter is not supported when using marker-based pagination. - 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 `Items`. Returns a list of items that have been deleted - - diff --git a/docs/trashed_web_links.md b/docs/trashed_web_links.md index 48a67d49..1f47763a 100644 --- a/docs/trashed_web_links.md +++ b/docs/trashed_web_links.md @@ -1,6 +1,5 @@ # TrashedWebLinksManager - - [Restore web link](#restore-web-link) - [Get trashed web link](#get-trashed-web-link) - [Permanently remove web link](#permanently-remove-web-link) @@ -9,7 +8,7 @@ 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 +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`. @@ -17,7 +16,7 @@ This operation is performed by calling function `create_web_link_by_id`. 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* +_Currently we don't have an example for calling `create_web_link_by_id` in integration tests_ ### Arguments @@ -26,20 +25,18 @@ See the endpoint docs at - name `Optional[str]` - An optional new name for the web link. - parent `Optional[CreateWebLinkByIdParentArg]` - - + - - fields `Optional[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. + - 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. - 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 `TrashWebLinkRestored`. Returns a web link object when it has been restored. - ## Get trashed web link Retrieves a web link that has been moved to the trash. @@ -49,18 +46,17 @@ 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* +_Currently we don't have an example for calling `get_web_link_trash` in integration tests_ ### Arguments - web_link_id `str` - The ID of the web link. Example: "12345" - fields `Optional[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. + - 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. - 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 `TrashWebLink`. @@ -69,7 +65,6 @@ Returns the web link that was trashed, including information about when the it was moved to the trash. - ## Permanently remove web link Permanently deletes a web link that is in the trash. @@ -80,7 +75,7 @@ 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* +_Currently we don't have an example for calling `delete_web_link_trash` in integration tests_ ### Arguments @@ -89,12 +84,9 @@ See the endpoint docs at - 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`. Returns an empty response when the web link was permanently deleted. - - diff --git a/docs/user_collaborations.md b/docs/user_collaborations.md index e3b57724..765512a1 100644 --- a/docs/user_collaborations.md +++ b/docs/user_collaborations.md @@ -1,6 +1,5 @@ # UserCollaborationsManager - - [Get collaboration](#get-collaboration) - [Update collaboration](#update-collaboration) - [Remove collaboration](#remove-collaboration) @@ -15,25 +14,23 @@ This operation is performed by calling function `get_collaboration_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-collaborations-id/). -*Currently we don't have an example for calling `get_collaboration_by_id` in integration tests* +_Currently we don't have an example for calling `get_collaboration_by_id` in integration tests_ ### Arguments - collaboration_id `str` - The ID of the collaboration Example: "1234" - fields `Optional[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. + - 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. - 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 `Collaboration`. Returns a collaboration object. - ## Update collaboration Updates a collaboration. @@ -45,7 +42,7 @@ This operation is performed by calling function `update_collaboration_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-collaborations-id/). -*Currently we don't have an example for calling `update_collaboration_by_id` in integration tests* +_Currently we don't have an example for calling `update_collaboration_by_id` in integration tests_ ### Arguments @@ -56,13 +53,12 @@ See the endpoint docs at - status `Optional[UpdateCollaborationByIdStatusArg]` - Set the status of a `pending` collaboration invitation, effectively accepting, or rejecting the invite. - expires_at `Optional[str]` - - Update the expiration date for the collaboration. At this date, the collaboration will be automatically removed from the item. This feature will only work if the **Automatically remove invited collaborators: Allow folder owners to extend the expiry date** setting has been enabled in the **Enterprise Settings** of the **Admin Console**. When the setting is not enabled, collaborations can not have an expiry date and a value for this field will be result in an error. Additionally, a collaboration can only be given an expiration if it was created after the **Automatically remove invited collaborator** setting was enabled. + - Update the expiration date for the collaboration. At this date, the collaboration will be automatically removed from the item. This feature will only work if the **Automatically remove invited collaborators: Allow folder owners to extend the expiry date** setting has been enabled in the **Enterprise Settings** of the **Admin Console**. When the setting is not enabled, collaborations can not have an expiry date and a value for this field will be result in an error. Additionally, a collaboration can only be given an expiration if it was created after the **Automatically remove invited collaborator** setting was enabled. - can_view_path `Optional[bool]` - - Determines if the invited users can see the entire parent path to the associated folder. The user will not gain privileges in any parent folder and therefore can not see content the user is not collaborated on. Be aware that this meaningfully increases the time required to load the invitee's **All Files** page. We recommend you limit the number of collaborations with `can_view_path` enabled to 1,000 per user. Only owner or co-owners can invite collaborators with a `can_view_path` of `true`. `can_view_path` can only be used for folder collaborations. + - Determines if the invited users can see the entire parent path to the associated folder. The user will not gain privileges in any parent folder and therefore can not see content the user is not collaborated on. Be aware that this meaningfully increases the time required to load the invitee's **All Files** page. We recommend you limit the number of collaborations with `can_view_path` enabled to 1,000 per user. Only owner or co-owners can invite collaborators with a `can_view_path` of `true`. `can_view_path` can only be used for folder collaborations. - 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 `Collaboration`. @@ -71,7 +67,6 @@ Returns an updated collaboration object unless the owner has changed.If the role and a new collaboration is created. The previous `owner` of the old collaboration will be a `co-owner` on the new collaboration. - ## Remove collaboration Deletes a single collaboration. @@ -81,7 +76,7 @@ This operation is performed by calling function `delete_collaboration_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-collaborations-id/). -*Currently we don't have an example for calling `delete_collaboration_by_id` in integration tests* +_Currently we don't have an example for calling `delete_collaboration_by_id` in integration tests_ ### Arguments @@ -90,7 +85,6 @@ See the endpoint docs at - 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`. @@ -98,7 +92,6 @@ This function returns a value of type `None`. A blank response is returned if the collaboration was successfully deleted. - ## Create collaboration Adds a collaboration for a single user or a single group to a file @@ -112,16 +105,17 @@ this endpoint is dependent on the group's ability to be invited. If collaboration is in `pending` status, the following fields are redacted: + - `login` and `name` are hidden if a collaboration was created -using `user_id`, -- `name` is hidden if a collaboration was created using `login`. + using `user_id`, +- `name` is hidden if a collaboration was created using `login`. This operation is performed by calling function `create_collaboration`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-collaborations/). -*Currently we don't have an example for calling `create_collaboration` in integration tests* +_Currently we don't have an example for calling `create_collaboration` in integration tests_ ### Arguments @@ -132,21 +126,18 @@ See the endpoint docs at - role `CreateCollaborationRoleArg` - The level of access granted. - can_view_path `Optional[bool]` - - Determines if the invited users can see the entire parent path to the associated folder. The user will not gain privileges in any parent folder and therefore can not see content the user is not collaborated on. Be aware that this meaningfully increases the time required to load the invitee's **All Files** page. We recommend you limit the number of collaborations with `can_view_path` enabled to 1,000 per user. Only owner or co-owners can invite collaborators with a `can_view_path` of `true`. `can_view_path` can only be used for folder collaborations. + - Determines if the invited users can see the entire parent path to the associated folder. The user will not gain privileges in any parent folder and therefore can not see content the user is not collaborated on. Be aware that this meaningfully increases the time required to load the invitee's **All Files** page. We recommend you limit the number of collaborations with `can_view_path` enabled to 1,000 per user. Only owner or co-owners can invite collaborators with a `can_view_path` of `true`. `can_view_path` can only be used for folder collaborations. - expires_at `Optional[str]` - - Set the expiration date for the collaboration. At this date, the collaboration will be automatically removed from the item. This feature will only work if the **Automatically remove invited collaborators: Allow folder owners to extend the expiry date** setting has been enabled in the **Enterprise Settings** of the **Admin Console**. When the setting is not enabled, collaborations can not have an expiry date and a value for this field will be result in an error. + - Set the expiration date for the collaboration. At this date, the collaboration will be automatically removed from the item. This feature will only work if the **Automatically remove invited collaborators: Allow folder owners to extend the expiry date** setting has been enabled in the **Enterprise Settings** of the **Admin Console**. When the setting is not enabled, collaborations can not have an expiry date and a value for this field will be result in an error. - fields `Optional[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. + - 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. - notify `Optional[bool]` - Determines if users should receive email notification for the action performed. - 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 `Collaboration`. Returns a new collaboration object. - - diff --git a/docs/users.md b/docs/users.md index c302b1b3..9e3da93a 100644 --- a/docs/users.md +++ b/docs/users.md @@ -1,6 +1,5 @@ # UsersManager - - [List enterprise users](#list-enterprise-users) - [Create user](#create-user) - [Get current user](#get-current-user) @@ -23,6 +22,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-users/). + ```python client.users.get_users() ``` @@ -30,32 +30,30 @@ client.users.get_users() ### Arguments - filter_term `Optional[str]` - - Limits the results to only users who's `name` or `login` start with the search term. For externally managed users, the search term needs to completely match the in order to find the user, and it will only return one user at a time. + - Limits the results to only users who's `name` or `login` start with the search term. For externally managed users, the search term needs to completely match the in order to find the user, and it will only return one user at a time. - user_type `Optional[GetUsersUserTypeArg]` - - Limits the results to the kind of user specified. * `all` returns every kind of user for whom the `login` or `name` partially matches the `filter_term`. It will only return an external user if the login matches the `filter_term` completely, and in that case it will only return that user. * `managed` returns all managed and app users for whom the `login` or `name` partially matches the `filter_term`. * `external` returns all external users for whom the `login` matches the `filter_term` exactly. + - Limits the results to the kind of user specified. _ `all` returns every kind of user for whom the `login` or `name` partially matches the `filter_term`. It will only return an external user if the login matches the `filter_term` completely, and in that case it will only return that user. _ `managed` returns all managed and app users for whom the `login` or `name` partially matches the `filter_term`. \* `external` returns all external users for whom the `login` matches the `filter_term` exactly. - external_app_user_id `Optional[str]` - - Limits the results to app users with the given `external_app_user_id` value. When creating an app user, an `external_app_user_id` value can be set. This value can then be used in this endpoint to find any users that match that `external_app_user_id` value. + - Limits the results to app users with the given `external_app_user_id` value. When creating an app user, an `external_app_user_id` value can be set. This value can then be used in this endpoint to find any users that match that `external_app_user_id` value. - fields `Optional[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. + - 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. - offset `Optional[int]` - - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. + - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response. - limit `Optional[int]` - The maximum number of items to return per page. - usemarker `Optional[bool]` - - Specifies whether to use marker-based pagination instead of offset-based pagination. Only one pagination method can be used at a time. By setting this value to true, the API will return a `marker` field that can be passed as a parameter to this endpoint to get the next page of the response. + - Specifies whether to use marker-based pagination instead of offset-based pagination. Only one pagination method can be used at a time. By setting this value to true, the API will return a `marker` field that can be passed as a parameter to this endpoint to get the next page of the response. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - 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 `Users`. Returns all of the users in the enterprise. - ## Create user Creates a new managed user in an enterprise. This endpoint @@ -68,6 +66,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-users/). + ```python client.users.create_user(name=user_name, login=user_login, is_platform_access_only=True) ``` @@ -77,7 +76,7 @@ client.users.create_user(name=user_name, login=user_login, is_platform_access_on - name `str` - The name of the user - login `Optional[str]` - - The email address the user uses to log in Required, unless `is_platform_access_only` is set to `true`. + - The email address the user uses to log in Required, unless `is_platform_access_only` is set to `true`. - is_platform_access_only `Optional[bool]` - Specifies that the user is an app user. - role `Optional[CreateUserRoleArg]` @@ -111,18 +110,16 @@ client.users.create_user(name=user_name, login=user_login, is_platform_access_on - external_app_user_id `Optional[str]` - An external identifier for an app user, which can be used to look up the user. This can be used to tie user IDs from external identity providers to Box users. - fields `Optional[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. + - 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. - 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 `User`. Returns a user object for the newly created user. - ## Get current user Retrieves information about the user who is currently authenticated. @@ -142,6 +139,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-users-me/). + ```python client.users.get_user_me() ``` @@ -149,18 +147,16 @@ client.users.get_user_me() ### Arguments - fields `Optional[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. + - 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. - 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 `UserFull`. Returns a single user object. - ## Get user Retrieves information about a user in the enterprise. @@ -181,6 +177,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-users-id/). + ```python client.users.get_user_by_id(user_id=user.id) ``` @@ -190,11 +187,10 @@ client.users.get_user_by_id(user_id=user.id) - user_id `str` - The ID of the user. Example: "12345" - fields `Optional[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. + - 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. - 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 `UserFull`. @@ -206,7 +202,6 @@ Not all available fields are returned by default. Use the any specific fields using the [fields](#get-users-id--request--fields) parameter. - ## Update user Updates a managed or app user in an enterprise. This endpoint @@ -219,6 +214,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/put-users-id/). + ```python client.users.update_user_by_id(user_id=user.id, name=updated_user_name) ``` @@ -234,7 +230,7 @@ client.users.update_user_by_id(user_id=user.id, name=updated_user_name) - name `Optional[str]` - The name of the user - login `Optional[str]` - - The email address the user uses to log in Note: If the target user's email is not confirmed, then the primary login address cannot be changed. + - The email address the user uses to log in Note: If the target user's email is not confirmed, then the primary login address cannot be changed. - role `Optional[UpdateUserByIdRoleArg]` - The user’s enterprise role - language `Optional[str]` @@ -266,22 +262,20 @@ client.users.update_user_by_id(user_id=user.id, name=updated_user_name) - space_amount `Optional[int]` - The user’s total available space in bytes. Set this to `-1` to indicate unlimited storage. - notification_email `Optional[UpdateUserByIdNotificationEmailArg]` - - An alternate notification email address to which email notifications are sent. When it's confirmed, this will be the email address to which notifications are sent instead of to the primary email address. Set this value to `null` to remove the notification email. + - An alternate notification email address to which email notifications are sent. When it's confirmed, this will be the email address to which notifications are sent instead of to the primary email address. Set this value to `null` to remove the notification email. - external_app_user_id `Optional[str]` - - An external identifier for an app user, which can be used to look up the user. This can be used to tie user IDs from external identity providers to Box users. Note: In order to update this field, you need to request a token using the application that created the app user. + - An external identifier for an app user, which can be used to look up the user. This can be used to tie user IDs from external identity providers to Box users. Note: In order to update this field, you need to request a token using the application that created the app user. - fields `Optional[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. + - 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. - 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 `UserFull`. Returns the updated user object. - ## Delete user Deletes a user. By default this will fail if the user @@ -295,6 +289,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-users-id/). + ```python client.users.delete_user_by_id(user_id=user.id) ``` @@ -310,11 +305,8 @@ client.users.delete_user_by_id(user_id=user.id) - 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`. Removes the user and returns an empty response. - - diff --git a/docs/web_links.md b/docs/web_links.md index e8fb0bf3..fcbdef88 100644 --- a/docs/web_links.md +++ b/docs/web_links.md @@ -1,6 +1,5 @@ # WebLinksManager - - [Create web link](#create-web-link) - [Get web link](#get-web-link) - [Update web link](#update-web-link) @@ -16,6 +15,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-web-links/). + ```python client.web_links.create_web_link(url=url, parent=parent, name=name, description=description) ``` @@ -33,14 +33,12 @@ client.web_links.create_web_link(url=url, parent=parent, name=name, description= - 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 `WebLink`. Returns the newly created web link object. - ## Get web link Retrieve information about a web link. @@ -51,6 +49,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-web-links-id/). + ```python client.web_links.get_web_link_by_id(web_link_id=weblink.id) ``` @@ -60,18 +59,16 @@ client.web_links.get_web_link_by_id(web_link_id=weblink.id) - web_link_id `str` - The ID of the web link. Example: "12345" - boxapi `Optional[str]` - - The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format `shared_link=[link]` or if a password is required then use `shared_link=[link]&shared_link_password=[password]`. This header can be used on the file or folder shared, as well as on any files or folders nested within the item. + - The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format `shared_link=[link]` or if a password is required then use `shared_link=[link]&shared_link_password=[password]`. This header can be used on the file or folder shared, as well as on any files or folders nested within the item. - 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 `WebLink`. Returns the web link object. - ## Update web link Updates a web link object. @@ -82,6 +79,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/put-web-links-id/). + ```python client.web_links.update_web_link_by_id(web_link_id=weblink.id, name=updated_name, shared_link=UpdateWebLinkByIdSharedLinkArg(access=shared_access, password=password)) ``` @@ -93,7 +91,7 @@ client.web_links.update_web_link_by_id(web_link_id=weblink.id, name=updated_name - url `Optional[str]` - The new URL that the web link links to. Must start with `"http://"` or `"https://"`. - parent `Optional[UpdateWebLinkByIdParentArg]` - - + - - name `Optional[str]` - A new name for the web link. Defaults to the URL if not set. - description `Optional[str]` @@ -103,14 +101,12 @@ client.web_links.update_web_link_by_id(web_link_id=weblink.id, name=updated_name - 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 `WebLink`. Returns the updated web link object. - ## Remove web link Deletes a web link. @@ -121,6 +117,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-web-links-id/). + ```python client.web_links.delete_web_link_by_id(web_link_id=weblink.id) ``` @@ -132,12 +129,9 @@ client.web_links.delete_web_link_by_id(web_link_id=weblink.id) - 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`. An empty response will be returned when the web link was successfully deleted. - - diff --git a/docs/webhooks.md b/docs/webhooks.md index 4728d3c1..c89338ec 100644 --- a/docs/webhooks.md +++ b/docs/webhooks.md @@ -1,6 +1,5 @@ # WebhooksManager - - [List all webhooks](#list-all-webhooks) - [Create webhook](#create-webhook) - [Get webhook](#get-webhook) @@ -22,6 +21,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-webhooks/). + ```python client.webhooks.get_webhooks() ``` @@ -29,20 +29,18 @@ client.webhooks.get_webhooks() ### Arguments - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - limit `Optional[int]` - The maximum number of items to return per page. - 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 `Webhooks`. Returns a list of webhooks. - ## Create webhook Creates a webhook. @@ -53,6 +51,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/post-webhooks/). + ```python client.webhooks.create_webhook(target=CreateWebhookTargetArg(id=folder.id, type=CreateWebhookTargetArgTypeField.FOLDER.value), address='https://example.com/new-webhook', triggers=[CreateWebhookTriggersArg.FILE_UPLOADED.value]) ``` @@ -68,14 +67,12 @@ client.webhooks.create_webhook(target=CreateWebhookTargetArg(id=folder.id, type= - 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 `Webhook`. Returns the new webhook object. - ## Get webhook Retrieves a specific webhook @@ -86,6 +83,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/get-webhooks-id/). + ```python client.webhooks.get_webhook_by_id(webhook_id=webhook.id) ``` @@ -97,14 +95,12 @@ client.webhooks.get_webhook_by_id(webhook_id=webhook.id) - 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 `Webhook`. Returns a webhook object - ## Update webhook Updates a webhook. @@ -115,6 +111,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/put-webhooks-id/). + ```python client.webhooks.update_webhook_by_id(webhook_id=webhook.id, address='https://example.com/updated-webhook') ``` @@ -132,14 +129,12 @@ client.webhooks.update_webhook_by_id(webhook_id=webhook.id, address='https://exa - 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 `Webhook`. Returns the new webhook object. - ## Remove webhook Deletes a webhook. @@ -150,6 +145,7 @@ See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-webhooks-id/). + ```python client.webhooks.delete_webhook_by_id(webhook_id=webhook.id) ``` @@ -161,12 +157,9 @@ client.webhooks.delete_webhook_by_id(webhook_id=webhook.id) - 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`. An empty response will be returned when the webhook was successfully deleted. - - diff --git a/docs/workflows.md b/docs/workflows.md index a84f3f75..ffc7ab32 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -1,6 +1,5 @@ # WorkflowsManager - - [List workflows](#list-workflows) - [Starts workflow based on request body](#starts-workflow-based-on-request-body) @@ -17,29 +16,27 @@ This operation is performed by calling function `get_workflows`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-workflows/). -*Currently we don't have an example for calling `get_workflows` in integration tests* +_Currently we don't have an example for calling `get_workflows` in integration tests_ ### Arguments - 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`. + - 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`. - trigger_type `Optional[str]` - Type of trigger to search for. - limit `Optional[int]` - The maximum number of items to return per page. - marker `Optional[str]` - - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. + - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. - 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 `Workflows`. Returns the workflow. - ## Starts workflow based on request body Initiates a flow with a trigger type of `WORKFLOW_MANUAL_START`. @@ -52,7 +49,7 @@ This operation is performed by calling function `create_workflow_start`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-workflows-id-start/). -*Currently we don't have an example for calling `create_workflow_start` in integration tests* +_Currently we don't have an example for calling `create_workflow_start` in integration tests_ ### Arguments @@ -71,11 +68,8 @@ See the endpoint docs at - 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`. Starts the workflow. - - diff --git a/docs/zip_downloads.md b/docs/zip_downloads.md index 9f96afee..4bfc2a02 100644 --- a/docs/zip_downloads.md +++ b/docs/zip_downloads.md @@ -1,6 +1,5 @@ # ZipDownloadsManager - - [Create zip download](#create-zip-download) - [Download zip archive](#download-zip-archive) - [Get zip download status](#get-zip-download-status) @@ -29,7 +28,7 @@ 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* +_Currently we don't have an example for calling `create_zip_download` in integration tests_ ### Arguments @@ -40,7 +39,6 @@ See the endpoint docs at - 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 `ZipDownload`. @@ -49,7 +47,6 @@ If the `zip` archive is ready to be downloaded, the API will return a response that will include a `download_url`, a `status_url`, as well as any conflicts that might have occurred when creating the request. - ## Download zip archive Returns the contents of a `zip` archive in binary format. This URL does not @@ -71,7 +68,7 @@ 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* +_Currently we don't have an example for calling `get_zip_download_content` in integration tests_ ### Arguments @@ -80,7 +77,6 @@ See the endpoint docs at - 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`. @@ -88,7 +84,6 @@ This function returns a value of type `ByteStream`. Returns the content of the items requested for this download, formatted as a stream of files and folders in a `zip` archive. - ## Get zip download status Returns the download status of a `zip` archive, allowing an application to @@ -109,7 +104,7 @@ 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* +_Currently we don't have an example for calling `get_zip_download_status` in integration tests_ ### Arguments @@ -118,11 +113,8 @@ See the endpoint docs at - 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 `ZipDownloadStatus`. Returns the status of the `zip` archive that is being downloaded. - - diff --git a/migration-guide.md b/migration-guide.md new file mode 100644 index 00000000..0e75ac5a --- /dev/null +++ b/migration-guide.md @@ -0,0 +1,412 @@ +# Migration guide from `boxsdk` to `box-sdk-gen` + + + + +- [Introduction](#introduction) +- [Installation](#installation) +- [Key differences](#key-differences) + - [Manager approach](#manager-approach) + - [Explicitly defined schemas](#explicitly-defined-schemas) +- [Authentication](#authentication) + - [Developer Token](#developer-token) + - [JWT Auth](#jwt-auth) + - [Using JWT configuration file](#using-jwt-configuration-file) + - [Providing JWT configuration manually](#providing-jwt-configuration-manually) + - [Authenticate user](#authenticate-user) + - [Client Credentials Grant](#client-credentials-grant) + - [Obtaining Service Account token](#obtaining-service-account-token) + - [Obtaining User token](#obtaining-user-token) + - [Switching between Service Account and User](#switching-between-service-account-and-user) + - [OAuth 2.0 Auth](#oauth-20-auth) + - [Get Authorization URL](#get-authorization-url) + - [Authenticate](#authenticate) + + + +## Introduction + +The new `box-sdk-gen` SDK library, which helps Python developers to conveniently integrate with Box API. +In the contrary to the previous library (`boxsdk`), it is not manually maintained, but auto-generated +based on Open API Specification. This means you can leverage the most up-to-date Box API features in your +applications without delay. More information and benefits of using the new can be found in the +[README](https://github.com/box/box-python-sdk-gen/blob/main/README.md) file. + +## Installation + +To install a new Box Python SDK GENERATED use command: + +```console +pip install box-sdk-gen +``` + +The new Box Python SDK GENERATED library could be used in the same project along with the legacy one. +If you want to use a feature available only in the new SDK, you don't need to necessarily migrate all your code +to use Box Python SDK GENERATED at once. You can use a new feature from the new library, +while keeping the rest of your code unchanged. Note that it may be required to alias some imported names +from the new SDK to avoid conflicts with the old one. However, we recommend to fully migrate to the new SDK eventually. + +## Key differences + +### Manager approach + +The main difference between the old SDK and the new one is the way how API methods are aggregated into objects. + +**Old (`boxsdk`)** + +Firstly, in the old SDK to be able to perform any action on an API object, e.g. `User`, you first had to create its class. +To do it is required to call: + +```python +user = client.user(user_id='123456') +``` + +to create a class representing an already existing User with id '12345', or create a new one with a call: + +```python +user = client.create_user(name='Some User') +``` + +Then, you could perform any action on created class, which will affect the user, e.g. + +```python +updated_user = user.update_info(data={'name': 'New User Name'}) +``` + +**New (`box-sdk-gen`)** + +In the new SDK the API methods are grouped into dedicated manager classes, e.g. `User` object +has dedicated `UserManager` class. Each manager class instance is available in `Client` object. +So if you want to perform any operation connected with a `User` you need to call a respective method of `UserManager`. +E.g. to get info about existing user you need to call: + +```python +user = client.users.get_user_by_id(user_id='123456') +``` + +or to create a new user: + +```python +user = client.users.create_user(name='Some User') +``` + +The `User` object returned by both of these methods is a data class - it does not contain any methods to call. +To perform any action on `User` object, you need to still use a `UserManager` method for that. +Usually these methods have a first argument, which accepts an id of the object you want to access, +e.g. to update a user name, call method: + +```python +updated_user = client.users.update_user_by_id(user_id=user.id, name='New User Name') +``` + +### Explicitly defined schemas + +**Old (`boxsdk`)** + +In the old SDK there were no data types explicitly defined - +the responses were dynamically mapped into classes in the runtime. For example, if you get information about a file: + +```python +file = client.file(file_id='12345678').get() +``` + +you couldn't be sure which fields to expect in the response object until the runtime, +because `File` class doesn't have any predefined fields. + +**New (`box-sdk-gen`)** + +In the new SDK the data classe are defined in `schemas` module, so you know, which fields to expect before +actually making a call. For example `FileBase` class is defined this way: + +```python +class FileBase(BaseObject): + def __init__(self, id: str, type: FileBaseTypeField, etag: Optional[str] = None, **kwargs): + super().__init__(**kwargs) + self.id = id + self.type = type + self.etag = etag +``` + +## Authentication + +The Box Python SDK GENERATED library offers the same authentication methods as the legacy one. +Let's see the differences of their usage: + +### Developer Token + +The new SDK provides a convenient `DeveloperTokenAuth`, which allows authenticating +using developer token without necessity to provide a Client ID and Client Secret + +**Old (`boxsdk`)** + +```python +from boxsdk import Client, OAuth2 + +auth = OAuth2( + client_id='YOUR_CLIENT_ID', + client_secret='YOUR_CLIENT_SECRET', + access_token='DEVELOPER_TOKEN_GOES_HERE', +) +client = Client(auth) +``` + +**New (`box-sdk-gen`)** + +```python +from box_sdk_gen.client import Client +from box_sdk_gen.developer_token_auth import DeveloperTokenAuth + +auth = DeveloperTokenAuth(token='DEVELOPER_TOKEN_GOES_HERE') +client = Client(auth=auth) +``` + +### JWT Auth + +#### Using JWT configuration file + +**Old (`boxsdk`)** + +The static method, which reads the JWT configuration file has been changed: + +```python +from boxsdk import JWTAuth, Client + +auth = JWTAuth.from_settings_file('/path/to/config.json') +client = Client(auth) +``` + +**New (`box-sdk-gen`)** + +```python +from box_sdk_gen.client import Client +from box_sdk_gen.jwt_auth import JWTAuth, JWTConfig + +jwt_config = JWTConfig.from_config_file(config_file_path='/path/to/config.json') +auth = JWTAuth(config=jwt_config) +client = Client(auth=auth) +``` + +#### Providing JWT configuration manually + +Some params in `JWTConfig` constructor have slightly different names than one in old `JWTAuth` class. + +**Old (`boxsdk`)** + +```python +from boxsdk import JWTAuth + +auth = JWTAuth( + client_id='YOUR_CLIENT_ID', + client_secret='YOUR_CLIENT_SECRET', + enterprise_id='YOUR_ENTERPRISE_ID', + user_id='USER_ID', + jwt_key_id='YOUR_JWT_KEY_ID', + rsa_private_key_file_sys_path='CERT.PEM', + rsa_private_key_passphrase='PASSPHRASE', + jwt_algorithm='RS256', +) +``` + +**New (`box-sdk-gen`)** + +```python +from box_sdk_gen.jwt_auth import JWTAuth, JWTConfig + +jwt_config = JWTConfig( + client_id='YOUR_CLIENT_ID', + client_secret='YOUR_CLIENT_SECRET', + enterprise_id='YOUR_ENTERPRISE_ID', + user_id='USER_ID', + jwt_key_id='YOUR_JWT_KEY_ID', + private_key='YOUR_PRIVATE_KEY', + private_key_passphrase='PASSPHRASE', + jwt_algorithm='RS256', +) +auth = JWTAuth(config=jwt_config) +``` + +#### Authenticate user + +To authenticate as user you need to call `as_user(user_id: str)` method with id of the user to authenticate. +In old SDK this method was named `authenticate_user(self, user: Union[str, 'User'] = None) -> str` and +was accepting both user object and User ID or was using User ID provided in `JWTAuth` class if none provided in +this method call. The new method `as_user(user_id: str)` accepts only User ID, which is required. + +**Old (`boxsdk`)** + +```python +auth.authenticate_user(user) +``` + +or + +```python +auth.authenticate_user('USER_ID') +``` + +**New (`box-sdk-gen`)** + +```python +auth.as_user('USER_ID') +``` + +### Client Credentials Grant + +#### Obtaining Service Account token + +To authenticate as enterprise, the only difference between the old and the new SDK, +is using the `CCGConfig` as a middle step. + +**Old (`boxsdk`)** + +```python +from boxsdk import CCGAuth, Client + +auth = CCGAuth( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + enterprise_id="YOUR_ENTERPRISE_ID", +) + +client = Client(auth) +``` + +**New (`box-sdk-gen`)** + +```python +from box_sdk_gen.client import Client +from box_sdk_gen.ccg_auth import CCGAuth, CCGConfig + + +ccg_config = CCGConfig( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + enterprise_id="YOUR_ENTERPRISE_ID", +) +auth = CCGAuth(config=ccg_config) +client = Client(auth=auth) +``` + +#### Obtaining User token + +In old SDK `CCGAuth` was accepting both user object and User ID. The new constructor accepts only User ID instead. + +**Old (`boxsdk`)** + +```python +from boxsdk import CCGAuth + +auth = CCGAuth( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + user="YOUR_USER_ID" +) +``` + +**New (`box-sdk-gen`)** + +```python +from box_sdk_gen.ccg_auth import CCGAuth, CCGConfig + +ccg_config = CCGConfig( + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + user_id="YOUR_USER_ID" +) +auth = CCGAuth(config=ccg_config) +``` + +### Switching between Service Account and User + +The method responsible for switching to Service Account got changed: + +**Old (`boxsdk`)** + +```python +auth.authenticate_enterprise('ENTERPRISE_ID') +``` + +**New (`box-sdk-gen`)** + +```python +auth.as_enterprise(enterprise_id='YOUR_ENTERPRISE_ID') +``` + +And the one to switch to a User: + +**Old (`boxsdk`)** + +```python +auth.authenticate_user('USER_ID') +``` + +**New (`box-sdk-gen`)** + +```python +auth.as_user(user_id='USER_ID') +``` + +Note that the new method accepts only User ID, while the old one was accepting both User object and User ID. + +### OAuth 2.0 Auth + +#### Get Authorization URL + +To get authorization url in the new SDK, you need to first create the `OAuth` class (previously `OAuth2`) using +`OAuthConfig` class. Then to get authorization url, call +`get_authorize_url(self, options: Optional[GetAuthorizeUrlOptions] = None) -> str` instead of +`get_authorization_url(self, redirect_url: Optional[str]) -> Tuple[str, str]`. Note that this method +now accepts the instance of `GetAuthorizeUrlOptions` class, which allows specifying extra options to API call. +The new function returns only the authentication url string, +while the old one returns tuple of authentication url and csrf_token. + +**Old (`boxsdk`)** + +```python +from boxsdk import OAuth2 + +auth = OAuth2( + client_id='YOUR_CLIENT_ID', + client_secret='YOUR_CLIENT_SECRET', +) + +auth_url, csrf_token = auth.get_authorization_url('http://YOUR_REDIRECT_URL') +``` + +**New (`box-sdk-gen`)** + +```python +from box_sdk_gen.oauth import OAuth, OAuthConfig, GetAuthorizeUrlOptions + +auth = OAuth( + OAuthConfig( + client_id='YOUR_CLIENT_ID', + client_secret='YOUR_CLIENT_SECRET', + ) +) +auth_url = auth.get_authorize_url(options=GetAuthorizeUrlOptions(redirect_uri='http://YOUR_REDIRECT_URL')) +``` + +#### Authenticate + +The signature of method for authenticating with obtained auth code got changed from: +`authenticate(self, auth_code: Optional[str]) -> Tuple[str, str]` to +`def get_tokens_authorization_code_grant(self, authorization_code: str, network_session: Optional[NetworkSession] = None) -> str`. +The method now returns only access token, while the old one was returning a tuple of access token and refresh token. + +**Old (`boxsdk`)** + +```python +from boxsdk import Client +access_token, refresh_token = auth.authenticate('YOUR_AUTH_CODE') +client = Client(auth) +``` + +**New (`box-sdk-gen`)** + +```python +from box_sdk_gen.client import Client + +access_token = auth.get_tokens_authorization_code_grant('YOUR_AUTH_CODE') +client = Client(auth) +``` diff --git a/setup.py b/setup.py index f0509f13..142debae 100644 --- a/setup.py +++ b/setup.py @@ -2,13 +2,60 @@ from os.path import dirname, join + def main(): install_requires = ['requests', 'requests_toolbelt', 'urllib3<2'] tests_require = ['pytest', 'pytest-timeout', 'pytest-cov'] dev_requires = ['tox'] jwt_requires = ['pyjwt>=1.7.0', 'cryptography>=3'] - extras_require = {'test': tests_require + jwt_requires, 'dev': dev_requires, 'jwt': jwt_requires} - setup(name='box-sdk-gen', version='0.1.0', description='[Box Platform](https://box.dev) provides functionality to provide access to content stored within [Box](https://box.com). It provides endpoints for basic manipulation of files and folders, management of users within an enterprise, as well as more complex topics such as legal holds and retention policies.', url='https://github.com/box/box-python-sdk-gen.git', licence='Apache-2.0, http://www.apache.org/licenses/LICENSE-2.0', author='Box', long_description_content_type='text/markdown', long_description=open(join(dirname(__file__), 'README.md'), encoding='utf-8').read(), author_email='oss@box.com', classifiers=['Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Operating System :: OS Independent', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Operating System :: MacOS :: MacOS X', 'Topic :: Software Development :: Libraries :: Python Modules'], keywords='box, sdk, api, rest, boxsdk', install_requires=install_requires, tests_require=tests_require, extras_require=extras_require, packages=find_packages(exclude=['docs', '*test*'])) + extras_require = { + 'test': tests_require + jwt_requires, + 'dev': dev_requires, + 'jwt': jwt_requires, + } + setup( + name='box-sdk-gen', + version='0.1.0', + description=( + '[Box Platform](https://box.dev) provides functionality to provide access' + ' to content stored within [Box](https://box.com). It provides endpoints' + ' for basic manipulation of files and folders, management of users within' + ' an enterprise, as well as more complex topics such as legal holds and' + ' retention policies.' + ), + url='https://github.com/box/box-python-sdk-gen.git', + licence='Apache-2.0, http://www.apache.org/licenses/LICENSE-2.0', + author='Box', + long_description_content_type='text/markdown', + long_description=open( + join(dirname(__file__), 'README.md'), encoding='utf-8' + ).read(), + author_email='oss@box.com', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Operating System :: OS Independent', + 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: MacOS :: MacOS X', + 'Topic :: Software Development :: Libraries :: Python Modules', + ], + keywords='box, sdk, api, rest, boxsdk', + install_requires=install_requires, + tests_require=tests_require, + extras_require=extras_require, + packages=find_packages(exclude=['docs', '*test*']), + ) + if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/test/auth.py b/test/auth.py index 88e2552a..7eab0047 100644 --- a/test/auth.py +++ b/test/auth.py @@ -1,3 +1,5 @@ +from box_sdk_gen.schemas import AccessToken + from box_sdk_gen.utils import decode_base_64 from box_sdk_gen.utils import get_env_var @@ -20,10 +22,16 @@ from box_sdk_gen.schemas import UserFull + def test_ccg_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) + 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: CCGAuth = CCGAuth(config=ccg_config) client: Client = Client(auth=auth) auth.as_user(user_id) @@ -34,10 +42,13 @@ def test_ccg_auth(): assert not new_user.enterprise == None and new_user.enterprise.id == enterprise_id assert not new_user.id == user_id + def test_jwt_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'))) + jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) + ) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) auth.as_user(user_id) @@ -48,20 +59,26 @@ def test_jwt_auth(): assert not new_user.enterprise == None and 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'))) + jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) + ) auth: JWTAuth = JWTAuth(config=jwt_config) auth.as_user(user_id) - token: str = auth.retrieve_token() - dev_auth: DeveloperTokenAuth = DeveloperTokenAuth(token=token) + token: AccessToken = auth.retrieve_token() + dev_auth: DeveloperTokenAuth = DeveloperTokenAuth(token=token.access_token) client: Client = Client(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') + config: OAuthConfig = OAuthConfig( + client_id='OAUTH_CLIENT_ID', client_secret='OAUTH_CLIENT_SECRET' + ) auth: OAuth = OAuth(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 \ No newline at end of file + assert auth_url == expected_auth_url diff --git a/test/avatars.py b/test/avatars.py index ddf4545c..b9fca42b 100644 --- a/test/avatars.py +++ b/test/avatars.py @@ -1,5 +1,9 @@ import pytest +from box_sdk_gen.schemas import UserFull + +from box_sdk_gen.schemas import UserAvatar + from box_sdk_gen.utils import decode_base_64_byte_stream from box_sdk_gen.utils import decode_base_64 @@ -14,19 +18,29 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testAvatars(): user: UserFull = client.users.get_user_me() - created_avatar: UserAvatar = client.avatars.create_user_avatar(user_id=user.id, pic=decode_base_64_byte_stream('iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEW10NBjBBbqAAAAH0lEQVRoge3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAvg0hAAABmmDh1QAAAABJRU5ErkJggg=='), pic_file_name='avatar.png', pic_content_type='image/png') + created_avatar: UserAvatar = client.avatars.create_user_avatar( + user_id=user.id, + pic=decode_base_64_byte_stream( + 'iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEW10NBjBBbqAAAAH0lEQVRoge3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAvg0hAAABmmDh1QAAAABJRU5ErkJggg==' + ), + pic_file_name='avatar.png', + pic_content_type='image/png', + ) assert not created_avatar.pic_urls.small == None assert not created_avatar.pic_urls.large == None assert not created_avatar.pic_urls.preview == None assert client.avatars.get_user_avatar(user_id=user.id) client.avatars.delete_user_avatar(user_id=user.id) with pytest.raises(Exception): - client.avatars.get_user_avatar(user_id=user.id) \ No newline at end of file + client.avatars.get_user_avatar(user_id=user.id) diff --git a/test/collections.py b/test/collections.py index 15ece86d..7427857e 100644 --- a/test/collections.py +++ b/test/collections.py @@ -1,3 +1,11 @@ +from box_sdk_gen.schemas import Collections + +from box_sdk_gen.schemas import Collection + +from box_sdk_gen.schemas import Items + +from box_sdk_gen.schemas import FolderFull + from box_sdk_gen.managers.folders import CreateFolderParentArg from box_sdk_gen.managers.folders import UpdateFolderByIdCollectionsArg @@ -14,21 +22,37 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testCollections(): collections: Collections = client.collections.get_collections() - favourite_collection: Collections = collections.entries[0] - collection_items: Items = client.collections.get_collection_items(collection_id=favourite_collection.id) - folder: FolderFull = client.folders.create_folder(name=get_uuid(), parent=CreateFolderParentArg(id='0')) - client.folders.update_folder_by_id(folder_id=folder.id, collections=[UpdateFolderByIdCollectionsArg(id=favourite_collection.id)]) - collection_items_after_update: Items = client.collections.get_collection_items(collection_id=favourite_collection.id) - assert len(collection_items_after_update.entries) == len(collection_items.entries) + 1 + favourite_collection: Collection = collections.entries[0] + collection_items: Items = client.collections.get_collection_items( + collection_id=favourite_collection.id + ) + folder: FolderFull = client.folders.create_folder( + name=get_uuid(), parent=CreateFolderParentArg(id='0') + ) + client.folders.update_folder_by_id( + folder_id=folder.id, + collections=[UpdateFolderByIdCollectionsArg(id=favourite_collection.id)], + ) + collection_items_after_update: Items = client.collections.get_collection_items( + collection_id=favourite_collection.id + ) + assert ( + len(collection_items_after_update.entries) == len(collection_items.entries) + 1 + ) client.folders.update_folder_by_id(folder_id=folder.id, collections=[]) - collection_items_after_remove: Items = client.collections.get_collection_items(collection_id=favourite_collection.id) + collection_items_after_remove: Items = client.collections.get_collection_items( + collection_id=favourite_collection.id + ) assert len(collection_items_after_remove.entries) == len(collection_items.entries) - client.folders.delete_folder_by_id(folder_id=folder.id) \ No newline at end of file + client.folders.delete_folder_by_id(folder_id=folder.id) diff --git a/test/comments.py b/test/comments.py index 2053c727..8eac6a00 100644 --- a/test/comments.py +++ b/test/comments.py @@ -1,9 +1,17 @@ import pytest +from box_sdk_gen.utils import ByteStream + +from box_sdk_gen.schemas import Files + from box_sdk_gen.managers.uploads import UploadFileAttributesArg from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.schemas import Comments + +from box_sdk_gen.schemas import Comment + from box_sdk_gen.managers.comments import CreateCommentItemArg from box_sdk_gen.managers.comments import CreateCommentItemArgTypeField @@ -22,28 +30,48 @@ from box_sdk_gen.jwt_auth import JWTConfig + def comments(): - jwt_config: JWTConfig = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) + jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) + ) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) file_size: int = 256 file_name: str = get_uuid() file_byte_stream: ByteStream = generate_byte_stream(file_size) parent_id: str = '0' - uploaded_files: Files = client.uploads.upload_file(attributes=UploadFileAttributesArg(name=file_name, parent=UploadFileAttributesArgParentField(id=parent_id)), file=file_byte_stream) - file_id: Files = uploaded_files.entries[0].id + uploaded_files: Files = client.uploads.upload_file( + attributes=UploadFileAttributesArg( + name=file_name, parent=UploadFileAttributesArgParentField(id=parent_id) + ), + file=file_byte_stream, + ) + file_id: str = uploaded_files.entries[0].id comments: Comments = client.comments.get_file_comments(file_id=file_id) assert comments.total_count == 0 message: str = 'Hello there!' - new_comment: Comment = client.comments.create_comment(message=message, item=CreateCommentItemArg(id=file_id, type=CreateCommentItemArgTypeField.FILE.value)) + new_comment: Comment = client.comments.create_comment( + message=message, + item=CreateCommentItemArg( + id=file_id, type=CreateCommentItemArgTypeField.FILE.value + ), + ) assert new_comment.message == message assert new_comment.is_reply_comment == False assert new_comment.item.id == file_id - new_reply_comment: Comment = client.comments.create_comment(message=message, item=CreateCommentItemArg(id=new_comment.id, type=CreateCommentItemArgTypeField.COMMENT.value)) + new_reply_comment: Comment = client.comments.create_comment( + message=message, + item=CreateCommentItemArg( + id=new_comment.id, type=CreateCommentItemArgTypeField.COMMENT.value + ), + ) assert new_reply_comment.message == message assert new_reply_comment.is_reply_comment == True new_message: str = 'Hi!' - client.comments.update_comment_by_id(comment_id=new_reply_comment.id, message=new_message) + client.comments.update_comment_by_id( + comment_id=new_reply_comment.id, message=new_message + ) 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 @@ -51,4 +79,4 @@ def comments(): 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) - client.files.delete_file_by_id(file_id=file_id) \ No newline at end of file + client.files.delete_file_by_id(file_id=file_id) diff --git a/test/commons.py b/test/commons.py index b2521207..16fafe24 100644 --- a/test/commons.py +++ b/test/commons.py @@ -1,7 +1,15 @@ +from box_sdk_gen.schemas import File + +from box_sdk_gen.utils import ByteStream + +from box_sdk_gen.schemas import Files + from box_sdk_gen.managers.uploads import UploadFileAttributesArg 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 @@ -18,18 +26,29 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) -def upload_new_file(): + +def upload_new_file() -> File: new_file_name: str = ''.join([get_uuid(), '.pdf']) - file_content_stream = generate_byte_stream(1048576) - uploaded_files = client.uploads.upload_file(attributes=UploadFileAttributesArg(name=new_file_name, parent=UploadFileAttributesArgParentField(id='0')), file=file_content_stream) + file_content_stream: ByteStream = generate_byte_stream(1048576) + uploaded_files: Files = client.uploads.upload_file( + attributes=UploadFileAttributesArg( + name=new_file_name, parent=UploadFileAttributesArgParentField(id='0') + ), + file=file_content_stream, + ) return uploaded_files.entries[0] -def create_new_folder(): - new_folder_name = get_uuid() - return client.folders.create_folder(name=new_folder_name, parent=CreateFolderParentArg(id='0')) \ No newline at end of file + +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 355e1f19..d06752a5 100644 --- a/test/downloads.py +++ b/test/downloads.py @@ -1,7 +1,15 @@ +from box_sdk_gen.utils import Buffer + +from box_sdk_gen.utils import ByteStream + +from box_sdk_gen.schemas import Files + from box_sdk_gen.managers.uploads import UploadFileAttributesArg from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +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 @@ -22,18 +30,28 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def test_download_file(): new_file_name: str = get_uuid() file_buffer: Buffer = generate_byte_buffer(1048576) file_content_stream: ByteStream = generate_byte_stream_from_buffer(file_buffer) - uploaded_files: Files = client.uploads.upload_file(attributes=UploadFileAttributesArg(name=new_file_name, parent=UploadFileAttributesArgParentField(id='0')), file=file_content_stream) - uploaded_file: Files = uploaded_files.entries[0] - downloaded_file_content: ByteStream = client.downloads.download_file(file_id=uploaded_file.id) + uploaded_files: Files = client.uploads.upload_file( + attributes=UploadFileAttributesArg( + name=new_file_name, parent=UploadFileAttributesArgParentField(id='0') + ), + file=file_content_stream, + ) + uploaded_file: File = uploaded_files.entries[0] + downloaded_file_content: ByteStream = client.downloads.download_file( + file_id=uploaded_file.id + ) assert buffer_equals(read_byte_stream(downloaded_file_content), file_buffer) - client.files.delete_file_by_id(file_id=uploaded_file.id) \ No newline at end of file + client.files.delete_file_by_id(file_id=uploaded_file.id) diff --git a/test/email_aliases.py b/test/email_aliases.py index 6135a104..cdcebd20 100644 --- a/test/email_aliases.py +++ b/test/email_aliases.py @@ -1,3 +1,9 @@ +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 @@ -10,24 +16,37 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testEmailAliases(): new_user_name: str = get_uuid() new_user_login: str = ''.join([get_uuid(), '@boxdemo.com']) new_user: User = client.users.create_user(name=new_user_name, login=new_user_login) - aliases: EmailAliases = client.email_aliases.get_user_email_aliases(user_id=new_user.id) + aliases: EmailAliases = client.email_aliases.get_user_email_aliases( + user_id=new_user.id + ) assert aliases.total_count == 0 new_alias_email: str = ''.join([new_user.id, '@boxdemo.com']) - new_alias: EmailAlias = client.email_aliases.create_user_email_alias(user_id=new_user.id, email=new_alias_email) - updated_aliases: EmailAliases = client.email_aliases.get_user_email_aliases(user_id=new_user.id) + new_alias: EmailAlias = client.email_aliases.create_user_email_alias( + user_id=new_user.id, email=new_alias_email + ) + updated_aliases: EmailAliases = client.email_aliases.get_user_email_aliases( + user_id=new_user.id + ) assert updated_aliases.total_count == 1 assert updated_aliases.entries[0].email == new_alias_email - client.email_aliases.delete_user_email_alias_by_id(user_id=new_user.id, email_alias_id=new_alias.id) - final_aliases: EmailAliases = client.email_aliases.get_user_email_aliases(user_id=new_user.id) + client.email_aliases.delete_user_email_alias_by_id( + user_id=new_user.id, email_alias_id=new_alias.id + ) + final_aliases: EmailAliases = client.email_aliases.get_user_email_aliases( + user_id=new_user.id + ) assert final_aliases.total_count == 0 - client.users.delete_user_by_id(user_id=new_user.id) \ No newline at end of file + client.users.delete_user_by_id(user_id=new_user.id) diff --git a/test/files.py b/test/files.py index 5af0c7db..1a3aeb4a 100644 --- a/test/files.py +++ b/test/files.py @@ -1,11 +1,21 @@ import pytest +from box_sdk_gen.schemas import File + +from box_sdk_gen.schemas import Files + from box_sdk_gen.managers.uploads import UploadFileAttributesArg from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.utils import ByteStream + from box_sdk_gen.managers.files import GetFileThumbnailByIdExtensionArg +from box_sdk_gen.schemas import FileFull + +from box_sdk_gen.schemas import TrashFile + from box_sdk_gen.managers.files import CopyFileParentArg from box_sdk_gen.utils import decode_base_64 @@ -26,57 +36,84 @@ from test.commons import upload_new_file -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) -def upload_file(file_name, file_stream): - uploaded_files = client.uploads.upload_file(attributes=UploadFileAttributesArg(name=file_name, parent=UploadFileAttributesArgParentField(id='0')), file=file_stream) + +def upload_file(file_name, file_stream) -> File: + uploaded_files: Files = client.uploads.upload_file( + attributes=UploadFileAttributesArg( + name=file_name, parent=UploadFileAttributesArgParentField(id='0') + ), + file=file_stream, + ) return uploaded_files.entries[0] + def testGetFileThumbnail(): thumbnail_file_name: str = get_uuid() thumbnail_content_stream: ByteStream = generate_byte_stream(1048576) - thumbnail_file = upload_file(thumbnail_file_name, thumbnail_content_stream) - assert not client.files.get_file_thumbnail_by_id(file_id=thumbnail_file.id, extension=GetFileThumbnailByIdExtensionArg.PNG.value) == read_byte_stream(thumbnail_content_stream) + thumbnail_file: File = upload_file(thumbnail_file_name, thumbnail_content_stream) + assert not client.files.get_file_thumbnail_by_id( + file_id=thumbnail_file.id, extension=GetFileThumbnailByIdExtensionArg.PNG.value + ) == read_byte_stream(thumbnail_content_stream) client.files.delete_file_by_id(file_id=thumbnail_file.id) + def testGetFileFullExtraFields(): new_file_name: str = get_uuid() file_content: ByteStream = generate_byte_stream(1048576) - uploaded_file = upload_file(new_file_name, file_content) - file: FileFull = client.files.get_file_by_id(file_id=uploaded_file.id, fields='is_externally_owned,has_collaborations') + uploaded_file: File = upload_file(new_file_name, file_content) + file: FileFull = client.files.get_file_by_id( + file_id=uploaded_file.id, fields='is_externally_owned,has_collaborations' + ) assert file.is_externally_owned == False assert file.has_collaborations == False client.files.delete_file_by_id(file_id=file.id) + def testCreateGetAndDeleteFile(): new_file_name: str = get_uuid() updated_content_stream: ByteStream = generate_byte_stream(1048576) - uploaded_file = upload_file(new_file_name, updated_content_stream) + 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): - client.files.get_file_by_id(file_id=uploaded_file.id, fields='name', extra_headers={'if-none-match': file.etag}) + client.files.get_file_by_id( + file_id=uploaded_file.id, + fields='name', + extra_headers={'if-none-match': file.etag}, + ) assert file.name == new_file_name client.files.delete_file_by_id(file_id=uploaded_file.id) - trashed_file: TrashFile = client.trashed_files.get_file_trash(file_id=uploaded_file.id) + trashed_file: TrashFile = client.trashed_files.get_file_trash( + file_id=uploaded_file.id + ) assert file.id == trashed_file.id + def testUpdateFile(): - file_to_update = upload_new_file() + file_to_update: File = upload_new_file() updated_name: str = get_uuid() - updated_file: FileFull = client.files.update_file_by_id(file_id=file_to_update.id, name=updated_name, description='Updated description') + updated_file: FileFull = client.files.update_file_by_id( + file_id=file_to_update.id, name=updated_name, description='Updated description' + ) assert updated_file.name == updated_name assert updated_file.description == 'Updated description' client.files.delete_file_by_id(file_id=updated_file.id) + def testCopyFile(): - file_origin = upload_new_file() + file_origin: File = upload_new_file() copied_file_name: str = get_uuid() - copied_file: FileFull = client.files.copy_file(file_id=file_origin.id, name=copied_file_name, parent=CopyFileParentArg(id='0')) + copied_file: FileFull = client.files.copy_file( + file_id=file_origin.id, name=copied_file_name, parent=CopyFileParentArg(id='0') + ) assert copied_file.parent.id == '0' assert copied_file.name == copied_file_name client.files.delete_file_by_id(file_id=file_origin.id) - client.files.delete_file_by_id(file_id=copied_file.id) \ No newline at end of file + client.files.delete_file_by_id(file_id=copied_file.id) diff --git a/test/folder_locks.py b/test/folder_locks.py index 9fc9324f..0f684929 100644 --- a/test/folder_locks.py +++ b/test/folder_locks.py @@ -1,7 +1,13 @@ import pytest +from box_sdk_gen.schemas import FolderFull + from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.schemas import FolderLocks + +from box_sdk_gen.schemas import FolderLock + from box_sdk_gen.managers.folder_locks import CreateFolderLockLockedOperationsArg from box_sdk_gen.managers.folder_locks import CreateFolderLockFolderArg @@ -18,23 +24,35 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testFolderLocks(): - folder: FolderFull = client.folders.create_folder(name=get_uuid(), parent=CreateFolderParentArg(id='0')) - folder_locks: FolderLocks = client.folder_locks.get_folder_locks(folder_id=folder.id) + folder: FolderFull = client.folders.create_folder( + name=get_uuid(), parent=CreateFolderParentArg(id='0') + ) + folder_locks: FolderLocks = client.folder_locks.get_folder_locks( + folder_id=folder.id + ) assert len(folder_locks.entries) == 0 - folder_lock: FolderLock = client.folder_locks.create_folder_lock(locked_operations=CreateFolderLockLockedOperationsArg(move=True, delete=True), folder=CreateFolderLockFolderArg(id=folder.id, type='folder')) + folder_lock: FolderLock = client.folder_locks.create_folder_lock( + locked_operations=CreateFolderLockLockedOperationsArg(move=True, delete=True), + folder=CreateFolderLockFolderArg(id=folder.id, type='folder'), + ) assert folder_lock.folder.id == folder.id assert folder_lock.locked_operations.move == True assert folder_lock.locked_operations.delete == True client.folder_locks.delete_folder_lock_by_id(folder_lock_id=folder_lock.id) with pytest.raises(Exception): client.folder_locks.delete_folder_lock_by_id(folder_lock_id=folder_lock.id) - new_folder_locks: FolderLocks = client.folder_locks.get_folder_locks(folder_id=folder.id) + new_folder_locks: FolderLocks = client.folder_locks.get_folder_locks( + folder_id=folder.id + ) assert len(new_folder_locks.entries) == 0 - client.folders.delete_folder_by_id(folder_id=folder.id) \ No newline at end of file + client.folders.delete_folder_by_id(folder_id=folder.id) diff --git a/test/folders.py b/test/folders.py index 7d29e8b0..10607f05 100644 --- a/test/folders.py +++ b/test/folders.py @@ -1,11 +1,15 @@ import pytest +from box_sdk_gen.schemas import FolderFull + from box_sdk_gen.managers.folders import CreateFolderParentArg from box_sdk_gen.managers.folders import CopyFolderParentArg from box_sdk_gen.managers.folders import UpdateFolderByIdParentArg +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 @@ -18,53 +22,82 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def test_get_folder_info(): root_folder: FolderFull = client.folders.get_folder_by_id(folder_id='0') assert root_folder.id == '0' assert root_folder.name == 'All Files' + def test_get_folder_full_info_with_extra_fields(): - root_folder: FolderFull = client.folders.get_folder_by_id(folder_id='0', fields='has_collaborations,tags') + root_folder: FolderFull = client.folders.get_folder_by_id( + folder_id='0', fields='has_collaborations,tags' + ) assert root_folder.id == '0' assert root_folder.has_collaborations == False tags_length: int = len(root_folder.tags) assert tags_length == 0 + def test_create_and_delete_folder(): new_folder_name: str = get_uuid() - new_folder: FolderFull = client.folders.create_folder(name=new_folder_name, parent=CreateFolderParentArg(id='0')) - created_folder: FolderFull = client.folders.get_folder_by_id(folder_id=new_folder.id) + new_folder: FolderFull = client.folders.create_folder( + name=new_folder_name, parent=CreateFolderParentArg(id='0') + ) + created_folder: FolderFull = client.folders.get_folder_by_id( + folder_id=new_folder.id + ) assert created_folder.name == new_folder_name client.folders.delete_folder_by_id(folder_id=new_folder.id) with pytest.raises(Exception): client.folders.get_folder_by_id(folder_id=new_folder.id) + def test_update_folder(): folder_to_update_name: str = get_uuid() - folder_to_update: FolderFull = client.folders.create_folder(name=folder_to_update_name, parent=CreateFolderParentArg(id='0')) + folder_to_update: FolderFull = client.folders.create_folder( + name=folder_to_update_name, parent=CreateFolderParentArg(id='0') + ) updated_name: str = get_uuid() - updated_folder: FolderFull = client.folders.update_folder_by_id(folder_id=folder_to_update.id, name=updated_name, description='Updated description') + updated_folder: FolderFull = client.folders.update_folder_by_id( + folder_id=folder_to_update.id, + name=updated_name, + description='Updated description', + ) assert updated_folder.name == updated_name assert updated_folder.description == 'Updated description' client.folders.delete_folder_by_id(folder_id=updated_folder.id) + def test_copy_move_folder_and_list_folder_items(): folder_origin_name: str = get_uuid() - folder_origin: FolderFull = client.folders.create_folder(name=folder_origin_name, parent=CreateFolderParentArg(id='0')) + folder_origin: FolderFull = client.folders.create_folder( + name=folder_origin_name, parent=CreateFolderParentArg(id='0') + ) copied_folder_name: str = get_uuid() - copied_folder: FolderFull = client.folders.copy_folder(folder_id=folder_origin.id, name=copied_folder_name, parent=CopyFolderParentArg(id='0')) + copied_folder: FolderFull = client.folders.copy_folder( + folder_id=folder_origin.id, + name=copied_folder_name, + parent=CopyFolderParentArg(id='0'), + ) assert copied_folder.parent.id == '0' moved_folder_name: str = get_uuid() - moved_folder: FolderFull = client.folders.update_folder_by_id(folder_id=copied_folder.id, name=moved_folder_name, parent=UpdateFolderByIdParentArg(id=folder_origin.id)) + moved_folder: FolderFull = client.folders.update_folder_by_id( + folder_id=copied_folder.id, + name=moved_folder_name, + parent=UpdateFolderByIdParentArg(id=folder_origin.id), + ) assert moved_folder.parent.id == folder_origin.id folder_items: Items = client.folders.get_folder_items(folder_id=folder_origin.id) assert folder_items.entries[0].id == moved_folder.id assert folder_items.entries[0].name == moved_folder_name client.folders.delete_folder_by_id(folder_id=moved_folder.id) - client.folders.delete_folder_by_id(folder_id=folder_origin.id) \ No newline at end of file + client.folders.delete_folder_by_id(folder_id=folder_origin.id) diff --git a/test/groups.py b/test/groups.py index 585985ad..b8f61bc6 100644 --- a/test/groups.py +++ b/test/groups.py @@ -1,5 +1,11 @@ import pytest +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 @@ -12,27 +18,37 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def test_get_groups(): groups: Groups = client.groups.get_groups() assert groups.total_count >= 0 + def test_create_get_delete_group(): group_name: str = get_uuid() group_description: str = 'Group description' - group: Group = client.groups.create_group(name=group_name, description=group_description) + group: Group = client.groups.create_group( + name=group_name, description=group_description + ) assert group.name == group_name - group_by_id: GroupFull = client.groups.get_group_by_id(group_id=group.id, fields='id,name,description,group_type') + group_by_id: GroupFull = client.groups.get_group_by_id( + group_id=group.id, fields='id,name,description,group_type' + ) assert group_by_id.id == group.id assert group_by_id.description == group_description updated_group_name: str = get_uuid() - updated_group: GroupFull = client.groups.update_group_by_id(group_id=group.id, name=updated_group_name) + updated_group: GroupFull = client.groups.update_group_by_id( + group_id=group.id, name=updated_group_name + ) assert updated_group.name == updated_group_name client.groups.delete_group_by_id(group_id=group.id) with pytest.raises(Exception): - client.groups.get_group_by_id(group_id=group.id) \ No newline at end of file + client.groups.get_group_by_id(group_id=group.id) diff --git a/test/memberships.py b/test/memberships.py index 967fbc5e..5684dcaa 100644 --- a/test/memberships.py +++ b/test/memberships.py @@ -1,5 +1,13 @@ import pytest +from box_sdk_gen.schemas import User + +from box_sdk_gen.schemas import GroupMemberships + +from box_sdk_gen.schemas import Group + +from box_sdk_gen.schemas import GroupMembership + from box_sdk_gen.managers.memberships import UpdateGroupMembershipByIdRoleArg from box_sdk_gen.utils import decode_base_64 @@ -14,29 +22,51 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testMemberships(): - user: User = client.users.create_user(name=get_uuid(), login=''.join([get_uuid(), '@boxdemo.com'])) - user_memberships: GroupMemberships = client.memberships.get_user_memberships(user_id=user.id) + user: User = client.users.create_user( + name=get_uuid(), login=''.join([get_uuid(), '@boxdemo.com']) + ) + user_memberships: GroupMemberships = client.memberships.get_user_memberships( + user_id=user.id + ) assert user_memberships.total_count == 0 group: Group = client.groups.create_group(name=get_uuid()) - group_memberships: GroupMemberships = client.memberships.get_group_memberships(group_id=group.id) + group_memberships: GroupMemberships = client.memberships.get_group_memberships( + group_id=group.id + ) assert group_memberships.total_count == 0 - group_membership: GroupMembership = client.memberships.create_group_membership(user=user, group=group) + group_membership: GroupMembership = client.memberships.create_group_membership( + user=user, group=group + ) assert group_membership.user.id == user.id assert group_membership.group.id == group.id assert group_membership.role == 'member' - assert client.memberships.get_group_membership_by_id(group_membership_id=group_membership.id) - updated_group_membership: GroupMembership = client.memberships.update_group_membership_by_id(group_membership_id=group_membership.id, role=UpdateGroupMembershipByIdRoleArg.ADMIN.value) + assert client.memberships.get_group_membership_by_id( + group_membership_id=group_membership.id + ) + updated_group_membership: GroupMembership = ( + client.memberships.update_group_membership_by_id( + group_membership_id=group_membership.id, + role=UpdateGroupMembershipByIdRoleArg.ADMIN.value, + ) + ) assert updated_group_membership.id == group_membership.id assert updated_group_membership.role == 'admin' - client.memberships.delete_group_membership_by_id(group_membership_id=group_membership.id) + client.memberships.delete_group_membership_by_id( + group_membership_id=group_membership.id + ) with pytest.raises(Exception): - client.memberships.get_group_membership_by_id(group_membership_id=group_membership.id) + client.memberships.get_group_membership_by_id( + group_membership_id=group_membership.id + ) client.groups.delete_group_by_id(group_id=group.id) - client.users.delete_user_by_id(user_id=user.id) \ No newline at end of file + client.users.delete_user_by_id(user_id=user.id) diff --git a/test/metadata_templates.py b/test/metadata_templates.py index 7050b15c..2193b840 100644 --- a/test/metadata_templates.py +++ b/test/metadata_templates.py @@ -1,11 +1,19 @@ import pytest -from box_sdk_gen.managers.metadata_templates import CreateMetadataTemplateSchemaFieldsArg +from box_sdk_gen.schemas import MetadataTemplate -from box_sdk_gen.managers.metadata_templates import CreateMetadataTemplateSchemaFieldsArgTypeField +from box_sdk_gen.managers.metadata_templates import ( + CreateMetadataTemplateSchemaFieldsArg, +) + +from box_sdk_gen.managers.metadata_templates import ( + CreateMetadataTemplateSchemaFieldsArgTypeField, +) from box_sdk_gen.managers.metadata_templates import GetMetadataTemplateSchemaScopeArg +from box_sdk_gen.schemas import MetadataTemplates + from box_sdk_gen.managers.metadata_templates import DeleteMetadataTemplateSchemaScopeArg from box_sdk_gen.utils import decode_base_64 @@ -20,26 +28,57 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testMetadataTemplates(): template_key: str = ''.join(['key', get_uuid()]) - template: MetadataTemplate = client.metadata_templates.create_metadata_template_schema(scope='enterprise', template_key=template_key, display_name=template_key, fields=[CreateMetadataTemplateSchemaFieldsArg(type=CreateMetadataTemplateSchemaFieldsArgTypeField.STRING.value, key='testName', display_name='testName')]) + template: MetadataTemplate = ( + client.metadata_templates.create_metadata_template_schema( + scope='enterprise', + template_key=template_key, + display_name=template_key, + fields=[ + CreateMetadataTemplateSchemaFieldsArg( + type=CreateMetadataTemplateSchemaFieldsArgTypeField.STRING.value, + key='testName', + display_name='testName', + ) + ], + ) + ) assert template.template_key == template_key assert template.display_name == template_key assert len(template.fields) == 1 assert template.fields[0].key == 'testName' assert template.fields[0].display_name == 'testName' - assert client.metadata_templates.get_metadata_template_by_id(template_id=template.id) - assert client.metadata_templates.get_metadata_template_schema(scope=GetMetadataTemplateSchemaScopeArg.ENTERPRISE.value, template_key=template.template_key) - enterprise_metadata_templates: MetadataTemplates = client.metadata_templates.get_metadata_template_enterprise() + assert client.metadata_templates.get_metadata_template_by_id( + template_id=template.id + ) + assert client.metadata_templates.get_metadata_template_schema( + scope=GetMetadataTemplateSchemaScopeArg.ENTERPRISE.value, + template_key=template.template_key, + ) + enterprise_metadata_templates: MetadataTemplates = ( + client.metadata_templates.get_metadata_template_enterprise() + ) assert len(enterprise_metadata_templates.entries) > 0 - global_metadata_templates: MetadataTemplates = client.metadata_templates.get_metadata_template_global() + global_metadata_templates: MetadataTemplates = ( + client.metadata_templates.get_metadata_template_global() + ) assert len(global_metadata_templates.entries) > 0 - client.metadata_templates.delete_metadata_template_schema(scope=DeleteMetadataTemplateSchemaScopeArg.ENTERPRISE.value, template_key=template.template_key) + client.metadata_templates.delete_metadata_template_schema( + scope=DeleteMetadataTemplateSchemaScopeArg.ENTERPRISE.value, + template_key=template.template_key, + ) with pytest.raises(Exception): - client.metadata_templates.delete_metadata_template_schema(scope=DeleteMetadataTemplateSchemaScopeArg.ENTERPRISE.value, template_key=template.template_key) \ No newline at end of file + client.metadata_templates.delete_metadata_template_schema( + scope=DeleteMetadataTemplateSchemaScopeArg.ENTERPRISE.value, + template_key=template.template_key, + ) diff --git a/test/recent_items.py b/test/recent_items.py index e5164446..2593e989 100644 --- a/test/recent_items.py +++ b/test/recent_items.py @@ -1,3 +1,5 @@ +from box_sdk_gen.schemas import RecentItems + from box_sdk_gen.utils import decode_base_64 from box_sdk_gen.utils import get_env_var @@ -10,12 +12,15 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) + def testRecentItems(): auth.as_user(get_env_var('USER_ID')) client: Client = Client(auth=auth) recent_items: RecentItems = client.recent_items.get_recent_items() - assert len(recent_items.entries) > 0 \ No newline at end of file + assert len(recent_items.entries) > 0 diff --git a/test/retention_policies.py b/test/retention_policies.py index 28b495b1..bed10e56 100644 --- a/test/retention_policies.py +++ b/test/retention_policies.py @@ -1,8 +1,16 @@ +from box_sdk_gen.schemas import RetentionPolicy + from box_sdk_gen.managers.retention_policies import CreateRetentionPolicyPolicyTypeArg -from box_sdk_gen.managers.retention_policies import CreateRetentionPolicyDispositionActionArg +from box_sdk_gen.managers.retention_policies import ( + CreateRetentionPolicyDispositionActionArg, +) + +from box_sdk_gen.managers.retention_policies import ( + CreateRetentionPolicyRetentionTypeArg, +) -from box_sdk_gen.managers.retention_policies import CreateRetentionPolicyRetentionTypeArg +from box_sdk_gen.schemas import RetentionPolicies from box_sdk_gen.utils import decode_base_64 @@ -16,23 +24,48 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + 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 - retention_policy_by_id: RetentionPolicy = client.retention_policies.get_retention_policy_by_id(retention_policy_id=retention_policy.id) + retention_policy_by_id: RetentionPolicy = ( + client.retention_policies.get_retention_policy_by_id( + retention_policy_id=retention_policy.id + ) + ) assert retention_policy_by_id.id == retention_policy.id - retention_policies: RetentionPolicies = client.retention_policies.get_retention_policies() + retention_policies: RetentionPolicies = ( + client.retention_policies.get_retention_policies() + ) assert len(retention_policies.entries) > 0 updated_retention_policy_name: str = get_uuid() - updated_retention_policy: RetentionPolicy = client.retention_policies.update_retention_policy_by_id(retention_policy_id=retention_policy.id, policy_name=updated_retention_policy_name) + updated_retention_policy: RetentionPolicy = ( + client.retention_policies.update_retention_policy_by_id( + retention_policy_id=retention_policy.id, + policy_name=updated_retention_policy_name, + ) + ) assert updated_retention_policy.policy_name == updated_retention_policy_name - client.retention_policies.delete_retention_policy_by_id(retention_policy_id=retention_policy.id) \ No newline at end of file + client.retention_policies.delete_retention_policy_by_id( + retention_policy_id=retention_policy.id + ) diff --git a/test/sign_requests.py b/test/sign_requests.py index 7e27143b..7745f634 100644 --- a/test/sign_requests.py +++ b/test/sign_requests.py @@ -1,7 +1,15 @@ +from box_sdk_gen.schemas import File + +from box_sdk_gen.schemas import FolderFull + +from box_sdk_gen.schemas import SignRequest + from box_sdk_gen.schemas import FileBaseTypeField from box_sdk_gen.schemas import FolderBaseTypeField +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 @@ -26,27 +34,40 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def test_create_get_cancel_and_list_sign_request(): signer_email: str = ''.join([get_uuid(), '@box.com']) - file_to_sign = upload_new_file() - destination_folder = create_new_folder() - created_sign_request: SignRequest = client.sign_requests.create_sign_request(source_files=[FileBase(id=file_to_sign.id, type=FileBaseTypeField.FILE.value)], signers=[SignRequestCreateSigner(email=signer_email)], parent_folder=FolderMini(id=destination_folder.id, type=FolderBaseTypeField.FOLDER.value)) + file_to_sign: File = upload_new_file() + destination_folder: FolderFull = create_new_folder() + created_sign_request: SignRequest = client.sign_requests.create_sign_request( + source_files=[FileBase(id=file_to_sign.id, type=FileBaseTypeField.FILE.value)], + signers=[SignRequestCreateSigner(email=signer_email)], + parent_folder=FolderMini( + id=destination_folder.id, type=FolderBaseTypeField.FOLDER.value + ), + ) assert created_sign_request.sign_files.files[0].name == file_to_sign.name assert created_sign_request.signers[1].email == signer_email assert created_sign_request.parent_folder.id == destination_folder.id - new_sign_request: SignRequest = client.sign_requests.get_sign_request_by_id(sign_request_id=created_sign_request.id) + new_sign_request: SignRequest = client.sign_requests.get_sign_request_by_id( + sign_request_id=created_sign_request.id + ) assert new_sign_request.sign_files.files[0].name == file_to_sign.name assert new_sign_request.signers[1].email == signer_email assert new_sign_request.parent_folder.id == destination_folder.id - cancelled_sign_request: SignRequest = client.sign_requests.cancel_sign_request(sign_request_id=created_sign_request.id) + cancelled_sign_request: SignRequest = client.sign_requests.cancel_sign_request( + sign_request_id=created_sign_request.id + ) assert cancelled_sign_request.status == 'cancelled' sign_requests: SignRequests = client.sign_requests.get_sign_requests() assert 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) \ No newline at end of file + client.files.delete_file_by_id(file_id=file_to_sign.id) diff --git a/test/tasks.py b/test/tasks.py index fc4e014c..9ab0b673 100644 --- a/test/tasks.py +++ b/test/tasks.py @@ -1,7 +1,13 @@ +from box_sdk_gen.schemas import Files + from box_sdk_gen.managers.uploads import UploadFileAttributesArg from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.schemas import File + +from box_sdk_gen.schemas import Task + from box_sdk_gen.managers.tasks import CreateTaskItemArg from box_sdk_gen.managers.tasks import CreateTaskItemArgTypeField @@ -10,6 +16,8 @@ from box_sdk_gen.managers.tasks import CreateTaskCompletionRuleArg +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 @@ -24,23 +32,39 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testCreateUpdateGetDeleteTask(): - files: Files = client.uploads.upload_file(attributes=UploadFileAttributesArg(name=get_uuid(), parent=UploadFileAttributesArgParentField(id='0')), file=generate_byte_stream(10)) - file: Files = files.entries[0] - task: Task = client.tasks.create_task(item=CreateTaskItemArg(type=CreateTaskItemArgTypeField.FILE.value, id=file.id), action=CreateTaskActionArg.REVIEW.value, message='test message', due_at='2035-01-01T00:00:00Z', completion_rule=CreateTaskCompletionRuleArg.ALL_ASSIGNEES.value) + files: Files = client.uploads.upload_file( + attributes=UploadFileAttributesArg( + name=get_uuid(), parent=UploadFileAttributesArgParentField(id='0') + ), + file=generate_byte_stream(10), + ) + file: File = files.entries[0] + task: Task = client.tasks.create_task( + item=CreateTaskItemArg(type=CreateTaskItemArgTypeField.FILE.value, id=file.id), + action=CreateTaskActionArg.REVIEW.value, + message='test message', + due_at='2035-01-01T00:00:00Z', + completion_rule=CreateTaskCompletionRuleArg.ALL_ASSIGNEES.value, + ) assert task.message == 'test message' assert task.item.id == file.id task_by_id: Task = client.tasks.get_task_by_id(task_id=task.id) assert task_by_id.id == task.id task_on_file: Tasks = client.tasks.get_file_tasks(file_id=file.id) assert task_on_file.total_count == 1 - updated_task: Task = client.tasks.update_task_by_id(task_id=task.id, message='updated message') + updated_task: Task = client.tasks.update_task_by_id( + task_id=task.id, message='updated message' + ) assert updated_task.message == 'updated message' client.tasks.delete_task_by_id(task_id=task.id) - client.files.delete_file_by_id(file_id=file.id) \ No newline at end of file + client.files.delete_file_by_id(file_id=file.id) diff --git a/test/trashed_files.py b/test/trashed_files.py index c4a98900..f07098fd 100644 --- a/test/trashed_files.py +++ b/test/trashed_files.py @@ -1,9 +1,21 @@ import pytest +from box_sdk_gen.utils import ByteStream + +from box_sdk_gen.schemas import Files + from box_sdk_gen.managers.uploads import UploadFileAttributesArg from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.schemas import File + +from box_sdk_gen.schemas import TrashFile + +from box_sdk_gen.schemas import FileFull + +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 @@ -18,25 +30,35 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testTrashedFiles(): file_size = 1024 * 1024 file_name: str = get_uuid() file_byte_stream: ByteStream = generate_byte_stream(file_size) - files: Files = client.uploads.upload_file(attributes=UploadFileAttributesArg(name=file_name, parent=UploadFileAttributesArgParentField(id='0')), file=file_byte_stream) - file: Files = files.entries[0] + files: Files = client.uploads.upload_file( + attributes=UploadFileAttributesArg( + name=file_name, parent=UploadFileAttributesArgParentField(id='0') + ), + file=file_byte_stream, + ) + file: File = files.entries[0] client.files.delete_file_by_id(file_id=file.id) from_trash: TrashFile = client.trashed_files.get_file_trash(file_id=file.id) assert from_trash.id == file.id assert from_trash.name == file.name from_api_after_trashed: FileFull = client.files.get_file_by_id(file_id=file.id) assert from_api_after_trashed.item_status == 'trashed' - restored_file: TrashFileRestored = client.trashed_files.restore_file_from_trash(file_id=file.id) + restored_file: TrashFileRestored = client.trashed_files.restore_file_from_trash( + file_id=file.id + ) from_api_after_restore: FileFull = client.files.get_file_by_id(file_id=file.id) assert restored_file.id == from_api_after_restore.id assert restored_file.name == from_api_after_restore.name @@ -44,4 +66,4 @@ def testTrashedFiles(): client.files.delete_file_by_id(file_id=file.id) client.trashed_files.delete_file_trash(file_id=file.id) with pytest.raises(Exception): - client.trashed_files.get_file_trash(file_id=file.id) \ No newline at end of file + client.trashed_files.get_file_trash(file_id=file.id) diff --git a/test/trashed_folders.py b/test/trashed_folders.py index 3d777204..ce04b19c 100644 --- a/test/trashed_folders.py +++ b/test/trashed_folders.py @@ -1,7 +1,13 @@ import pytest +from box_sdk_gen.schemas import FolderFull + from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.schemas import TrashFolder + +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 @@ -14,25 +20,34 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testTrashedFolders(): - folder: FolderFull = client.folders.create_folder(name=get_uuid(), parent=CreateFolderParentArg(id='0')) + folder: FolderFull = client.folders.create_folder( + name=get_uuid(), parent=CreateFolderParentArg(id='0') + ) client.folders.delete_folder_by_id(folder_id=folder.id) - from_trash: TrashFolder = client.trashed_folders.get_folder_trash(folder_id=folder.id) + from_trash: TrashFolder = client.trashed_folders.get_folder_trash( + folder_id=folder.id + ) assert from_trash.id == folder.id assert from_trash.name == folder.name with pytest.raises(Exception): client.folders.get_folder_by_id(folder_id=folder.id) - restored_folder: TrashFolderRestored = client.trashed_folders.restore_folder_from_trash(folder_id=folder.id) + restored_folder: TrashFolderRestored = ( + client.trashed_folders.restore_folder_from_trash(folder_id=folder.id) + ) from_api: FolderFull = client.folders.get_folder_by_id(folder_id=folder.id) assert restored_folder.id == from_api.id assert restored_folder.name == from_api.name client.folders.delete_folder_by_id(folder_id=folder.id) client.trashed_folders.delete_folder_trash(folder_id=folder.id) with pytest.raises(Exception): - client.trashed_folders.get_folder_trash(folder_id=folder.id) \ No newline at end of file + client.trashed_folders.get_folder_trash(folder_id=folder.id) diff --git a/test/uploads.py b/test/uploads.py index 33f3e052..580ec72f 100644 --- a/test/uploads.py +++ b/test/uploads.py @@ -1,7 +1,13 @@ +from box_sdk_gen.utils import ByteStream + +from box_sdk_gen.schemas import Files + from box_sdk_gen.managers.uploads import UploadFileAttributesArg from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.schemas import File + from box_sdk_gen.managers.uploads import UploadFileVersionAttributesArg from box_sdk_gen.utils import decode_base_64 @@ -20,21 +26,33 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def test_upload_file_and_file_version(): new_file_name: str = get_uuid() file_content_stream: ByteStream = generate_byte_stream(1048576) - uploaded_files: Files = client.uploads.upload_file(attributes=UploadFileAttributesArg(name=new_file_name, parent=UploadFileAttributesArgParentField(id='0')), file=file_content_stream) - uploaded_file: Files = uploaded_files.entries[0] + uploaded_files: Files = client.uploads.upload_file( + attributes=UploadFileAttributesArg( + name=new_file_name, parent=UploadFileAttributesArgParentField(id='0') + ), + file=file_content_stream, + ) + 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) - uploaded_files_version: Files = client.uploads.upload_file_version(file_id=uploaded_file.id, attributes=UploadFileVersionAttributesArg(name=new_file_version_name), file=new_file_content_stream) - new_file_version: Files = uploaded_files_version.entries[0] + uploaded_files_version: Files = client.uploads.upload_file_version( + file_id=uploaded_file.id, + attributes=UploadFileVersionAttributesArg(name=new_file_version_name), + file=new_file_content_stream, + ) + new_file_version: File = uploaded_files_version.entries[0] assert new_file_version.name == new_file_version_name - client.files.delete_file_by_id(file_id=new_file_version.id) \ No newline at end of file + client.files.delete_file_by_id(file_id=new_file_version.id) diff --git a/test/users.py b/test/users.py index 946f444a..8da514ab 100644 --- a/test/users.py +++ b/test/users.py @@ -1,3 +1,9 @@ +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 @@ -10,28 +16,37 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def test_get_users(): users: Users = client.users.get_users() assert users.total_count >= 0 + def test_get_user_me(): current_user: UserFull = client.users.get_user_me() assert current_user.type == 'user' + def test_create_update_get_delete_user(): user_name: str = get_uuid() user_login: str = ''.join([get_uuid(), '@gmail.com']) - user: User = client.users.create_user(name=user_name, login=user_login, is_platform_access_only=True) + user: User = client.users.create_user( + name=user_name, login=user_login, is_platform_access_only=True + ) assert user.name == user_name user_by_id: UserFull = client.users.get_user_by_id(user_id=user.id) assert user_by_id.id == user.id updated_user_name: str = get_uuid() - updated_user: UserFull = client.users.update_user_by_id(user_id=user.id, name=updated_user_name) + updated_user: UserFull = client.users.update_user_by_id( + user_id=user.id, name=updated_user_name + ) assert updated_user.name == updated_user_name - client.users.delete_user_by_id(user_id=user.id) \ No newline at end of file + client.users.delete_user_by_id(user_id=user.id) diff --git a/test/webhooks.py b/test/webhooks.py index 4e6f7835..4f361144 100644 --- a/test/webhooks.py +++ b/test/webhooks.py @@ -1,13 +1,19 @@ import pytest +from box_sdk_gen.schemas import FolderFull + from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.schemas import Webhook + from box_sdk_gen.managers.webhooks import CreateWebhookTargetArg from box_sdk_gen.managers.webhooks import CreateWebhookTargetArgTypeField from box_sdk_gen.managers.webhooks import CreateWebhookTriggersArg +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 @@ -20,15 +26,26 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def testWebhooksCRUD(): - folder: FolderFull = client.folders.create_folder(name=get_uuid(), parent=CreateFolderParentArg(id='0')) - webhook: Webhook = client.webhooks.create_webhook(target=CreateWebhookTargetArg(id=folder.id, type=CreateWebhookTargetArgTypeField.FOLDER.value), address='https://example.com/new-webhook', triggers=[CreateWebhookTriggersArg.FILE_UPLOADED.value]) + folder: FolderFull = client.folders.create_folder( + name=get_uuid(), parent=CreateFolderParentArg(id='0') + ) + webhook: Webhook = client.webhooks.create_webhook( + target=CreateWebhookTargetArg( + id=folder.id, type=CreateWebhookTargetArgTypeField.FOLDER.value + ), + address='https://example.com/new-webhook', + triggers=[CreateWebhookTriggersArg.FILE_UPLOADED.value], + ) assert webhook.target.id == folder.id assert webhook.target.type == 'folder' assert len(webhook.triggers) == len(['FILE.UPLOADED']) @@ -39,10 +56,12 @@ def testWebhooksCRUD(): assert webhook.id == webhook_from_api.id assert webhook.target.id == webhook_from_api.target.id assert webhook.address == webhook_from_api.address - updated_webhook: Webhook = client.webhooks.update_webhook_by_id(webhook_id=webhook.id, address='https://example.com/updated-webhook') + updated_webhook: Webhook = client.webhooks.update_webhook_by_id( + webhook_id=webhook.id, address='https://example.com/updated-webhook' + ) assert updated_webhook.id == webhook.id assert updated_webhook.address == 'https://example.com/updated-webhook' client.webhooks.delete_webhook_by_id(webhook_id=webhook.id) with pytest.raises(Exception): client.webhooks.delete_webhook_by_id(webhook_id=webhook.id) - client.folders.delete_folder_by_id(folder_id=folder.id) \ No newline at end of file + client.folders.delete_folder_by_id(folder_id=folder.id) diff --git a/test/weblinks.py b/test/weblinks.py index 4239140a..23ec4136 100644 --- a/test/weblinks.py +++ b/test/weblinks.py @@ -1,3 +1,7 @@ +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.utils import decode_base_64 @@ -12,12 +16,15 @@ from box_sdk_gen.jwt_auth import JWTConfig -jwt_config = JWTConfig.from_config_json_string(decode_base_64(get_env_var('JWT_CONFIG_BASE_64'))) +jwt_config: JWTConfig = JWTConfig.from_config_json_string( + decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) +) auth: JWTAuth = JWTAuth(config=jwt_config) client: Client = Client(auth=auth) + def test_create_get_delete_weblink(): url: str = 'https://www.box.com' parent: FolderFull = client.folders.get_folder_by_id(folder_id='0') @@ -25,7 +32,9 @@ def test_create_get_delete_weblink(): description: str = 'Weblink description' 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) + weblink: WebLink = client.web_links.create_web_link( + url=url, parent=parent, name=name, description=description + ) assert weblink.url == url assert weblink.parent.id == parent.id assert weblink.name == name @@ -34,9 +43,17 @@ def test_create_get_delete_weblink(): assert weblink_by_id.id == weblink.id assert weblink_by_id.url == url updated_name: str = get_uuid() - updated_weblink: WebLink = client.web_links.update_web_link_by_id(web_link_id=weblink.id, name=updated_name, shared_link=UpdateWebLinkByIdSharedLinkArg(access=shared_access, password=password)) + updated_weblink: WebLink = client.web_links.update_web_link_by_id( + web_link_id=weblink.id, + name=updated_name, + shared_link=UpdateWebLinkByIdSharedLinkArg( + access=shared_access, password=password + ), + ) assert updated_weblink.name == updated_name assert updated_weblink.shared_link.access == shared_access client.web_links.delete_web_link_by_id(web_link_id=weblink.id) - deleted_weblink: WebLink = client.web_links.get_web_link_by_id(web_link_id=weblink.id) - assert deleted_weblink.item_status == 'trashed' \ No newline at end of file + deleted_weblink: WebLink = client.web_links.get_web_link_by_id( + web_link_id=weblink.id + ) + assert deleted_weblink.item_status == 'trashed'