From 491001118e44c0aba18dfea151b905961bb7b31d Mon Sep 17 00:00:00 2001 From: box-sdk-build <94016436+box-sdk-build@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:52:29 +0100 Subject: [PATCH] codegen output 7839b767d8114c79a8c33d1a5ffd1bec (#44) * generated with codegen at box/box-codegen@efdca9b and spec at box/box-openapi@fc21828 * generated with codegen at box/box-codegen@c6d3cfa and spec at box/box-openapi@fc21828 * generated with codegen at box/box-codegen@7a2cf3d and spec at box/box-openapi@fc21828 --- box_sdk_gen/auth.py | 4 +- box_sdk_gen/base_urls.py | 26 + box_sdk_gen/client.py | 27 +- box_sdk_gen/fetch.py | 22 +- box_sdk_gen/managers/authorization.py | 294 +++++++- box_sdk_gen/managers/avatars.py | 25 +- box_sdk_gen/managers/chunked_uploads.py | 38 +- box_sdk_gen/managers/classifications.py | 152 +++-- .../collaboration_allowlist_entries.py | 32 +- .../collaboration_allowlist_exempt_targets.py | 32 +- box_sdk_gen/managers/collections.py | 9 +- box_sdk_gen/managers/comments.py | 41 +- box_sdk_gen/managers/device_pinners.py | 21 +- box_sdk_gen/managers/downloads.py | 23 +- box_sdk_gen/managers/email_aliases.py | 17 +- box_sdk_gen/managers/events.py | 20 +- box_sdk_gen/managers/file_classifications.py | 64 +- box_sdk_gen/managers/file_metadata.py | 57 +- box_sdk_gen/managers/file_requests.py | 49 +- .../managers/file_version_legal_holds.py | 11 +- .../managers/file_version_retentions.py | 19 +- box_sdk_gen/managers/file_versions.py | 33 +- box_sdk_gen/managers/file_watermarks.py | 31 +- box_sdk_gen/managers/files.py | 98 +-- .../managers/folder_classifications.py | 64 +- box_sdk_gen/managers/folder_locks.py | 30 +- box_sdk_gen/managers/folder_metadata.py | 57 +- box_sdk_gen/managers/folder_watermarks.py | 33 +- box_sdk_gen/managers/folders.py | 154 +++-- box_sdk_gen/managers/groups.py | 50 +- box_sdk_gen/managers/integration_mappings.py | 40 +- box_sdk_gen/managers/invites.py | 24 +- box_sdk_gen/managers/legal_hold_policies.py | 17 +- .../managers/legal_hold_policy_assignments.py | 47 +- box_sdk_gen/managers/list_collaborations.py | 29 +- box_sdk_gen/managers/memberships.py | 61 +- .../managers/metadata_cascade_policies.py | 35 +- box_sdk_gen/managers/metadata_templates.py | 98 +-- box_sdk_gen/managers/recent_items.py | 6 +- box_sdk_gen/managers/retention_policies.py | 41 +- .../managers/retention_policy_assignments.py | 64 +- box_sdk_gen/managers/search.py | 81 +-- box_sdk_gen/managers/session_termination.py | 16 +- box_sdk_gen/managers/shared_links_files.py | 74 +- box_sdk_gen/managers/shared_links_folders.py | 68 +- .../managers/shared_links_web_links.py | 70 +- .../shield_information_barrier_reports.py | 17 +- ...eld_information_barrier_segment_members.py | 34 +- ...nformation_barrier_segment_restrictions.py | 46 +- .../shield_information_barrier_segments.py | 23 +- .../managers/shield_information_barriers.py | 34 +- box_sdk_gen/managers/sign_requests.py | 30 +- box_sdk_gen/managers/sign_templates.py | 16 +- box_sdk_gen/managers/skills.py | 86 +-- box_sdk_gen/managers/storage_policies.py | 9 +- .../managers/storage_policy_assignments.py | 66 +- box_sdk_gen/managers/task_assignments.py | 44 +- box_sdk_gen/managers/tasks.py | 61 +- .../terms_of_service_user_statuses.py | 53 +- box_sdk_gen/managers/terms_of_services.py | 52 +- box_sdk_gen/managers/transfer.py | 21 +- box_sdk_gen/managers/trashed_files.py | 30 +- box_sdk_gen/managers/trashed_folders.py | 28 +- box_sdk_gen/managers/trashed_items.py | 20 +- box_sdk_gen/managers/trashed_web_links.py | 28 +- box_sdk_gen/managers/uploads.py | 43 +- box_sdk_gen/managers/user_collaborations.py | 66 +- box_sdk_gen/managers/users.py | 64 +- box_sdk_gen/managers/web_links.py | 52 +- box_sdk_gen/managers/webhooks.py | 68 +- box_sdk_gen/managers/workflows.py | 61 +- box_sdk_gen/managers/zip_downloads.py | 30 +- box_sdk_gen/network.py | 21 +- box_sdk_gen/schemas.py | 642 +++++++++--------- docs/authorization.md | 137 +++- docs/chunked_uploads.md | 8 + docs/classifications.md | 16 +- docs/client.md | 13 + docs/collaboration_allowlist_entries.md | 2 +- .../collaboration_allowlist_exempt_targets.md | 4 +- docs/comments.md | 4 +- docs/device_pinners.md | 2 +- docs/events.md | 4 +- docs/file_classifications.md | 36 +- docs/file_metadata.md | 18 +- docs/file_requests.md | 8 +- docs/file_version_retentions.md | 2 +- docs/file_versions.md | 4 +- docs/file_watermarks.md | 4 +- docs/folder_classifications.md | 36 +- docs/folder_locks.md | 6 +- docs/folder_metadata.md | 18 +- docs/folder_watermarks.md | 4 +- docs/groups.md | 8 +- docs/integration_mappings.md | 20 +- docs/invites.md | 6 +- docs/legal_hold_policy_assignments.md | 4 +- docs/list_collaborations.md | 26 +- docs/memberships.md | 12 +- docs/metadata_cascade_policies.md | 10 +- docs/metadata_templates.md | 18 +- docs/retention_policies.md | 10 +- docs/retention_policy_assignments.md | 14 +- docs/search.md | 26 +- docs/session_termination.md | 8 +- docs/shared_links_files.md | 26 +- docs/shared_links_folders.md | 26 +- docs/shared_links_web_links.md | 26 +- docs/shield_information_barrier_reports.md | 18 +- ...eld_information_barrier_segment_members.md | 6 +- ...nformation_barrier_segment_restrictions.md | 8 +- docs/shield_information_barriers.md | 6 +- docs/skills.md | 34 +- docs/storage_policy_assignments.md | 8 +- docs/task_assignments.md | 6 +- docs/tasks.md | 12 +- docs/terms_of_service_user_statuses.md | 16 +- docs/terms_of_services.md | 24 +- docs/transfer.md | 4 +- docs/trashed_files.md | 10 +- docs/trashed_folders.md | 10 +- docs/trashed_items.md | 8 +- docs/trashed_web_links.md | 10 +- docs/user_collaborations.md | 14 +- docs/users.md | 12 +- docs/web_links.md | 10 +- docs/webhooks.md | 10 +- docs/workflows.md | 14 +- docs/zip_downloads.md | 8 +- pytest.ini | 2 +- test/auth.py | 20 +- test/classifications.py | 135 +--- .../collaboration_allowlist_exempt_targets.py | 4 +- test/collections.py | 8 +- test/comments.py | 20 +- test/commons.py | 108 ++- test/downloads.py | 8 +- test/file_classifications.py | 134 ++++ test/file_metadata.py | 30 +- test/file_requests.py | 8 +- test/file_versions.py | 16 +- test/file_watermarks.py | 16 +- test/files.py | 18 +- test/folder_classifications.py | 134 ++++ test/folder_locks.py | 8 +- test/folder_metadata.py | 28 +- test/folder_watermarks.py | 12 +- test/folders.py | 16 +- test/invites.py | 8 +- test/list_collaborations.py | 91 +++ test/memberships.py | 12 +- test/metadata_cascade_policies.py | 26 +- test/metadata_templates.py | 44 +- test/retention_policies.py | 14 +- test/search.py | 51 +- test/session_termination.py | 4 +- test/shared_links_files.py | 36 +- test/shared_links_folders.py | 34 +- test/shared_links_web_links.py | 32 +- test/shield_information_barrier_reports.py | 63 ++ ...eld_information_barrier_segment_members.py | 8 +- ...nformation_barrier_segment_restrictions.py | 20 +- test/shield_information_barriers.py | 6 +- test/skills.py | 33 +- test/tasks.py | 22 +- test/transfer.py | 4 +- test/trashed_files.py | 14 +- test/trashed_folders.py | 10 +- test/trashed_items.py | 2 +- test/trashed_web_links.py | 10 +- test/uploads.py | 12 +- test/user_collaborations.py | 37 +- test/webhooks.py | 16 +- test/weblinks.py | 8 +- test/zip_downloads.py | 30 +- 175 files changed, 3841 insertions(+), 2394 deletions(-) create mode 100644 box_sdk_gen/base_urls.py create mode 100644 test/file_classifications.py create mode 100644 test/folder_classifications.py create mode 100644 test/list_collaborations.py create mode 100644 test/shield_information_barrier_reports.py diff --git a/box_sdk_gen/auth.py b/box_sdk_gen/auth.py index 40d8429..d381a17 100644 --- a/box_sdk_gen/auth.py +++ b/box_sdk_gen/auth.py @@ -18,7 +18,5 @@ def retrieve_token( pass @abstractmethod - def refresh_token( - self, network_session: Optional[NetworkSession] = None - ) -> AccessToken: + def refresh_token(self, network_session: NetworkSession) -> AccessToken: pass diff --git a/box_sdk_gen/base_urls.py b/box_sdk_gen/base_urls.py new file mode 100644 index 0000000..0a0ae82 --- /dev/null +++ b/box_sdk_gen/base_urls.py @@ -0,0 +1,26 @@ +from typing import Dict + +from box_sdk_gen.base_object import BaseObject + + +class BaseUrls(BaseObject): + _fields_to_json_mapping: Dict[str, str] = { + 'oauth_2_url': 'oauth2_url', + **BaseObject._fields_to_json_mapping, + } + _json_to_fields_mapping: Dict[str, str] = { + 'oauth2_url': 'oauth_2_url', + **BaseObject._json_to_fields_mapping, + } + + def __init__( + self, + base_url: str = 'https://api.box.com/2.0', + upload_url: str = 'https://upload.box.com/api/2.0', + oauth_2_url: str = 'https://account.box.com/api/oauth2', + **kwargs + ): + super().__init__(**kwargs) + self.base_url = base_url + self.upload_url = upload_url + self.oauth_2_url = oauth_2_url diff --git a/box_sdk_gen/client.py b/box_sdk_gen/client.py index 148259c..d06af18 100644 --- a/box_sdk_gen/client.py +++ b/box_sdk_gen/client.py @@ -164,11 +164,13 @@ from box_sdk_gen.network import NetworkSession +from box_sdk_gen.base_urls import BaseUrls + class BoxClient: def __init__(self, auth: Authentication, network_session: NetworkSession = None): if network_session is None: - network_session = NetworkSession() + network_session = NetworkSession(base_urls=BaseUrls()) self.auth = auth self.network_session = network_session self.authorization = AuthorizationManager( @@ -388,9 +390,9 @@ def with_as_user_header(self, user_id: str) -> 'BoxClient': """ return BoxClient( auth=self.auth, - network_session=self.network_session.with_additional_headers({ - 'As-User': user_id - }), + network_session=self.network_session.with_additional_headers( + {'As-User': user_id} + ), ) def with_suppressed_notifications(self) -> 'BoxClient': @@ -399,9 +401,9 @@ def with_suppressed_notifications(self) -> 'BoxClient': """ return BoxClient( auth=self.auth, - network_session=self.network_session.with_additional_headers({ - 'Box-Notifications': 'off' - }), + network_session=self.network_session.with_additional_headers( + {'Box-Notifications': 'off'} + ), ) def with_extra_headers(self, extra_headers: Dict[str, str] = None) -> 'BoxClient': @@ -416,3 +418,14 @@ def with_extra_headers(self, extra_headers: Dict[str, str] = None) -> 'BoxClient auth=self.auth, network_session=self.network_session.with_additional_headers(extra_headers), ) + + def with_custom_base_urls(self, base_urls: BaseUrls) -> 'BoxClient': + """ + Create a new client with a custom set of base urls that will be used for every API call + :param base_urls: Custom set of base urls that will be used for every API call + :type base_urls: BaseUrls + """ + return BoxClient( + auth=self.auth, + network_session=self.network_session.with_custom_base_urls(base_urls), + ) diff --git a/box_sdk_gen/fetch.py b/box_sdk_gen/fetch.py index 11b00cb..75cd867 100644 --- a/box_sdk_gen/fetch.py +++ b/box_sdk_gen/fetch.py @@ -76,18 +76,16 @@ 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: diff --git a/box_sdk_gen/managers/authorization.py b/box_sdk_gen/managers/authorization.py index dcfeefc..a7d0acd 100644 --- a/box_sdk_gen/managers/authorization.py +++ b/box_sdk_gen/managers/authorization.py @@ -6,10 +6,20 @@ from box_sdk_gen.utils import to_string +from box_sdk_gen.serialization import serialize + +from box_sdk_gen.serialization import deserialize + from box_sdk_gen.schemas import AccessToken from box_sdk_gen.schemas import OAuth2Error +from box_sdk_gen.schemas import PostOAuth2Token + +from box_sdk_gen.schemas import PostOAuth2TokenRefreshAccessToken + +from box_sdk_gen.schemas import PostOAuth2Revoke + from box_sdk_gen.auth import Authentication from box_sdk_gen.network import NetworkSession @@ -28,23 +38,60 @@ from box_sdk_gen.fetch import FetchResponse +from box_sdk_gen.json_data import SerializedData + -class GetAuthorizeResponseTypeArg(str, Enum): +class AuthorizeUserResponseType(str, Enum): CODE = 'code' +class RequestAccessTokenGrantType(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' + ) + + +class RequestAccessTokenSubjectTokenType(str, Enum): + URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN = ( + 'urn:ietf:params:oauth:token-type:access_token' + ) + + +class RequestAccessTokenActorTokenType(str, Enum): + URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ID_TOKEN = ( + 'urn:ietf:params:oauth:token-type:id_token' + ) + + +class RequestAccessTokenBoxSubjectType(str, Enum): + ENTERPRISE = 'enterprise' + USER = 'user' + + +class RefreshAccessTokenGrantType(str, Enum): + REFRESH_TOKEN = 'refresh_token' + + class AuthorizationManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_authorize( + def authorize_user( self, - response_type: GetAuthorizeResponseTypeArg, + response_type: AuthorizeUserResponseType, client_id: str, redirect_uri: Optional[str] = None, state: Optional[str] = None, @@ -69,7 +116,7 @@ def get_authorize( format. :param response_type: The type of response we'd like to receive. - :type response_type: GetAuthorizeResponseTypeArg + :type response_type: AuthorizeUserResponseType :param client_id: The Client ID of the application that is requesting to authenticate the user. To get the Client ID for your application, log in to your Box developer console and click the **Edit Application** link for @@ -92,7 +139,7 @@ def get_authorize( can be used to identify a user on redirect, as well as protect against hijacked sessions and other exploits. :type state: Optional[str], optional - :param scope: A comma-separated list of application scopes you'd like to + :param scope: A space-separated list of application scopes you'd like to authenticate the user for. This defaults to all the scopes configured for the application in its configuration page. :type scope: Optional[str], optional @@ -110,7 +157,7 @@ def get_authorize( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://account.box.com/api/oauth2/authorize']), + ''.join([self.network_session.base_urls.oauth_2_url, '/authorize']), FetchOptions( method='GET', params=query_params_map, @@ -121,3 +168,236 @@ def get_authorize( ), ) return None + + def request_access_token( + self, + grant_type: RequestAccessTokenGrantType, + 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[RequestAccessTokenSubjectTokenType] = None, + actor_token: Optional[str] = None, + actor_token_type: Optional[RequestAccessTokenActorTokenType] = None, + scope: Optional[str] = None, + resource: Optional[str] = None, + box_subject_type: Optional[RequestAccessTokenBoxSubjectType] = None, + box_subject_id: Optional[str] = None, + box_shared_link: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> AccessToken: + """ + Request an Access Token using either a client-side obtained OAuth 2.0 + + authorization code or a server-side JWT assertion. + + + An Access Token is a string that enables Box to verify that a + + + request belongs to an authorized session. In the normal order of + + + operations you will begin by requesting authentication from the + + + [authorize](#get-authorize) endpoint and Box will send you an + + + authorization code. + + + You will then send this code to this endpoint to exchange it for + + + an Access Token. The returned Access Token can then be used to to make + + + Box API calls. + + :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 + grant or another access token for the purpose of downscoping a token. + :type grant_type: RequestAccessTokenGrantType + :param client_id: The Client ID of the application requesting an access token. + Used in combination with `authorization_code`, `client_credentials`, or + `urn:ietf:params:oauth:grant-type:jwt-bearer` as the `grant_type`. + :type client_id: Optional[str], optional + :param client_secret: The client secret of the application requesting an access token. + Used in combination with `authorization_code`, `client_credentials`, or + `urn:ietf:params:oauth:grant-type:jwt-bearer` as the `grant_type`. + :type client_secret: Optional[str], optional + :param code: The client-side authorization code passed to your application by + Box in the browser redirect after the user has successfully + granted your application permission to make API calls on their + behalf. + Used in combination with `authorization_code` as the `grant_type`. + :type code: Optional[str], optional + :param refresh_token: A refresh token used to get a new access token with. + Used in combination with `refresh_token` as the `grant_type`. + :type refresh_token: Optional[str], optional + :param assertion: A JWT assertion for which to request a new access token. + Used in combination with `urn:ietf:params:oauth:grant-type:jwt-bearer` + as the `grant_type`. + :type assertion: Optional[str], optional + :param subject_token: The token to exchange for a downscoped token. This can be a regular + access token, a JWT assertion, or an app token. + Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` + as the `grant_type`. + :type subject_token: Optional[str], optional + :param subject_token_type: The type of `subject_token` passed in. + Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` + as the `grant_type`. + :type subject_token_type: Optional[RequestAccessTokenSubjectTokenType], optional + :param actor_token: The token used to create an annotator token. + This is a JWT assertion. + Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` + as the `grant_type`. + :type actor_token: Optional[str], optional + :param actor_token_type: The type of `actor_token` passed in. + Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` + as the `grant_type`. + :type actor_token_type: Optional[RequestAccessTokenActorTokenType], optional + :param scope: The space-delimited list of scopes that you want apply to the + new access token. + The `subject_token` will need to have all of these scopes or + the call will error with **401 Unauthorized**. + :type scope: Optional[str], optional + :param resource: Full URL for the file that the token should be generated for. + :type resource: Optional[str], optional + :param box_subject_type: Used in combination with `client_credentials` as the `grant_type`. + :type box_subject_type: Optional[RequestAccessTokenBoxSubjectType], optional + :param box_subject_id: Used in combination with `client_credentials` as the `grant_type`. + Value is determined by `box_subject_type`. If `user` use user ID and if + `enterprise` use enterprise ID. + :type box_subject_id: Optional[str], optional + :param box_shared_link: Full URL of the shared link on the file or folder + that the token should be generated for. + :type box_shared_link: Optional[str], optional + :param extra_headers: Extra headers that will be included in the HTTP request. + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + request_body: Dict = { + 'grant_type': grant_type, + 'client_id': client_id, + 'client_secret': client_secret, + 'code': code, + 'refresh_token': refresh_token, + 'assertion': assertion, + 'subject_token': subject_token, + 'subject_token_type': subject_token_type, + 'actor_token': actor_token, + 'actor_token_type': actor_token_type, + 'scope': scope, + 'resource': resource, + 'box_subject_type': box_subject_type, + 'box_subject_id': box_subject_id, + 'box_shared_link': box_shared_link, + } + headers_map: Dict[str, str] = prepare_params({**extra_headers}) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/oauth2/token']), + FetchOptions( + method='POST', + headers=headers_map, + data=serialize(request_body), + content_type='application/x-www-form-urlencoded', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return deserialize(response.data, AccessToken) + + def refresh_access_token( + self, + grant_type: RefreshAccessTokenGrantType, + client_id: str, + client_secret: str, + refresh_token: str, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> AccessToken: + """ + Refresh an Access Token using its client ID, secret, and refresh token. + :param grant_type: The type of request being made, in this case a refresh request. + :type grant_type: RefreshAccessTokenGrantType + :param client_id: The client ID of the application requesting to refresh the token. + :type client_id: str + :param client_secret: The client secret of the application requesting to refresh the token. + :type client_secret: str + :param refresh_token: The refresh token to refresh. + :type refresh_token: str + :param extra_headers: Extra headers that will be included in the HTTP request. + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + request_body: Dict = { + 'grant_type': grant_type, + 'client_id': client_id, + 'client_secret': client_secret, + 'refresh_token': refresh_token, + } + headers_map: Dict[str, str] = prepare_params({**extra_headers}) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/oauth2/token#refresh']), + FetchOptions( + method='POST', + headers=headers_map, + data=serialize(request_body), + content_type='application/x-www-form-urlencoded', + response_format='json', + auth=self.auth, + network_session=self.network_session, + ), + ) + return deserialize(response.data, AccessToken) + + def revoke_access_token( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + token: Optional[str] = None, + extra_headers: Optional[Dict[str, Optional[str]]] = None, + ) -> None: + """ + Revoke an active Access Token, effectively logging a user out + + that has been previously authenticated. + + :param client_id: The Client ID of the application requesting to revoke the + access token. + :type client_id: Optional[str], optional + :param client_secret: The client secret of the application requesting to revoke + an access token. + :type client_secret: Optional[str], optional + :param token: The access token to revoke. + :type token: Optional[str], optional + :param extra_headers: Extra headers that will be included in the HTTP request. + :type extra_headers: Optional[Dict[str, Optional[str]]], optional + """ + if extra_headers is None: + extra_headers = {} + request_body: Dict = { + 'client_id': client_id, + 'client_secret': client_secret, + 'token': token, + } + headers_map: Dict[str, str] = prepare_params({**extra_headers}) + response: FetchResponse = fetch( + ''.join(['https://api.box.com/oauth2/revoke']), + FetchOptions( + method='POST', + headers=headers_map, + data=serialize(request_body), + content_type='application/x-www-form-urlencoded', + 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 f3e37c3..763e8d0 100644 --- a/box_sdk_gen/managers/avatars.py +++ b/box_sdk_gen/managers/avatars.py @@ -37,8 +37,10 @@ class AvatarsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -57,7 +59,12 @@ def get_user_avatar( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/users/', to_string(user_id), '/avatar']), + ''.join([ + self.network_session.base_urls.base_url, + '/users/', + to_string(user_id), + '/avatar', + ]), FetchOptions( method='GET', headers=headers_map, @@ -97,7 +104,12 @@ def create_user_avatar( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/users/', to_string(user_id), '/avatar']), + ''.join([ + self.network_session.base_urls.base_url, + '/users/', + to_string(user_id), + '/avatar', + ]), FetchOptions( method='POST', headers=headers_map, @@ -135,7 +147,12 @@ def delete_user_avatar( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/users/', to_string(user_id), '/avatar']), + ''.join([ + self.network_session.base_urls.base_url, + '/users/', + to_string(user_id), + '/avatar', + ]), FetchOptions( method='DELETE', headers=headers_map, diff --git a/box_sdk_gen/managers/chunked_uploads.py b/box_sdk_gen/managers/chunked_uploads.py index 2cc2a56..b7dd170 100644 --- a/box_sdk_gen/managers/chunked_uploads.py +++ b/box_sdk_gen/managers/chunked_uploads.py @@ -14,6 +14,8 @@ from box_sdk_gen.utils import HashName +from box_sdk_gen.schemas import FileFull + from box_sdk_gen.utils import Iterator from box_sdk_gen.schemas import UploadSession @@ -85,8 +87,10 @@ class ChunkedUploadsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -117,7 +121,9 @@ def create_file_upload_session( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://upload.box.com/api/2.0/files/upload_sessions']), + ''.join( + [self.network_session.base_urls.upload_url, '/files/upload_sessions'] + ), FetchOptions( method='POST', headers=headers_map, @@ -160,7 +166,8 @@ def create_file_upload_session_for_existing_file( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://upload.box.com/api/2.0/files/', + self.network_session.base_urls.upload_url, + '/files/', to_string(file_id), '/upload_sessions', ]), @@ -194,7 +201,8 @@ def get_file_upload_session_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://upload.box.com/api/2.0/files/upload_sessions/', + self.network_session.base_urls.upload_url, + '/files/upload_sessions/', to_string(upload_session_id), ]), FetchOptions( @@ -254,7 +262,8 @@ def upload_file_part( }) response: FetchResponse = fetch( ''.join([ - 'https://upload.box.com/api/2.0/files/upload_sessions/', + self.network_session.base_urls.upload_url, + '/files/upload_sessions/', to_string(upload_session_id), ]), FetchOptions( @@ -290,7 +299,8 @@ def delete_file_upload_session_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://upload.box.com/api/2.0/files/upload_sessions/', + self.network_session.base_urls.upload_url, + '/files/upload_sessions/', to_string(upload_session_id), ]), FetchOptions( @@ -330,13 +340,14 @@ def get_file_upload_session_parts( """ 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/', + self.network_session.base_urls.upload_url, + '/files/upload_sessions/', to_string(upload_session_id), '/parts', ]), @@ -403,7 +414,8 @@ def create_file_upload_session_commit( }) response: FetchResponse = fetch( ''.join([ - 'https://upload.box.com/api/2.0/files/upload_sessions/', + self.network_session.base_urls.upload_url, + '/files/upload_sessions/', to_string(upload_session_id), '/commit', ]), @@ -419,7 +431,7 @@ def create_file_upload_session_commit( ) return deserialize(response.data, Files) - def reducer(self, acc: PartAccumulator, chunk: ByteStream): + def reducer(self, acc: PartAccumulator, chunk: ByteStream) -> PartAccumulator: last_index: int = acc.last_index parts: List[UploadPart] = acc.parts chunk_buffer: Buffer = read_byte_stream(chunk) @@ -460,7 +472,7 @@ def reducer(self, acc: PartAccumulator, chunk: ByteStream): def upload_big_file( self, file: ByteStream, file_name: str, file_size: int, parent_folder_id: str - ): + ) -> FileFull: """ Starts the process of chunk uploading a big file. Should return a File object representing uploaded file. :param file: The stream of the file to upload. diff --git a/box_sdk_gen/managers/classifications.py b/box_sdk_gen/managers/classifications.py index dddfb67..159b237 100644 --- a/box_sdk_gen/managers/classifications.py +++ b/box_sdk_gen/managers/classifications.py @@ -35,17 +35,15 @@ from box_sdk_gen.json_data import SerializedData -class AddClassificationRequestBodyArgOpField(str, Enum): +class AddClassificationRequestBodyOpField(str, Enum): ADDENUMOPTION = 'addEnumOption' -class AddClassificationRequestBodyArgFieldKeyField(str, Enum): +class AddClassificationRequestBodyFieldKeyField(str, Enum): BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key' -class AddClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField( - BaseObject -): +class AddClassificationRequestBodyDataStaticConfigClassificationField(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'classification_definition': 'classificationDefinition', 'color_id': 'colorID', @@ -86,23 +84,23 @@ def __init__( self.color_id = color_id -class AddClassificationRequestBodyArgDataFieldStaticConfigField(BaseObject): +class AddClassificationRequestBodyDataStaticConfigField(BaseObject): def __init__( self, classification: Optional[ - AddClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField + AddClassificationRequestBodyDataStaticConfigClassificationField ] = None, **kwargs ): """ :param classification: Additional details for the classification. - :type classification: Optional[AddClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField], optional + :type classification: Optional[AddClassificationRequestBodyDataStaticConfigClassificationField], optional """ super().__init__(**kwargs) self.classification = classification -class AddClassificationRequestBodyArgDataField(BaseObject): +class AddClassificationRequestBodyDataField(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'static_config': 'staticConfig', **BaseObject._fields_to_json_mapping, @@ -116,7 +114,7 @@ def __init__( self, key: str, static_config: Optional[ - AddClassificationRequestBodyArgDataFieldStaticConfigField + AddClassificationRequestBodyDataStaticConfigField ] = None, **kwargs ): @@ -126,14 +124,14 @@ def __init__( add a classification. :type key: str :param static_config: A static configuration for the classification. - :type static_config: Optional[AddClassificationRequestBodyArgDataFieldStaticConfigField], optional + :type static_config: Optional[AddClassificationRequestBodyDataStaticConfigField], optional """ super().__init__(**kwargs) self.key = key self.static_config = static_config -class AddClassificationRequestBodyArg(BaseObject): +class AddClassificationRequestBody(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'field_key': 'fieldKey', **BaseObject._fields_to_json_mapping, @@ -145,20 +143,20 @@ class AddClassificationRequestBodyArg(BaseObject): def __init__( self, - op: AddClassificationRequestBodyArgOpField, - field_key: AddClassificationRequestBodyArgFieldKeyField, - data: AddClassificationRequestBodyArgDataField, + op: AddClassificationRequestBodyOpField, + field_key: AddClassificationRequestBodyFieldKeyField, + data: AddClassificationRequestBodyDataField, **kwargs ): """ :param op: The type of change to perform on the classification object. - :type op: AddClassificationRequestBodyArgOpField + :type op: AddClassificationRequestBodyOpField :param field_key: Defines classifications available in the enterprise. - :type field_key: AddClassificationRequestBodyArgFieldKeyField + :type field_key: AddClassificationRequestBodyFieldKeyField :param data: The details of the classification to add. - :type data: AddClassificationRequestBodyArgDataField + :type data: AddClassificationRequestBodyDataField """ super().__init__(**kwargs) self.op = op @@ -166,17 +164,15 @@ def __init__( self.data = data -class UpdateClassificationRequestBodyArgOpField(str, Enum): +class UpdateClassificationRequestBodyOpField(str, Enum): EDITENUMOPTION = 'editEnumOption' -class UpdateClassificationRequestBodyArgFieldKeyField(str, Enum): +class UpdateClassificationRequestBodyFieldKeyField(str, Enum): BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key' -class UpdateClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField( - BaseObject -): +class UpdateClassificationRequestBodyDataStaticConfigClassificationField(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'classification_definition': 'classificationDefinition', 'color_id': 'colorID', @@ -217,23 +213,23 @@ def __init__( self.color_id = color_id -class UpdateClassificationRequestBodyArgDataFieldStaticConfigField(BaseObject): +class UpdateClassificationRequestBodyDataStaticConfigField(BaseObject): def __init__( self, classification: Optional[ - UpdateClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField + UpdateClassificationRequestBodyDataStaticConfigClassificationField ] = None, **kwargs ): """ :param classification: Additional details for the classification. - :type classification: Optional[UpdateClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField], optional + :type classification: Optional[UpdateClassificationRequestBodyDataStaticConfigClassificationField], optional """ super().__init__(**kwargs) self.classification = classification -class UpdateClassificationRequestBodyArgDataField(BaseObject): +class UpdateClassificationRequestBodyDataField(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'static_config': 'staticConfig', **BaseObject._fields_to_json_mapping, @@ -247,7 +243,7 @@ def __init__( self, key: str, static_config: Optional[ - UpdateClassificationRequestBodyArgDataFieldStaticConfigField + UpdateClassificationRequestBodyDataStaticConfigField ] = None, **kwargs ): @@ -256,14 +252,14 @@ def __init__( shown in the web and mobile interfaces. :type key: str :param static_config: A static configuration for the classification. - :type static_config: Optional[UpdateClassificationRequestBodyArgDataFieldStaticConfigField], optional + :type static_config: Optional[UpdateClassificationRequestBodyDataStaticConfigField], optional """ super().__init__(**kwargs) self.key = key self.static_config = static_config -class UpdateClassificationRequestBodyArg(BaseObject): +class UpdateClassificationRequestBody(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'field_key': 'fieldKey', 'enum_option_key': 'enumOptionKey', @@ -277,23 +273,23 @@ class UpdateClassificationRequestBodyArg(BaseObject): def __init__( self, - op: UpdateClassificationRequestBodyArgOpField, - field_key: UpdateClassificationRequestBodyArgFieldKeyField, + op: UpdateClassificationRequestBodyOpField, + field_key: UpdateClassificationRequestBodyFieldKeyField, enum_option_key: str, - data: UpdateClassificationRequestBodyArgDataField, + data: UpdateClassificationRequestBodyDataField, **kwargs ): """ :param op: The type of change to perform on the classification object. - :type op: UpdateClassificationRequestBodyArgOpField + :type op: UpdateClassificationRequestBodyOpField :param field_key: Defines classifications available in the enterprise. - :type field_key: UpdateClassificationRequestBodyArgFieldKeyField + :type field_key: UpdateClassificationRequestBodyFieldKeyField :param enum_option_key: The original label of the classification to change. :type enum_option_key: str :param data: The details of the updated classification. - :type data: UpdateClassificationRequestBodyArgDataField + :type data: UpdateClassificationRequestBodyDataField """ super().__init__(**kwargs) self.op = op @@ -302,31 +298,31 @@ def __init__( self.data = data -class CreateClassificationTemplateScopeArg(str, Enum): +class CreateClassificationTemplateScope(str, Enum): ENTERPRISE = 'enterprise' -class CreateClassificationTemplateTemplateKeyArg(str, Enum): +class CreateClassificationTemplateTemplateKey(str, Enum): SECURITYCLASSIFICATION_6VMVOCHWUWO = 'securityClassification-6VMVochwUWo' -class CreateClassificationTemplateDisplayNameArg(str, Enum): +class CreateClassificationTemplateDisplayName(str, Enum): CLASSIFICATION = 'Classification' -class CreateClassificationTemplateFieldsArgTypeField(str, Enum): +class CreateClassificationTemplateFieldsTypeField(str, Enum): ENUM = 'enum' -class CreateClassificationTemplateFieldsArgKeyField(str, Enum): +class CreateClassificationTemplateFieldsKeyField(str, Enum): BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key' -class CreateClassificationTemplateFieldsArgDisplayNameField(str, Enum): +class CreateClassificationTemplateFieldsDisplayNameField(str, Enum): CLASSIFICATION = 'Classification' -class CreateClassificationTemplateFieldsArgOptionsFieldStaticConfigFieldClassificationField( +class CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField( BaseObject ): _fields_to_json_mapping: Dict[str, str] = { @@ -369,23 +365,23 @@ def __init__( self.color_id = color_id -class CreateClassificationTemplateFieldsArgOptionsFieldStaticConfigField(BaseObject): +class CreateClassificationTemplateFieldsOptionsStaticConfigField(BaseObject): def __init__( self, classification: Optional[ - CreateClassificationTemplateFieldsArgOptionsFieldStaticConfigFieldClassificationField + CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField ] = None, **kwargs ): """ :param classification: Additional information about the classification. - :type classification: Optional[CreateClassificationTemplateFieldsArgOptionsFieldStaticConfigFieldClassificationField], optional + :type classification: Optional[CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField], optional """ super().__init__(**kwargs) self.classification = classification -class CreateClassificationTemplateFieldsArgOptionsField(BaseObject): +class CreateClassificationTemplateFieldsOptionsField(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'static_config': 'staticConfig', **BaseObject._fields_to_json_mapping, @@ -399,7 +395,7 @@ def __init__( self, key: str, static_config: Optional[ - CreateClassificationTemplateFieldsArgOptionsFieldStaticConfigField + CreateClassificationTemplateFieldsOptionsStaticConfigField ] = None, **kwargs ): @@ -408,14 +404,14 @@ def __init__( will be show in the Box UI. :type key: str :param static_config: Additional information about the classification. - :type static_config: Optional[CreateClassificationTemplateFieldsArgOptionsFieldStaticConfigField], optional + :type static_config: Optional[CreateClassificationTemplateFieldsOptionsStaticConfigField], optional """ super().__init__(**kwargs) self.key = key self.static_config = static_config -class CreateClassificationTemplateFieldsArg(BaseObject): +class CreateClassificationTemplateFields(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'display_name': 'displayName', **BaseObject._fields_to_json_mapping, @@ -427,25 +423,25 @@ class CreateClassificationTemplateFieldsArg(BaseObject): def __init__( self, - type: CreateClassificationTemplateFieldsArgTypeField, - key: CreateClassificationTemplateFieldsArgKeyField, - display_name: CreateClassificationTemplateFieldsArgDisplayNameField, - options: List[CreateClassificationTemplateFieldsArgOptionsField], + type: CreateClassificationTemplateFieldsTypeField, + key: CreateClassificationTemplateFieldsKeyField, + display_name: CreateClassificationTemplateFieldsDisplayNameField, + options: List[CreateClassificationTemplateFieldsOptionsField], hidden: Optional[bool] = None, **kwargs ): """ :param type: The type of the field that is always enum. - :type type: CreateClassificationTemplateFieldsArgTypeField + :type type: CreateClassificationTemplateFieldsTypeField :param key: Defines classifications available in the enterprise. - :type key: CreateClassificationTemplateFieldsArgKeyField + :type key: CreateClassificationTemplateFieldsKeyField :param display_name: A display name for the classification. - :type display_name: CreateClassificationTemplateFieldsArgDisplayNameField + :type display_name: CreateClassificationTemplateFieldsDisplayNameField :param options: The actual list of classifications that are present on this template. - :type options: List[CreateClassificationTemplateFieldsArgOptionsField] + :type options: List[CreateClassificationTemplateFieldsOptionsField] :param hidden: Determines if the classification template is hidden or available on @@ -465,8 +461,10 @@ class ClassificationsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -495,7 +493,8 @@ def get_classification_template( 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' + self.network_session.base_urls.base_url, + '/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema', ]), FetchOptions( method='GET', @@ -509,7 +508,7 @@ def get_classification_template( def add_classification( self, - request_body: List[AddClassificationRequestBodyArg], + request_body: List[AddClassificationRequestBody], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> ClassificationTemplate: """ @@ -527,7 +526,7 @@ def add_classification( `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`. :param request_body: Request body of addClassification method - :type request_body: List[AddClassificationRequestBodyArg] + :type request_body: List[AddClassificationRequestBody] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -536,7 +535,8 @@ def add_classification( 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' + self.network_session.base_urls.base_url, + '/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#add', ]), FetchOptions( method='PUT', @@ -552,7 +552,7 @@ def add_classification( def update_classification( self, - request_body: List[UpdateClassificationRequestBodyArg], + request_body: List[UpdateClassificationRequestBody], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> ClassificationTemplate: """ @@ -570,7 +570,7 @@ def update_classification( `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`. :param request_body: Request body of updateClassification method - :type request_body: List[UpdateClassificationRequestBodyArg] + :type request_body: List[UpdateClassificationRequestBody] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -579,7 +579,8 @@ def update_classification( 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' + self.network_session.base_urls.base_url, + '/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#update', ]), FetchOptions( method='PUT', @@ -595,10 +596,10 @@ def update_classification( def create_classification_template( self, - scope: CreateClassificationTemplateScopeArg, - template_key: CreateClassificationTemplateTemplateKeyArg, - display_name: CreateClassificationTemplateDisplayNameArg, - fields: List[CreateClassificationTemplateFieldsArg], + scope: CreateClassificationTemplateScope, + template_key: CreateClassificationTemplateTemplateKey, + display_name: CreateClassificationTemplateDisplayName, + fields: List[CreateClassificationTemplateFields], hidden: Optional[bool] = None, copy_instance_on_item_copy: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -623,16 +624,16 @@ def create_classification_template( :param scope: The scope in which to create the classifications. This should be `enterprise` or `enterprise_{id}` where `id` is the unique ID of the enterprise. - :type scope: CreateClassificationTemplateScopeArg + :type scope: CreateClassificationTemplateScope :param template_key: Defines the list of metadata templates. - :type template_key: CreateClassificationTemplateTemplateKeyArg + :type template_key: CreateClassificationTemplateTemplateKey :param display_name: The name of the template as shown in web and mobile interfaces. - :type display_name: CreateClassificationTemplateDisplayNameArg + :type display_name: CreateClassificationTemplateDisplayName :param fields: The classification template requires exactly one field, which holds all the valid classification values. - :type fields: List[CreateClassificationTemplateFieldsArg] + :type fields: List[CreateClassificationTemplateFields] :param hidden: Determines if the classification template is hidden or available on web and mobile devices. @@ -657,7 +658,8 @@ def create_classification_template( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/metadata_templates/schema#classifications' + self.network_session.base_urls.base_url, + '/metadata_templates/schema#classifications', ]), FetchOptions( method='POST', diff --git a/box_sdk_gen/managers/collaboration_allowlist_entries.py b/box_sdk_gen/managers/collaboration_allowlist_entries.py index 9c9013b..014ff71 100644 --- a/box_sdk_gen/managers/collaboration_allowlist_entries.py +++ b/box_sdk_gen/managers/collaboration_allowlist_entries.py @@ -37,7 +37,7 @@ from box_sdk_gen.json_data import SerializedData -class CreateCollaborationWhitelistEntryDirectionArg(str, Enum): +class CreateCollaborationWhitelistEntryDirection(str, Enum): INBOUND = 'inbound' OUTBOUND = 'outbound' BOTH = 'both' @@ -47,8 +47,10 @@ class CollaborationAllowlistEntriesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -74,12 +76,15 @@ def get_collaboration_whitelist_entries( """ 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']), + ''.join([ + self.network_session.base_urls.base_url, + '/collaboration_whitelist_entries', + ]), FetchOptions( method='GET', params=query_params_map, @@ -94,7 +99,7 @@ def get_collaboration_whitelist_entries( def create_collaboration_whitelist_entry( self, domain: str, - direction: CreateCollaborationWhitelistEntryDirectionArg, + direction: CreateCollaborationWhitelistEntryDirection, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> CollaborationAllowlistEntry: """ @@ -105,7 +110,7 @@ def create_collaboration_whitelist_entry( :param domain: The domain to add to the list of allowed domains. :type domain: str :param direction: The direction in which to allow collaborations. - :type direction: CreateCollaborationWhitelistEntryDirectionArg + :type direction: CreateCollaborationWhitelistEntryDirection :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -114,7 +119,10 @@ def create_collaboration_whitelist_entry( request_body: Dict = {'domain': domain, 'direction': direction} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/collaboration_whitelist_entries']), + ''.join([ + self.network_session.base_urls.base_url, + '/collaboration_whitelist_entries', + ]), FetchOptions( method='POST', headers=headers_map, @@ -148,7 +156,8 @@ def get_collaboration_whitelist_entry_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/collaboration_whitelist_entries/', + self.network_session.base_urls.base_url, + '/collaboration_whitelist_entries/', to_string(collaboration_whitelist_entry_id), ]), FetchOptions( @@ -182,7 +191,8 @@ def delete_collaboration_whitelist_entry_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/collaboration_whitelist_entries/', + self.network_session.base_urls.base_url, + '/collaboration_whitelist_entries/', to_string(collaboration_whitelist_entry_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py b/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py index 4f0e3ed..58c13b5 100644 --- a/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py +++ b/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py @@ -37,7 +37,7 @@ from box_sdk_gen.json_data import SerializedData -class CreateCollaborationWhitelistExemptTargetUserArg(BaseObject): +class CreateCollaborationWhitelistExemptTargetUser(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of the user to exempt. @@ -51,8 +51,10 @@ class CollaborationAllowlistExemptTargetsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -78,12 +80,15 @@ def get_collaboration_whitelist_exempt_targets( """ 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']), + ''.join([ + self.network_session.base_urls.base_url, + '/collaboration_whitelist_exempt_targets', + ]), FetchOptions( method='GET', params=query_params_map, @@ -97,7 +102,7 @@ def get_collaboration_whitelist_exempt_targets( def create_collaboration_whitelist_exempt_target( self, - user: CreateCollaborationWhitelistExemptTargetUserArg, + user: CreateCollaborationWhitelistExemptTargetUser, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> CollaborationAllowlistExemptTarget: """ @@ -106,7 +111,7 @@ def create_collaboration_whitelist_exempt_target( for collaborations. :param user: The user to exempt. - :type user: CreateCollaborationWhitelistExemptTargetUserArg + :type user: CreateCollaborationWhitelistExemptTargetUser :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -115,7 +120,10 @@ def create_collaboration_whitelist_exempt_target( request_body: Dict = {'user': user} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/collaboration_whitelist_exempt_targets']), + ''.join([ + self.network_session.base_urls.base_url, + '/collaboration_whitelist_exempt_targets', + ]), FetchOptions( method='POST', headers=headers_map, @@ -149,7 +157,8 @@ def get_collaboration_whitelist_exempt_target_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/collaboration_whitelist_exempt_targets/', + self.network_session.base_urls.base_url, + '/collaboration_whitelist_exempt_targets/', to_string(collaboration_whitelist_exempt_target_id), ]), FetchOptions( @@ -183,7 +192,8 @@ def delete_collaboration_whitelist_exempt_target_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/collaboration_whitelist_exempt_targets/', + self.network_session.base_urls.base_url, + '/collaboration_whitelist_exempt_targets/', to_string(collaboration_whitelist_exempt_target_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/collections.py b/box_sdk_gen/managers/collections.py index d23c824..83dc47a 100644 --- a/box_sdk_gen/managers/collections.py +++ b/box_sdk_gen/managers/collections.py @@ -39,8 +39,10 @@ class CollectionsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -87,7 +89,7 @@ def get_collections( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/collections']), + ''.join([self.network_session.base_urls.base_url, '/collections']), FetchOptions( method='GET', params=query_params_map, @@ -144,7 +146,8 @@ def get_collection_items( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/collections/', + self.network_session.base_urls.base_url, + '/collections/', to_string(collection_id), '/items', ]), diff --git a/box_sdk_gen/managers/comments.py b/box_sdk_gen/managers/comments.py index 9bc17dd..d4121fb 100644 --- a/box_sdk_gen/managers/comments.py +++ b/box_sdk_gen/managers/comments.py @@ -41,18 +41,18 @@ from box_sdk_gen.json_data import SerializedData -class CreateCommentItemArgTypeField(str, Enum): +class CreateCommentItemTypeField(str, Enum): FILE = 'file' COMMENT = 'comment' -class CreateCommentItemArg(BaseObject): - def __init__(self, id: str, type: CreateCommentItemArgTypeField, **kwargs): +class CreateCommentItem(BaseObject): + def __init__(self, id: str, type: CreateCommentItemTypeField, **kwargs): """ :param id: The ID of the item :type id: str :param type: The type of the item that this comment will be placed on. - :type type: CreateCommentItemArgTypeField + :type type: CreateCommentItemTypeField """ super().__init__(**kwargs) self.id = id @@ -63,8 +63,10 @@ class CommentsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -115,7 +117,10 @@ def get_file_comments( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '/comments' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/comments', ]), FetchOptions( method='GET', @@ -159,7 +164,11 @@ def get_comment_by_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/comments/', to_string(comment_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/comments/', + to_string(comment_id), + ]), FetchOptions( method='GET', params=query_params_map, @@ -203,7 +212,11 @@ def update_comment_by_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/comments/', to_string(comment_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/comments/', + to_string(comment_id), + ]), FetchOptions( method='PUT', params=query_params_map, @@ -232,7 +245,11 @@ def delete_comment_by_id( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/comments/', to_string(comment_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/comments/', + to_string(comment_id), + ]), FetchOptions( method='DELETE', headers=headers_map, @@ -246,7 +263,7 @@ def delete_comment_by_id( def create_comment( self, message: str, - item: CreateCommentItemArg, + item: CreateCommentItem, tagged_message: Optional[str] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -261,7 +278,7 @@ def create_comment( parameter instead. :type message: str :param item: The item to attach the comment to. - :type item: CreateCommentItemArg + :type item: CreateCommentItem :param tagged_message: 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 @@ -294,7 +311,7 @@ def create_comment( 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']), + ''.join([self.network_session.base_urls.base_url, '/comments']), FetchOptions( method='POST', params=query_params_map, diff --git a/box_sdk_gen/managers/device_pinners.py b/box_sdk_gen/managers/device_pinners.py index 31783af..154af60 100644 --- a/box_sdk_gen/managers/device_pinners.py +++ b/box_sdk_gen/managers/device_pinners.py @@ -35,7 +35,7 @@ from box_sdk_gen.json_data import SerializedData -class GetEnterpriseDevicePinnersDirectionArg(str, Enum): +class GetEnterpriseDevicePinnersDirection(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -44,8 +44,10 @@ class DevicePinnersManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -67,7 +69,9 @@ def get_device_pinner_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/device_pinners/', to_string(device_pinner_id) + self.network_session.base_urls.base_url, + '/device_pinners/', + to_string(device_pinner_id), ]), FetchOptions( method='GET', @@ -97,7 +101,9 @@ def delete_device_pinner_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/device_pinners/', to_string(device_pinner_id) + self.network_session.base_urls.base_url, + '/device_pinners/', + to_string(device_pinner_id), ]), FetchOptions( method='DELETE', @@ -114,7 +120,7 @@ def get_enterprise_device_pinners( enterprise_id: str, marker: Optional[str] = None, limit: Optional[int] = None, - direction: Optional[GetEnterpriseDevicePinnersDirectionArg] = None, + direction: Optional[GetEnterpriseDevicePinnersDirection] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> DevicePinners: """ @@ -136,7 +142,7 @@ def get_enterprise_device_pinners( :type limit: Optional[int], optional :param direction: The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order. - :type direction: Optional[GetEnterpriseDevicePinnersDirectionArg], optional + :type direction: Optional[GetEnterpriseDevicePinnersDirection], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -150,7 +156,8 @@ def get_enterprise_device_pinners( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/enterprises/', + self.network_session.base_urls.base_url, + '/enterprises/', to_string(enterprise_id), '/device_pinners', ]), diff --git a/box_sdk_gen/managers/downloads.py b/box_sdk_gen/managers/downloads.py index 7278e3d..a49724a 100644 --- a/box_sdk_gen/managers/downloads.py +++ b/box_sdk_gen/managers/downloads.py @@ -29,8 +29,10 @@ class DownloadsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -75,14 +77,19 @@ def download_file( """ 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 - }) + 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/', to_string(file_id), '/content']), + ''.join([ + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/content', + ]), FetchOptions( method='GET', params=query_params_map, diff --git a/box_sdk_gen/managers/email_aliases.py b/box_sdk_gen/managers/email_aliases.py index 0396cb6..cc8b5fb 100644 --- a/box_sdk_gen/managers/email_aliases.py +++ b/box_sdk_gen/managers/email_aliases.py @@ -39,8 +39,10 @@ class EmailAliasesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -63,7 +65,10 @@ def get_user_email_aliases( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/users/', to_string(user_id), '/email_aliases' + self.network_session.base_urls.base_url, + '/users/', + to_string(user_id), + '/email_aliases', ]), FetchOptions( method='GET', @@ -102,7 +107,10 @@ def create_user_email_alias( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/users/', to_string(user_id), '/email_aliases' + self.network_session.base_urls.base_url, + '/users/', + to_string(user_id), + '/email_aliases', ]), FetchOptions( method='POST', @@ -138,7 +146,8 @@ def delete_user_email_alias_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/users/', + self.network_session.base_urls.base_url, + '/users/', to_string(user_id), '/email_aliases/', to_string(email_alias_id), diff --git a/box_sdk_gen/managers/events.py b/box_sdk_gen/managers/events.py index 8255e24..e05bd2e 100644 --- a/box_sdk_gen/managers/events.py +++ b/box_sdk_gen/managers/events.py @@ -37,7 +37,7 @@ from box_sdk_gen.json_data import SerializedData -class GetEventsStreamTypeArg(str, Enum): +class GetEventsStreamType(str, Enum): ALL = 'all' CHANGES = 'changes' SYNC = 'sync' @@ -45,7 +45,7 @@ class GetEventsStreamTypeArg(str, Enum): ADMIN_LOGS_STREAMING = 'admin_logs_streaming' -class GetEventsEventTypeArg(str, Enum): +class GetEventsEventType(str, Enum): ACCESS_GRANTED = 'ACCESS_GRANTED' ACCESS_REVOKED = 'ACCESS_REVOKED' ADD_DEVICE_ASSOCIATION = 'ADD_DEVICE_ASSOCIATION' @@ -179,17 +179,19 @@ class EventsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def get_events( self, - stream_type: Optional[GetEventsStreamTypeArg] = None, + stream_type: Optional[GetEventsStreamType] = None, stream_position: Optional[str] = None, limit: Optional[int] = None, - event_type: Optional[List[GetEventsEventTypeArg]] = None, + event_type: Optional[List[GetEventsEventType]] = None, created_after: Optional[str] = None, created_before: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -235,7 +237,7 @@ def get_events( the enterprise. Latency will be much lower than `admin_logs`, but events will not be returned in chronological order and may contain duplicates. - :type stream_type: Optional[GetEventsStreamTypeArg], optional + :type stream_type: Optional[GetEventsStreamType], optional :param stream_position: 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. @@ -252,7 +254,7 @@ def get_events( requesting the events with a `stream_type` of `admin_logs` or `adming_logs_streaming`. For any other `stream_type` this value will be ignored. - :type event_type: Optional[List[GetEventsEventTypeArg]], optional + :type event_type: Optional[List[GetEventsEventType]], optional :param created_after: The lower bound date and time to return events for. This can only be used when requesting the events with a `stream_type` of `admin_logs`. For any other `stream_type` this value will be ignored. @@ -276,7 +278,7 @@ def get_events( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/events']), + ''.join([self.network_session.base_urls.base_url, '/events']), FetchOptions( method='GET', params=query_params_map, @@ -372,7 +374,7 @@ def get_events_with_long_polling( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/events']), + ''.join([self.network_session.base_urls.base_url, '/events']), FetchOptions( method='OPTIONS', headers=headers_map, diff --git a/box_sdk_gen/managers/file_classifications.py b/box_sdk_gen/managers/file_classifications.py index 60069f1..12c813b 100644 --- a/box_sdk_gen/managers/file_classifications.py +++ b/box_sdk_gen/managers/file_classifications.py @@ -1,9 +1,9 @@ from enum import Enum -from typing import Optional - from box_sdk_gen.base_object import BaseObject +from typing import Optional + from typing import Dict from box_sdk_gen.utils import to_string @@ -39,42 +39,34 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgOpField( - str, Enum -): +class UpdateClassificationOnFileRequestBodyOpField(str, Enum): REPLACE = 'replace' -class UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgPathField( - str, Enum -): - BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key' +class UpdateClassificationOnFileRequestBodyPathField(str, Enum): + _BOX__SECURITY__CLASSIFICATION__KEY = '/Box__Security__Classification__Key' -class UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArg(BaseObject): +class UpdateClassificationOnFileRequestBody(BaseObject): def __init__( self, - op: Optional[ - UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgOpField - ] = None, - path: Optional[ - UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgPathField - ] = None, - value: Optional[str] = None, + op: UpdateClassificationOnFileRequestBodyOpField, + path: UpdateClassificationOnFileRequestBodyPathField, + value: str, **kwargs ): """ :param op: `replace` - :type op: Optional[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgOpField], optional + :type op: UpdateClassificationOnFileRequestBodyOpField :param path: Defines classifications available in the enterprise. - :type path: Optional[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArgPathField], optional + :type path: UpdateClassificationOnFileRequestBodyPathField :param value: 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. - :type value: Optional[str], optional + :type value: str """ super().__init__(**kwargs) self.op = op @@ -86,12 +78,14 @@ class FileClassificationsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo( + def get_classification_on_file( self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> Classification: """ @@ -124,7 +118,8 @@ def get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/enterprise/securityClassification-6VMVochwUWo', ]), @@ -138,7 +133,7 @@ def get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo( ) return deserialize(response.data, Classification) - def create_file_metadata_enterprise_security_classification( + def add_classification_to_file( self, file_id: str, box_security_classification_key: Optional[str] = None, @@ -183,7 +178,8 @@ def create_file_metadata_enterprise_security_classification( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/enterprise/securityClassification-6VMVochwUWo', ]), @@ -199,12 +195,10 @@ def create_file_metadata_enterprise_security_classification( ) return deserialize(response.data, Classification) - def update_file_metadata_enterprise_security_classification( + def update_classification_on_file( self, file_id: str, - request_body: List[ - UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArg - ], + request_body: List[UpdateClassificationOnFileRequestBody], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Classification: """ @@ -226,8 +220,8 @@ def update_file_metadata_enterprise_security_classification( the `file_id` is `123`. Example: "12345" :type file_id: str - :param request_body: Request body of updateFileMetadataEnterpriseSecurityClassification method - :type request_body: List[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArg] + :param request_body: Request body of updateClassificationOnFile method + :type request_body: List[UpdateClassificationOnFileRequestBody] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -236,7 +230,8 @@ def update_file_metadata_enterprise_security_classification( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/enterprise/securityClassification-6VMVochwUWo', ]), @@ -252,7 +247,7 @@ def update_file_metadata_enterprise_security_classification( ) return deserialize(response.data, Classification) - def delete_file_metadata_enterprise_security_classification( + def delete_classification_from_file( self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> None: """ @@ -282,7 +277,8 @@ def delete_file_metadata_enterprise_security_classification( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/enterprise/securityClassification-6VMVochwUWo', ]), diff --git a/box_sdk_gen/managers/file_metadata.py b/box_sdk_gen/managers/file_metadata.py index f752147..bd362e3 100644 --- a/box_sdk_gen/managers/file_metadata.py +++ b/box_sdk_gen/managers/file_metadata.py @@ -41,22 +41,22 @@ from box_sdk_gen.json_data import SerializedData -class GetFileMetadataByIdScopeArg(str, Enum): +class GetFileMetadataByIdScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class CreateFileMetadataByIdScopeArg(str, Enum): +class CreateFileMetadataByIdScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class UpdateFileMetadataByIdScopeArg(str, Enum): +class UpdateFileMetadataByIdScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class UpdateFileMetadataByIdRequestBodyArgOpField(str, Enum): +class UpdateFileMetadataByIdRequestBodyOpField(str, Enum): ADD = 'add' REPLACE = 'replace' REMOVE = 'remove' @@ -65,7 +65,7 @@ class UpdateFileMetadataByIdRequestBodyArgOpField(str, Enum): COPY = 'copy' -class UpdateFileMetadataByIdRequestBodyArg(BaseObject): +class UpdateFileMetadataByIdRequestBody(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'from_': 'from', **BaseObject._fields_to_json_mapping, @@ -77,7 +77,7 @@ class UpdateFileMetadataByIdRequestBodyArg(BaseObject): def __init__( self, - op: Optional[UpdateFileMetadataByIdRequestBodyArgOpField] = None, + op: Optional[UpdateFileMetadataByIdRequestBodyOpField] = None, path: Optional[str] = None, value: Optional[str] = None, from_: Optional[str] = None, @@ -86,7 +86,7 @@ def __init__( """ :param op: The type of change to perform on the template. Some of these are hazardous as they will change existing templates. - :type op: Optional[UpdateFileMetadataByIdRequestBodyArgOpField], optional + :type op: Optional[UpdateFileMetadataByIdRequestBodyOpField], optional :param path: The location in the metadata JSON object to apply the changes to, in the format of a [JSON-Pointer](https://tools.ietf.org/html/rfc6901). @@ -114,7 +114,7 @@ def __init__( self.from_ = from_ -class DeleteFileMetadataByIdScopeArg(str, Enum): +class DeleteFileMetadataByIdScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' @@ -123,8 +123,10 @@ class FileMetadataManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -149,7 +151,10 @@ def get_file_metadata( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '/metadata' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/metadata', ]), FetchOptions( method='GET', @@ -164,7 +169,7 @@ def get_file_metadata( def get_file_metadata_by_id( self, file_id: str, - scope: GetFileMetadataByIdScopeArg, + scope: GetFileMetadataByIdScope, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> MetadataFull: @@ -183,7 +188,7 @@ def get_file_metadata_by_id( :type file_id: str :param scope: The scope of the metadata template Example: "global" - :type scope: GetFileMetadataByIdScopeArg + :type scope: GetFileMetadataByIdScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str @@ -195,7 +200,8 @@ def get_file_metadata_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/', to_string(scope), @@ -215,7 +221,7 @@ def get_file_metadata_by_id( def create_file_metadata_by_id( self, file_id: str, - scope: CreateFileMetadataByIdScopeArg, + scope: CreateFileMetadataByIdScope, template_key: str, request_body: Dict[str, str], extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -241,7 +247,7 @@ def create_file_metadata_by_id( :type file_id: str :param scope: The scope of the metadata template Example: "global" - :type scope: CreateFileMetadataByIdScopeArg + :type scope: CreateFileMetadataByIdScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str @@ -255,7 +261,8 @@ def create_file_metadata_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/', to_string(scope), @@ -277,9 +284,9 @@ def create_file_metadata_by_id( def update_file_metadata_by_id( self, file_id: str, - scope: UpdateFileMetadataByIdScopeArg, + scope: UpdateFileMetadataByIdScope, template_key: str, - request_body: List[UpdateFileMetadataByIdRequestBodyArg], + request_body: List[UpdateFileMetadataByIdRequestBody], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> MetadataFull: """ @@ -309,12 +316,12 @@ def update_file_metadata_by_id( :type file_id: str :param scope: The scope of the metadata template Example: "global" - :type scope: UpdateFileMetadataByIdScopeArg + :type scope: UpdateFileMetadataByIdScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str :param request_body: Request body of updateFileMetadataById method - :type request_body: List[UpdateFileMetadataByIdRequestBodyArg] + :type request_body: List[UpdateFileMetadataByIdRequestBody] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -323,7 +330,8 @@ def update_file_metadata_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/', to_string(scope), @@ -345,7 +353,7 @@ def update_file_metadata_by_id( def delete_file_metadata_by_id( self, file_id: str, - scope: DeleteFileMetadataByIdScopeArg, + scope: DeleteFileMetadataByIdScope, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> None: @@ -361,7 +369,7 @@ def delete_file_metadata_by_id( :type file_id: str :param scope: The scope of the metadata template Example: "global" - :type scope: DeleteFileMetadataByIdScopeArg + :type scope: DeleteFileMetadataByIdScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str @@ -373,7 +381,8 @@ def delete_file_metadata_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/', to_string(scope), diff --git a/box_sdk_gen/managers/file_requests.py b/box_sdk_gen/managers/file_requests.py index 340391b..57ab781 100644 --- a/box_sdk_gen/managers/file_requests.py +++ b/box_sdk_gen/managers/file_requests.py @@ -41,20 +41,20 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFileRequestByIdStatusArg(str, Enum): +class UpdateFileRequestByIdStatus(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' -class CreateFileRequestCopyFolderArgTypeField(str, Enum): +class CreateFileRequestCopyFolderTypeField(str, Enum): FOLDER = 'folder' -class CreateFileRequestCopyFolderArg(BaseObject): +class CreateFileRequestCopyFolder(BaseObject): def __init__( self, id: str, - type: Optional[CreateFileRequestCopyFolderArgTypeField] = None, + type: Optional[CreateFileRequestCopyFolderTypeField] = None, **kwargs ): """ @@ -62,14 +62,14 @@ def __init__( file request to. :type id: str :param type: `folder` - :type type: Optional[CreateFileRequestCopyFolderArgTypeField], optional + :type type: Optional[CreateFileRequestCopyFolderTypeField], optional """ super().__init__(**kwargs) self.id = id self.type = type -class CreateFileRequestCopyStatusArg(str, Enum): +class CreateFileRequestCopyStatus(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' @@ -78,8 +78,10 @@ class FileRequestsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -106,7 +108,9 @@ def get_file_request_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/file_requests/', to_string(file_request_id) + self.network_session.base_urls.base_url, + '/file_requests/', + to_string(file_request_id), ]), FetchOptions( method='GET', @@ -123,7 +127,7 @@ def update_file_request_by_id( file_request_id: str, title: Optional[str] = None, description: Optional[str] = None, - status: Optional[UpdateFileRequestByIdStatusArg] = None, + status: Optional[UpdateFileRequestByIdStatus] = None, is_email_required: Optional[bool] = None, is_description_required: Optional[bool] = None, expires_at: Optional[str] = None, @@ -157,7 +161,7 @@ def update_file_request_by_id( to the file request URL will receive a `HTTP 404` status code. This will default to the value on the existing file request. - :type status: Optional[UpdateFileRequestByIdStatusArg], optional + :type status: Optional[UpdateFileRequestByIdStatus], optional :param is_email_required: Whether a file request submitter is required to provide their email address. When this setting is set to true, the Box UI will show @@ -196,12 +200,14 @@ def update_file_request_by_id( '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 - }) + 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/', to_string(file_request_id) + self.network_session.base_urls.base_url, + '/file_requests/', + to_string(file_request_id), ]), FetchOptions( method='PUT', @@ -238,7 +244,9 @@ def delete_file_request_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/file_requests/', to_string(file_request_id) + self.network_session.base_urls.base_url, + '/file_requests/', + to_string(file_request_id), ]), FetchOptions( method='DELETE', @@ -253,10 +261,10 @@ def delete_file_request_by_id( def create_file_request_copy( self, file_request_id: str, - folder: CreateFileRequestCopyFolderArg, + folder: CreateFileRequestCopyFolder, title: Optional[str] = None, description: Optional[str] = None, - status: Optional[CreateFileRequestCopyStatusArg] = None, + status: Optional[CreateFileRequestCopyStatus] = None, is_email_required: Optional[bool] = None, is_description_required: Optional[bool] = None, expires_at: Optional[str] = None, @@ -276,7 +284,7 @@ def create_file_request_copy( Example: "123" :type file_request_id: str :param folder: The folder to associate the new file request to. - :type folder: CreateFileRequestCopyFolderArg + :type folder: CreateFileRequestCopyFolder :param title: 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. @@ -291,7 +299,7 @@ def create_file_request_copy( to the file request URL will receive a `HTTP 404` status code. This will default to the value on the existing file request. - :type status: Optional[CreateFileRequestCopyStatusArg], optional + :type status: Optional[CreateFileRequestCopyStatus], optional :param is_email_required: Whether a file request submitter is required to provide their email address. When this setting is set to true, the Box UI will show @@ -327,7 +335,8 @@ def create_file_request_copy( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/file_requests/', + self.network_session.base_urls.base_url, + '/file_requests/', to_string(file_request_id), '/copy', ]), diff --git a/box_sdk_gen/managers/file_version_legal_holds.py b/box_sdk_gen/managers/file_version_legal_holds.py index 3d54894..19eaf64 100644 --- a/box_sdk_gen/managers/file_version_legal_holds.py +++ b/box_sdk_gen/managers/file_version_legal_holds.py @@ -37,8 +37,10 @@ class FileVersionLegalHoldsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -63,7 +65,8 @@ def get_file_version_legal_hold_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/file_version_legal_holds/', + self.network_session.base_urls.base_url, + '/file_version_legal_holds/', to_string(file_version_legal_hold_id), ]), FetchOptions( @@ -148,7 +151,9 @@ def get_file_version_legal_holds( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/file_version_legal_holds']), + ''.join( + [self.network_session.base_urls.base_url, '/file_version_legal_holds'] + ), FetchOptions( method='GET', params=query_params_map, diff --git a/box_sdk_gen/managers/file_version_retentions.py b/box_sdk_gen/managers/file_version_retentions.py index a30e70c..e84f9b3 100644 --- a/box_sdk_gen/managers/file_version_retentions.py +++ b/box_sdk_gen/managers/file_version_retentions.py @@ -35,7 +35,7 @@ from box_sdk_gen.json_data import SerializedData -class GetFileVersionRetentionsDispositionActionArg(str, Enum): +class GetFileVersionRetentionsDispositionAction(str, Enum): PERMANENTLY_DELETE = 'permanently_delete' REMOVE_RETENTION = 'remove_retention' @@ -44,8 +44,10 @@ class FileVersionRetentionsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -54,9 +56,7 @@ def get_file_version_retentions( file_id: Optional[str] = None, file_version_id: Optional[str] = None, policy_id: Optional[str] = None, - disposition_action: Optional[ - GetFileVersionRetentionsDispositionActionArg - ] = None, + disposition_action: Optional[GetFileVersionRetentionsDispositionAction] = None, disposition_before: Optional[str] = None, disposition_after: Optional[str] = None, limit: Optional[int] = None, @@ -73,7 +73,7 @@ def get_file_version_retentions( :type policy_id: Optional[str], optional :param disposition_action: Filters results by the retention policy with this disposition action. - :type disposition_action: Optional[GetFileVersionRetentionsDispositionActionArg], optional + :type disposition_action: Optional[GetFileVersionRetentionsDispositionAction], optional :param disposition_before: Filters results by files that will have their disposition come into effect before this date. :type disposition_before: Optional[str], optional @@ -103,7 +103,9 @@ def get_file_version_retentions( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/file_version_retentions']), + ''.join( + [self.network_session.base_urls.base_url, '/file_version_retentions'] + ), FetchOptions( method='GET', params=query_params_map, @@ -133,7 +135,8 @@ def get_file_version_retention_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/file_version_retentions/', + self.network_session.base_urls.base_url, + '/file_version_retentions/', to_string(file_version_retention_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/file_versions.py b/box_sdk_gen/managers/file_versions.py index 899c1bf..4bd1cf2 100644 --- a/box_sdk_gen/managers/file_versions.py +++ b/box_sdk_gen/managers/file_versions.py @@ -39,7 +39,7 @@ from box_sdk_gen.json_data import SerializedData -class PromoteFileVersionTypeArg(str, Enum): +class PromoteFileVersionType(str, Enum): FILE_VERSION = 'file_version' @@ -47,8 +47,10 @@ class FileVersionsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -105,7 +107,10 @@ def get_file_versions( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '/versions' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/versions', ]), FetchOptions( method='GET', @@ -159,7 +164,8 @@ def get_file_version_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/versions/', to_string(file_version_id), @@ -216,7 +222,8 @@ def update_file_version_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/versions/', to_string(file_version_id), @@ -268,12 +275,13 @@ def delete_file_version_by_id( """ if extra_headers is None: extra_headers = {} - headers_map: Dict[str, str] = prepare_params({ - 'if-match': to_string(if_match), **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/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/versions/', to_string(file_version_id), @@ -292,7 +300,7 @@ def promote_file_version( self, file_id: str, id: Optional[str] = None, - type: Optional[PromoteFileVersionTypeArg] = None, + type: Optional[PromoteFileVersionType] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FileVersionFull: @@ -342,7 +350,7 @@ def promote_file_version( :param id: The file version ID :type id: Optional[str], optional :param type: The type to promote - :type type: Optional[PromoteFileVersionTypeArg], optional + :type type: Optional[PromoteFileVersionType], optional :param fields: 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. @@ -362,7 +370,8 @@ def promote_file_version( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/versions/current', ]), diff --git a/box_sdk_gen/managers/file_watermarks.py b/box_sdk_gen/managers/file_watermarks.py index 3a6c45e..81a0ad4 100644 --- a/box_sdk_gen/managers/file_watermarks.py +++ b/box_sdk_gen/managers/file_watermarks.py @@ -37,16 +37,16 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFileWatermarkWatermarkArgImprintField(str, Enum): +class UpdateFileWatermarkWatermarkImprintField(str, Enum): DEFAULT = 'default' -class UpdateFileWatermarkWatermarkArg(BaseObject): - def __init__(self, imprint: UpdateFileWatermarkWatermarkArgImprintField, **kwargs): +class UpdateFileWatermarkWatermark(BaseObject): + def __init__(self, imprint: UpdateFileWatermarkWatermarkImprintField, **kwargs): """ :param imprint: The type of watermark to apply. Currently only supports one option. - :type imprint: UpdateFileWatermarkWatermarkArgImprintField + :type imprint: UpdateFileWatermarkWatermarkImprintField """ super().__init__(**kwargs) self.imprint = imprint @@ -56,8 +56,10 @@ class FileWatermarksManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -82,7 +84,10 @@ def get_file_watermark( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '/watermark' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/watermark', ]), FetchOptions( method='GET', @@ -97,7 +102,7 @@ def get_file_watermark( def update_file_watermark( self, file_id: str, - watermark: UpdateFileWatermarkWatermarkArg, + watermark: UpdateFileWatermarkWatermark, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Watermark: """ @@ -111,7 +116,7 @@ def update_file_watermark( Example: "12345" :type file_id: str :param watermark: The watermark to imprint on the file - :type watermark: UpdateFileWatermarkWatermarkArg + :type watermark: UpdateFileWatermarkWatermark :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -121,7 +126,10 @@ def update_file_watermark( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '/watermark' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/watermark', ]), FetchOptions( method='PUT', @@ -156,7 +164,10 @@ def delete_file_watermark( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '/watermark' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/watermark', ]), FetchOptions( method='DELETE', diff --git a/box_sdk_gen/managers/files.py b/box_sdk_gen/managers/files.py index 5cfed61..322d165 100644 --- a/box_sdk_gen/managers/files.py +++ b/box_sdk_gen/managers/files.py @@ -39,7 +39,7 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFileByIdParentArg(BaseObject): +class UpdateFileByIdParent(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ :param id: The ID of parent item @@ -49,13 +49,13 @@ def __init__(self, id: Optional[str] = None, **kwargs): self.id = id -class UpdateFileByIdSharedLinkArgAccessField(str, Enum): +class UpdateFileByIdSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateFileByIdSharedLinkArgPermissionsField(BaseObject): +class UpdateFileByIdSharedLinkPermissionsField(BaseObject): def __init__(self, can_download: Optional[bool] = None, **kwargs): """ :param can_download: If the shared link allows for downloading of files. @@ -67,14 +67,14 @@ def __init__(self, can_download: Optional[bool] = None, **kwargs): self.can_download = can_download -class UpdateFileByIdSharedLinkArg(BaseObject): +class UpdateFileByIdSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateFileByIdSharedLinkArgAccessField] = None, + access: Optional[UpdateFileByIdSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, - permissions: Optional[UpdateFileByIdSharedLinkArgPermissionsField] = None, + permissions: Optional[UpdateFileByIdSharedLinkPermissionsField] = None, **kwargs ): """ @@ -88,7 +88,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateFileByIdSharedLinkArgAccessField], optional + :type access: Optional[UpdateFileByIdSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -114,21 +114,21 @@ def __init__( self.permissions = permissions -class UpdateFileByIdLockArgAccessField(str, Enum): +class UpdateFileByIdLockAccessField(str, Enum): LOCK = 'lock' -class UpdateFileByIdLockArg(BaseObject): +class UpdateFileByIdLock(BaseObject): def __init__( self, - access: Optional[UpdateFileByIdLockArgAccessField] = None, + access: Optional[UpdateFileByIdLockAccessField] = 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 + :type access: Optional[UpdateFileByIdLockAccessField], optional :param expires_at: Defines the time at which the lock expires. :type expires_at: Optional[str], optional :param is_download_prevented: Defines if the file can be downloaded while it is locked. @@ -140,15 +140,15 @@ def __init__( self.is_download_prevented = is_download_prevented -class UpdateFileByIdPermissionsArgCanDownloadField(str, Enum): +class UpdateFileByIdPermissionsCanDownloadField(str, Enum): OPEN = 'open' COMPANY = 'company' -class UpdateFileByIdPermissionsArg(BaseObject): +class UpdateFileByIdPermissions(BaseObject): def __init__( self, - can_download: Optional[UpdateFileByIdPermissionsArgCanDownloadField] = None, + can_download: Optional[UpdateFileByIdPermissionsCanDownloadField] = None, **kwargs ): """ @@ -159,13 +159,13 @@ def __init__( normally part of the `role` of a collaboration. When set to `company`, this essentially removes the download option for external users with `viewer` or `editor` a roles. - :type can_download: Optional[UpdateFileByIdPermissionsArgCanDownloadField], optional + :type can_download: Optional[UpdateFileByIdPermissionsCanDownloadField], optional """ super().__init__(**kwargs) self.can_download = can_download -class UpdateFileByIdCollectionsArg(BaseObject): +class UpdateFileByIdCollections(BaseObject): def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwargs): """ :param id: The unique identifier for this object @@ -178,7 +178,7 @@ def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwarg self.type = type -class CopyFileParentArg(BaseObject): +class CopyFileParent(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of folder to copy the file to. @@ -188,7 +188,7 @@ def __init__(self, id: str, **kwargs): self.id = id -class GetFileThumbnailByIdExtensionArg(str, Enum): +class GetFileThumbnailByIdExtension(str, Enum): PNG = 'png' JPG = 'jpg' @@ -197,8 +197,10 @@ class FilesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -276,7 +278,9 @@ def get_file_by_id( **extra_headers, }) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/files/', to_string(file_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/files/', to_string(file_id)] + ), FetchOptions( method='GET', params=query_params_map, @@ -293,12 +297,12 @@ def update_file_by_id( file_id: str, name: Optional[str] = None, description: Optional[str] = None, - parent: Optional[UpdateFileByIdParentArg] = None, - shared_link: Optional[UpdateFileByIdSharedLinkArg] = None, - lock: Optional[UpdateFileByIdLockArg] = None, + parent: Optional[UpdateFileByIdParent] = None, + shared_link: Optional[UpdateFileByIdSharedLink] = None, + lock: Optional[UpdateFileByIdLock] = None, disposition_at: Optional[str] = None, - permissions: Optional[UpdateFileByIdPermissionsArg] = None, - collections: Optional[List[UpdateFileByIdCollectionsArg]] = None, + permissions: Optional[UpdateFileByIdPermissions] = None, + collections: Optional[List[UpdateFileByIdCollections]] = None, tags: Optional[List[str]] = None, fields: Optional[List[str]] = None, if_match: Optional[str] = None, @@ -329,12 +333,12 @@ def update_file_by_id( moved, renamed, or otherwise changed by anyone other than the user who created the lock. Set this to `null` to remove the lock. - :type lock: Optional[UpdateFileByIdLockArg], optional + :type lock: Optional[UpdateFileByIdLock], optional :param disposition_at: The retention expiration timestamp for the given file. This date cannot be shortened once set on a file. :type disposition_at: Optional[str], optional :param permissions: Defines who can download a file. - :type permissions: Optional[UpdateFileByIdPermissionsArg], optional + :type permissions: Optional[UpdateFileByIdPermissions], optional :param collections: An array of collections to make this file a member of. Currently we only support the `favorites` collection. @@ -343,7 +347,7 @@ def update_file_by_id( Passing an empty array `[]` or `null` will remove the file from all collections. [1]: e://get-collections - :type collections: Optional[List[UpdateFileByIdCollectionsArg]], optional + :type collections: Optional[List[UpdateFileByIdCollections]], optional :param tags: The tags for this item. These tags are shown in the Box web app and mobile apps next to an item. To add or remove a tag, retrieve the item's current tags, @@ -384,11 +388,13 @@ def update_file_by_id( '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 - }) + 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/', to_string(file_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/files/', to_string(file_id)] + ), FetchOptions( method='PUT', params=query_params_map, @@ -439,11 +445,13 @@ def delete_file_by_id( """ if extra_headers is None: extra_headers = {} - headers_map: Dict[str, str] = prepare_params({ - 'if-match': to_string(if_match), **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/', to_string(file_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/files/', to_string(file_id)] + ), FetchOptions( method='DELETE', headers=headers_map, @@ -457,7 +465,7 @@ def delete_file_by_id( def copy_file( self, file_id: str, - parent: CopyFileParentArg, + parent: CopyFileParent, name: Optional[str] = None, version: Optional[str] = None, fields: Optional[List[str]] = None, @@ -474,7 +482,7 @@ def copy_file( Example: "12345" :type file_id: str :param parent: The destination folder to copy the file to. - :type parent: CopyFileParentArg + :type parent: CopyFileParent :param name: An optional new name for the copied file. There are some restrictions to the file name. Names containing non-printable ASCII characters, forward and backward slashes @@ -502,7 +510,12 @@ def copy_file( 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/', to_string(file_id), '/copy']), + ''.join([ + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/copy', + ]), FetchOptions( method='POST', params=query_params_map, @@ -519,7 +532,7 @@ def copy_file( def get_file_thumbnail_by_id( self, file_id: str, - extension: GetFileThumbnailByIdExtensionArg, + extension: GetFileThumbnailByIdExtension, min_height: Optional[int] = None, min_width: Optional[int] = None, max_height: Optional[int] = None, @@ -556,7 +569,7 @@ def get_file_thumbnail_by_id( :type file_id: str :param extension: The file format for the thumbnail Example: "png" - :type extension: GetFileThumbnailByIdExtensionArg + :type extension: GetFileThumbnailByIdExtension :param min_height: The minimum height of the thumbnail :type min_height: Optional[int], optional :param min_width: The minimum width of the thumbnail @@ -579,7 +592,8 @@ def get_file_thumbnail_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/thumbnail.', to_string(extension), diff --git a/box_sdk_gen/managers/folder_classifications.py b/box_sdk_gen/managers/folder_classifications.py index 27bb7ec..86e5f65 100644 --- a/box_sdk_gen/managers/folder_classifications.py +++ b/box_sdk_gen/managers/folder_classifications.py @@ -1,9 +1,9 @@ from enum import Enum -from typing import Optional - from box_sdk_gen.base_object import BaseObject +from typing import Optional + from typing import Dict from box_sdk_gen.utils import to_string @@ -39,42 +39,34 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgOpField( - str, Enum -): +class UpdateClassificationOnFolderRequestBodyOpField(str, Enum): REPLACE = 'replace' -class UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgPathField( - str, Enum -): - BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key' +class UpdateClassificationOnFolderRequestBodyPathField(str, Enum): + _BOX__SECURITY__CLASSIFICATION__KEY = '/Box__Security__Classification__Key' -class UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArg(BaseObject): +class UpdateClassificationOnFolderRequestBody(BaseObject): def __init__( self, - op: Optional[ - UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgOpField - ] = None, - path: Optional[ - UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgPathField - ] = None, - value: Optional[str] = None, + op: UpdateClassificationOnFolderRequestBodyOpField, + path: UpdateClassificationOnFolderRequestBodyPathField, + value: str, **kwargs ): """ :param op: `replace` - :type op: Optional[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgOpField], optional + :type op: UpdateClassificationOnFolderRequestBodyOpField :param path: Defines classifications available in the enterprise. - :type path: Optional[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArgPathField], optional + :type path: UpdateClassificationOnFolderRequestBodyPathField :param value: 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. - :type value: Optional[str], optional + :type value: str """ super().__init__(**kwargs) self.op = op @@ -86,12 +78,14 @@ class FolderClassificationsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo( + def get_classification_on_folder( self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> Classification: """ @@ -126,7 +120,8 @@ def get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/metadata/enterprise/securityClassification-6VMVochwUWo', ]), @@ -140,7 +135,7 @@ def get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo( ) return deserialize(response.data, Classification) - def create_folder_metadata_enterprise_security_classification( + def add_classification_to_folder( self, folder_id: str, box_security_classification_key: Optional[str] = None, @@ -187,7 +182,8 @@ def create_folder_metadata_enterprise_security_classification( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/metadata/enterprise/securityClassification-6VMVochwUWo', ]), @@ -203,12 +199,10 @@ def create_folder_metadata_enterprise_security_classification( ) return deserialize(response.data, Classification) - def update_folder_metadata_enterprise_security_classification( + def update_classification_on_folder( self, folder_id: str, - request_body: List[ - UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArg - ], + request_body: List[UpdateClassificationOnFolderRequestBody], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Classification: """ @@ -232,8 +226,8 @@ def update_folder_metadata_enterprise_security_classification( always represented by the ID `0`. Example: "12345" :type folder_id: str - :param request_body: Request body of updateFolderMetadataEnterpriseSecurityClassification method - :type request_body: List[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArg] + :param request_body: Request body of updateClassificationOnFolder method + :type request_body: List[UpdateClassificationOnFolderRequestBody] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -242,7 +236,8 @@ def update_folder_metadata_enterprise_security_classification( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/metadata/enterprise/securityClassification-6VMVochwUWo', ]), @@ -258,7 +253,7 @@ def update_folder_metadata_enterprise_security_classification( ) return deserialize(response.data, Classification) - def delete_folder_metadata_enterprise_security_classification( + def delete_classification_from_folder( self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> None: """ @@ -290,7 +285,8 @@ def delete_folder_metadata_enterprise_security_classification( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/metadata/enterprise/securityClassification-6VMVochwUWo', ]), diff --git a/box_sdk_gen/managers/folder_locks.py b/box_sdk_gen/managers/folder_locks.py index 5643897..4f6efd4 100644 --- a/box_sdk_gen/managers/folder_locks.py +++ b/box_sdk_gen/managers/folder_locks.py @@ -37,7 +37,7 @@ from box_sdk_gen.json_data import SerializedData -class CreateFolderLockLockedOperationsArg(BaseObject): +class CreateFolderLockLockedOperations(BaseObject): def __init__(self, move: bool, delete: bool, **kwargs): """ :param move: Whether moving the folder should be locked. @@ -50,7 +50,7 @@ def __init__(self, move: bool, delete: bool, **kwargs): self.delete = delete -class CreateFolderLockFolderArg(BaseObject): +class CreateFolderLockFolder(BaseObject): def __init__(self, type: str, id: str, **kwargs): """ :param type: The content type the lock is being applied to. Only `folder` @@ -68,8 +68,10 @@ class FolderLocksManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -98,12 +100,12 @@ def get_folder_locks( """ 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']), + ''.join([self.network_session.base_urls.base_url, '/folder_locks']), FetchOptions( method='GET', params=query_params_map, @@ -117,8 +119,8 @@ def get_folder_locks( def create_folder_lock( self, - folder: CreateFolderLockFolderArg, - locked_operations: Optional[CreateFolderLockLockedOperationsArg] = None, + folder: CreateFolderLockFolder, + locked_operations: Optional[CreateFolderLockLockedOperations] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FolderLock: """ @@ -133,11 +135,11 @@ def create_folder_lock( use this endpoint. :param folder: The folder to apply the lock to. - :type folder: CreateFolderLockFolderArg + :type folder: CreateFolderLockFolder :param locked_operations: The operations to lock for the folder. If `locked_operations` is included in the request, both `move` and `delete` must also be included and both set to `true`. - :type locked_operations: Optional[CreateFolderLockLockedOperationsArg], optional + :type locked_operations: Optional[CreateFolderLockLockedOperations], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -146,7 +148,7 @@ def create_folder_lock( request_body: Dict = {'locked_operations': locked_operations, 'folder': folder} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/folder_locks']), + ''.join([self.network_session.base_urls.base_url, '/folder_locks']), FetchOptions( method='POST', headers=headers_map, @@ -183,7 +185,9 @@ def delete_folder_lock_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folder_locks/', to_string(folder_lock_id) + self.network_session.base_urls.base_url, + '/folder_locks/', + to_string(folder_lock_id), ]), FetchOptions( method='DELETE', diff --git a/box_sdk_gen/managers/folder_metadata.py b/box_sdk_gen/managers/folder_metadata.py index 7e75279..f46bccc 100644 --- a/box_sdk_gen/managers/folder_metadata.py +++ b/box_sdk_gen/managers/folder_metadata.py @@ -41,22 +41,22 @@ from box_sdk_gen.json_data import SerializedData -class GetFolderMetadataByIdScopeArg(str, Enum): +class GetFolderMetadataByIdScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class CreateFolderMetadataByIdScopeArg(str, Enum): +class CreateFolderMetadataByIdScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class UpdateFolderMetadataByIdScopeArg(str, Enum): +class UpdateFolderMetadataByIdScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class UpdateFolderMetadataByIdRequestBodyArgOpField(str, Enum): +class UpdateFolderMetadataByIdRequestBodyOpField(str, Enum): ADD = 'add' REPLACE = 'replace' REMOVE = 'remove' @@ -65,7 +65,7 @@ class UpdateFolderMetadataByIdRequestBodyArgOpField(str, Enum): COPY = 'copy' -class UpdateFolderMetadataByIdRequestBodyArg(BaseObject): +class UpdateFolderMetadataByIdRequestBody(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'from_': 'from', **BaseObject._fields_to_json_mapping, @@ -77,7 +77,7 @@ class UpdateFolderMetadataByIdRequestBodyArg(BaseObject): def __init__( self, - op: Optional[UpdateFolderMetadataByIdRequestBodyArgOpField] = None, + op: Optional[UpdateFolderMetadataByIdRequestBodyOpField] = None, path: Optional[str] = None, value: Optional[str] = None, from_: Optional[str] = None, @@ -86,7 +86,7 @@ def __init__( """ :param op: The type of change to perform on the template. Some of these are hazardous as they will change existing templates. - :type op: Optional[UpdateFolderMetadataByIdRequestBodyArgOpField], optional + :type op: Optional[UpdateFolderMetadataByIdRequestBodyOpField], optional :param path: The location in the metadata JSON object to apply the changes to, in the format of a [JSON-Pointer](https://tools.ietf.org/html/rfc6901). @@ -114,7 +114,7 @@ def __init__( self.from_ = from_ -class DeleteFolderMetadataByIdScopeArg(str, Enum): +class DeleteFolderMetadataByIdScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' @@ -123,8 +123,10 @@ class FolderMetadataManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -154,7 +156,10 @@ def get_folder_metadata( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', to_string(folder_id), '/metadata' + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + '/metadata', ]), FetchOptions( method='GET', @@ -169,7 +174,7 @@ def get_folder_metadata( def get_folder_metadata_by_id( self, folder_id: str, - scope: GetFolderMetadataByIdScopeArg, + scope: GetFolderMetadataByIdScope, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> MetadataFull: @@ -190,7 +195,7 @@ def get_folder_metadata_by_id( :type folder_id: str :param scope: The scope of the metadata template Example: "global" - :type scope: GetFolderMetadataByIdScopeArg + :type scope: GetFolderMetadataByIdScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str @@ -202,7 +207,8 @@ def get_folder_metadata_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/metadata/', to_string(scope), @@ -222,7 +228,7 @@ def get_folder_metadata_by_id( def create_folder_metadata_by_id( self, folder_id: str, - scope: CreateFolderMetadataByIdScopeArg, + scope: CreateFolderMetadataByIdScope, template_key: str, request_body: Dict[str, str], extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -259,7 +265,7 @@ def create_folder_metadata_by_id( :type folder_id: str :param scope: The scope of the metadata template Example: "global" - :type scope: CreateFolderMetadataByIdScopeArg + :type scope: CreateFolderMetadataByIdScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str @@ -273,7 +279,8 @@ def create_folder_metadata_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/metadata/', to_string(scope), @@ -295,9 +302,9 @@ def create_folder_metadata_by_id( def update_folder_metadata_by_id( self, folder_id: str, - scope: UpdateFolderMetadataByIdScopeArg, + scope: UpdateFolderMetadataByIdScope, template_key: str, - request_body: List[UpdateFolderMetadataByIdRequestBodyArg], + request_body: List[UpdateFolderMetadataByIdRequestBody], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> MetadataFull: """ @@ -329,12 +336,12 @@ def update_folder_metadata_by_id( :type folder_id: str :param scope: The scope of the metadata template Example: "global" - :type scope: UpdateFolderMetadataByIdScopeArg + :type scope: UpdateFolderMetadataByIdScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str :param request_body: Request body of updateFolderMetadataById method - :type request_body: List[UpdateFolderMetadataByIdRequestBodyArg] + :type request_body: List[UpdateFolderMetadataByIdRequestBody] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -343,7 +350,8 @@ def update_folder_metadata_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/metadata/', to_string(scope), @@ -365,7 +373,7 @@ def update_folder_metadata_by_id( def delete_folder_metadata_by_id( self, folder_id: str, - scope: DeleteFolderMetadataByIdScopeArg, + scope: DeleteFolderMetadataByIdScope, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> None: @@ -383,7 +391,7 @@ def delete_folder_metadata_by_id( :type folder_id: str :param scope: The scope of the metadata template Example: "global" - :type scope: DeleteFolderMetadataByIdScopeArg + :type scope: DeleteFolderMetadataByIdScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str @@ -395,7 +403,8 @@ def delete_folder_metadata_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/metadata/', to_string(scope), diff --git a/box_sdk_gen/managers/folder_watermarks.py b/box_sdk_gen/managers/folder_watermarks.py index 9a744c9..3518e50 100644 --- a/box_sdk_gen/managers/folder_watermarks.py +++ b/box_sdk_gen/managers/folder_watermarks.py @@ -37,18 +37,16 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFolderWatermarkWatermarkArgImprintField(str, Enum): +class UpdateFolderWatermarkWatermarkImprintField(str, Enum): DEFAULT = 'default' -class UpdateFolderWatermarkWatermarkArg(BaseObject): - def __init__( - self, imprint: UpdateFolderWatermarkWatermarkArgImprintField, **kwargs - ): +class UpdateFolderWatermarkWatermark(BaseObject): + def __init__(self, imprint: UpdateFolderWatermarkWatermarkImprintField, **kwargs): """ :param imprint: The type of watermark to apply. Currently only supports one option. - :type imprint: UpdateFolderWatermarkWatermarkArgImprintField + :type imprint: UpdateFolderWatermarkWatermarkImprintField """ super().__init__(**kwargs) self.imprint = imprint @@ -58,8 +56,10 @@ class FolderWatermarksManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -86,7 +86,10 @@ def get_folder_watermark( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', to_string(folder_id), '/watermark' + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + '/watermark', ]), FetchOptions( method='GET', @@ -101,7 +104,7 @@ def get_folder_watermark( def update_folder_watermark( self, folder_id: str, - watermark: UpdateFolderWatermarkWatermarkArg, + watermark: UpdateFolderWatermarkWatermark, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Watermark: """ @@ -117,7 +120,7 @@ def update_folder_watermark( Example: "12345" :type folder_id: str :param watermark: The watermark to imprint on the folder - :type watermark: UpdateFolderWatermarkWatermarkArg + :type watermark: UpdateFolderWatermarkWatermark :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -127,7 +130,10 @@ def update_folder_watermark( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', to_string(folder_id), '/watermark' + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + '/watermark', ]), FetchOptions( method='PUT', @@ -164,7 +170,10 @@ def delete_folder_watermark( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', to_string(folder_id), '/watermark' + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + '/watermark', ]), FetchOptions( method='DELETE', diff --git a/box_sdk_gen/managers/folders.py b/box_sdk_gen/managers/folders.py index bd223db..aa73deb 100644 --- a/box_sdk_gen/managers/folders.py +++ b/box_sdk_gen/managers/folders.py @@ -41,25 +41,25 @@ from box_sdk_gen.json_data import SerializedData -class GetFolderByIdSortArg(str, Enum): +class GetFolderByIdSort(str, Enum): ID = 'id' NAME = 'name' DATE = 'date' SIZE = 'size' -class GetFolderByIdDirectionArg(str, Enum): +class GetFolderByIdDirection(str, Enum): ASC = 'ASC' DESC = 'DESC' -class UpdateFolderByIdSyncStateArg(str, Enum): +class UpdateFolderByIdSyncState(str, Enum): SYNCED = 'synced' NOT_SYNCED = 'not_synced' PARTIALLY_SYNCED = 'partially_synced' -class UpdateFolderByIdParentArg(BaseObject): +class UpdateFolderByIdParent(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ :param id: The ID of the new parent folder @@ -69,13 +69,13 @@ def __init__(self, id: Optional[str] = None, **kwargs): self.id = id -class UpdateFolderByIdSharedLinkArgAccessField(str, Enum): +class UpdateFolderByIdSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateFolderByIdSharedLinkArgPermissionsField(BaseObject): +class UpdateFolderByIdSharedLinkPermissionsField(BaseObject): def __init__(self, can_download: Optional[bool] = None, **kwargs): """ :param can_download: If the shared link allows for downloading of files. @@ -87,14 +87,14 @@ def __init__(self, can_download: Optional[bool] = None, **kwargs): self.can_download = can_download -class UpdateFolderByIdSharedLinkArg(BaseObject): +class UpdateFolderByIdSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateFolderByIdSharedLinkArgAccessField] = None, + access: Optional[UpdateFolderByIdSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, - permissions: Optional[UpdateFolderByIdSharedLinkArgPermissionsField] = None, + permissions: Optional[UpdateFolderByIdSharedLinkPermissionsField] = None, **kwargs ): """ @@ -108,7 +108,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateFolderByIdSharedLinkArgAccessField], optional + :type access: Optional[UpdateFolderByIdSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -134,15 +134,15 @@ def __init__( self.permissions = permissions -class UpdateFolderByIdFolderUploadEmailArgAccessField(str, Enum): +class UpdateFolderByIdFolderUploadEmailAccessField(str, Enum): OPEN = 'open' COLLABORATORS = 'collaborators' -class UpdateFolderByIdFolderUploadEmailArg(BaseObject): +class UpdateFolderByIdFolderUploadEmail(BaseObject): def __init__( self, - access: Optional[UpdateFolderByIdFolderUploadEmailArgAccessField] = None, + access: Optional[UpdateFolderByIdFolderUploadEmailAccessField] = None, **kwargs ): """ @@ -156,13 +156,13 @@ def __init__( any email aliases a user might have registered. When set to `open` it will accept emails from any email address. - :type access: Optional[UpdateFolderByIdFolderUploadEmailArgAccessField], optional + :type access: Optional[UpdateFolderByIdFolderUploadEmailAccessField], optional """ super().__init__(**kwargs) self.access = access -class UpdateFolderByIdCollectionsArg(BaseObject): +class UpdateFolderByIdCollections(BaseObject): def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwargs): """ :param id: The unique identifier for this object @@ -175,19 +175,19 @@ def __init__(self, id: Optional[str] = None, type: Optional[str] = None, **kwarg self.type = type -class GetFolderItemsSortArg(str, Enum): +class GetFolderItemsSort(str, Enum): ID = 'id' NAME = 'name' DATE = 'date' SIZE = 'size' -class GetFolderItemsDirectionArg(str, Enum): +class GetFolderItemsDirection(str, Enum): ASC = 'ASC' DESC = 'DESC' -class CreateFolderParentArg(BaseObject): +class CreateFolderParent(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of parent folder @@ -197,15 +197,15 @@ def __init__(self, id: str, **kwargs): self.id = id -class CreateFolderFolderUploadEmailArgAccessField(str, Enum): +class CreateFolderFolderUploadEmailAccessField(str, Enum): OPEN = 'open' COLLABORATORS = 'collaborators' -class CreateFolderFolderUploadEmailArg(BaseObject): +class CreateFolderFolderUploadEmail(BaseObject): def __init__( self, - access: Optional[CreateFolderFolderUploadEmailArgAccessField] = None, + access: Optional[CreateFolderFolderUploadEmailAccessField] = None, **kwargs ): """ @@ -219,19 +219,19 @@ def __init__( any email aliases a user might have registered. When set to `open` it will accept emails from any email address. - :type access: Optional[CreateFolderFolderUploadEmailArgAccessField], optional + :type access: Optional[CreateFolderFolderUploadEmailAccessField], optional """ super().__init__(**kwargs) self.access = access -class CreateFolderSyncStateArg(str, Enum): +class CreateFolderSyncState(str, Enum): SYNCED = 'synced' NOT_SYNCED = 'not_synced' PARTIALLY_SYNCED = 'partially_synced' -class CopyFolderParentArg(BaseObject): +class CopyFolderParent(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of parent folder @@ -245,8 +245,10 @@ class FoldersManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -254,8 +256,8 @@ def get_folder_by_id( self, folder_id: str, fields: Optional[List[str]] = None, - sort: Optional[GetFolderByIdSortArg] = None, - direction: Optional[GetFolderByIdDirectionArg] = None, + sort: Optional[GetFolderByIdSort] = None, + direction: Optional[GetFolderByIdDirection] = None, offset: Optional[int] = None, limit: Optional[int] = None, if_none_match: Optional[str] = None, @@ -283,7 +285,7 @@ def get_folder_by_id( To fetch more items within the folder, use the - [Get items in a folder](#get-folders-id-items) endpoint. + [Get items in a folder](e://get-folders-id-items) endpoint. :param folder_id: The unique identifier that represent a folder. The ID for any folder can be determined @@ -331,10 +333,10 @@ def get_folder_by_id( folders listed before files, and files listed before web links. - :type sort: Optional[GetFolderByIdSortArg], optional + :type sort: Optional[GetFolderByIdSort], optional :param direction: The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order. - :type direction: Optional[GetFolderByIdDirectionArg], optional + :type direction: Optional[GetFolderByIdDirection], optional :param offset: The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected @@ -374,7 +376,11 @@ def get_folder_by_id( **extra_headers, }) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/folders/', to_string(folder_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + ]), FetchOptions( method='GET', params=query_params_map, @@ -391,14 +397,14 @@ def update_folder_by_id( folder_id: str, name: Optional[str] = None, description: Optional[str] = None, - sync_state: Optional[UpdateFolderByIdSyncStateArg] = None, + sync_state: Optional[UpdateFolderByIdSyncState] = None, can_non_owners_invite: Optional[bool] = None, - parent: Optional[UpdateFolderByIdParentArg] = None, - shared_link: Optional[UpdateFolderByIdSharedLinkArg] = None, - folder_upload_email: Optional[UpdateFolderByIdFolderUploadEmailArg] = None, + parent: Optional[UpdateFolderByIdParent] = None, + shared_link: Optional[UpdateFolderByIdSharedLink] = None, + folder_upload_email: Optional[UpdateFolderByIdFolderUploadEmail] = None, tags: Optional[List[str]] = None, is_collaboration_restricted_to_enterprise: Optional[bool] = None, - collections: Optional[List[UpdateFolderByIdCollectionsArg]] = None, + collections: Optional[List[UpdateFolderByIdCollections]] = None, can_non_owners_view_collaborators: Optional[bool] = None, fields: Optional[List[str]] = None, if_match: Optional[str] = None, @@ -426,13 +432,13 @@ def update_folder_by_id( :param sync_state: Specifies whether a folder should be synced to a user's device or not. This is used by Box Sync (discontinued) and is not used by Box Drive. - :type sync_state: Optional[UpdateFolderByIdSyncStateArg], optional + :type sync_state: Optional[UpdateFolderByIdSyncState], optional :param can_non_owners_invite: Specifies if users who are not the owner of the folder can invite new collaborators to the folder. :type can_non_owners_invite: Optional[bool], optional :param parent: The parent folder for this folder. Use this to move the folder or to restore it out of the trash. - :type parent: Optional[UpdateFolderByIdParentArg], optional + :type parent: Optional[UpdateFolderByIdParent], optional :param tags: The tags for this item. These tags are shown in the Box web app and mobile apps next to an item. To add or remove a tag, retrieve the item's current tags, @@ -452,7 +458,7 @@ def update_folder_by_id( Passing an empty array `[]` or `null` will remove the folder from all collections. [1]: e://get-collections - :type collections: Optional[List[UpdateFolderByIdCollectionsArg]], optional + :type collections: Optional[List[UpdateFolderByIdCollections]], optional :param can_non_owners_view_collaborators: Restricts collaborators who are not the owner of this folder from viewing other collaborations on this folder. @@ -499,11 +505,15 @@ def update_folder_by_id( '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 - }) + 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/', to_string(folder_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + ]), FetchOptions( method='PUT', params=query_params_map, @@ -554,14 +564,18 @@ def delete_folder_by_id( """ 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 - }) + 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/', to_string(folder_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + ]), FetchOptions( method='DELETE', params=query_params_map, @@ -581,8 +595,8 @@ def get_folder_items( marker: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, - sort: Optional[GetFolderItemsSortArg] = None, - direction: Optional[GetFolderItemsDirectionArg] = None, + sort: Optional[GetFolderItemsSort] = None, + direction: Optional[GetFolderItemsDirection] = None, boxapi: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Items: @@ -661,10 +675,10 @@ def get_folder_items( folders listed before files, and files listed before web links. - :type sort: Optional[GetFolderItemsSortArg], optional + :type sort: Optional[GetFolderItemsSort], optional :param direction: The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order. - :type direction: Optional[GetFolderItemsDirectionArg], optional + :type direction: Optional[GetFolderItemsDirection], optional :param boxapi: 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. @@ -687,12 +701,15 @@ def get_folder_items( 'sort': to_string(sort), 'direction': to_string(direction), }) - headers_map: Dict[str, str] = prepare_params({ - 'boxapi': to_string(boxapi), **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/folders/', to_string(folder_id), '/items' + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + '/items', ]), FetchOptions( method='GET', @@ -708,9 +725,9 @@ def get_folder_items( def create_folder( self, name: str, - parent: CreateFolderParentArg, - folder_upload_email: Optional[CreateFolderFolderUploadEmailArg] = None, - sync_state: Optional[CreateFolderSyncStateArg] = None, + parent: CreateFolderParent, + folder_upload_email: Optional[CreateFolderFolderUploadEmail] = None, + sync_state: Optional[CreateFolderSyncState] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FolderFull: @@ -725,11 +742,11 @@ def create_folder( not allowed either. :type name: str :param parent: The parent folder to create the new folder within. - :type parent: CreateFolderParentArg + :type parent: CreateFolderParent :param sync_state: Specifies whether a folder should be synced to a user's device or not. This is used by Box Sync (discontinued) and is not used by Box Drive. - :type sync_state: Optional[CreateFolderSyncStateArg], optional + :type sync_state: Optional[CreateFolderSyncState], optional :param fields: 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. @@ -753,7 +770,7 @@ def create_folder( 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']), + ''.join([self.network_session.base_urls.base_url, '/folders']), FetchOptions( method='POST', params=query_params_map, @@ -770,7 +787,7 @@ def create_folder( def copy_folder( self, folder_id: str, - parent: CopyFolderParentArg, + parent: CopyFolderParent, name: Optional[str] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -790,7 +807,7 @@ def copy_folder( Example: "0" :type folder_id: str :param parent: The destination folder to copy the folder to. - :type parent: CopyFolderParentArg + :type parent: CopyFolderParent :param name: An optional new name for the copied folder. There are some restrictions to the file name. Names containing non-printable ASCII characters, forward and backward slashes @@ -818,7 +835,10 @@ def copy_folder( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', to_string(folder_id), '/copy' + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + '/copy', ]), FetchOptions( method='POST', diff --git a/box_sdk_gen/managers/groups.py b/box_sdk_gen/managers/groups.py index 1d8c1fb..5b473a9 100644 --- a/box_sdk_gen/managers/groups.py +++ b/box_sdk_gen/managers/groups.py @@ -39,25 +39,25 @@ from box_sdk_gen.json_data import SerializedData -class CreateGroupInvitabilityLevelArg(str, Enum): +class CreateGroupInvitabilityLevel(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' -class CreateGroupMemberViewabilityLevelArg(str, Enum): +class CreateGroupMemberViewabilityLevel(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' -class UpdateGroupByIdInvitabilityLevelArg(str, Enum): +class UpdateGroupByIdInvitabilityLevel(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' -class UpdateGroupByIdMemberViewabilityLevelArg(str, Enum): +class UpdateGroupByIdMemberViewabilityLevel(str, Enum): ADMINS_ONLY = 'admins_only' ADMINS_AND_MEMBERS = 'admins_and_members' ALL_MANAGED_USERS = 'all_managed_users' @@ -67,8 +67,10 @@ class GroupsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -117,7 +119,7 @@ def get_groups( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/groups']), + ''.join([self.network_session.base_urls.base_url, '/groups']), FetchOptions( method='GET', params=query_params_map, @@ -135,8 +137,8 @@ def create_group( 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, + invitability_level: Optional[CreateGroupInvitabilityLevel] = None, + member_viewability_level: Optional[CreateGroupMemberViewabilityLevel] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> GroupFull: @@ -175,14 +177,14 @@ def create_group( above and group members can invite the group. When set to `all_managed_users` all managed users in the enterprise can invite the group. - :type invitability_level: Optional[CreateGroupInvitabilityLevelArg], optional + :type invitability_level: Optional[CreateGroupInvitabilityLevel], optional :param member_viewability_level: 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 - :type member_viewability_level: Optional[CreateGroupMemberViewabilityLevelArg], optional + :type member_viewability_level: Optional[CreateGroupMemberViewabilityLevel], optional :param fields: 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. @@ -208,7 +210,7 @@ def create_group( 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']), + ''.join([self.network_session.base_urls.base_url, '/groups']), FetchOptions( method='POST', params=query_params_map, @@ -256,7 +258,11 @@ def get_group_by_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/groups/', to_string(group_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/groups/', + to_string(group_id), + ]), FetchOptions( method='GET', params=query_params_map, @@ -275,9 +281,9 @@ def update_group_by_id( provenance: Optional[str] = None, external_sync_identifier: Optional[str] = None, description: Optional[str] = None, - invitability_level: Optional[UpdateGroupByIdInvitabilityLevelArg] = None, + invitability_level: Optional[UpdateGroupByIdInvitabilityLevel] = None, member_viewability_level: Optional[ - UpdateGroupByIdMemberViewabilityLevelArg + UpdateGroupByIdMemberViewabilityLevel ] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -323,14 +329,14 @@ def update_group_by_id( above and group members can invite the group. When set to `all_managed_users` all managed users in the enterprise can invite the group. - :type invitability_level: Optional[UpdateGroupByIdInvitabilityLevelArg], optional + :type invitability_level: Optional[UpdateGroupByIdInvitabilityLevel], optional :param member_viewability_level: 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 - :type member_viewability_level: Optional[UpdateGroupByIdMemberViewabilityLevelArg], optional + :type member_viewability_level: Optional[UpdateGroupByIdMemberViewabilityLevel], optional :param fields: 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. @@ -356,7 +362,11 @@ def update_group_by_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/groups/', to_string(group_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/groups/', + to_string(group_id), + ]), FetchOptions( method='PUT', params=query_params_map, @@ -388,7 +398,11 @@ def delete_group_by_id( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/groups/', to_string(group_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/groups/', + to_string(group_id), + ]), FetchOptions( method='DELETE', headers=headers_map, diff --git a/box_sdk_gen/managers/integration_mappings.py b/box_sdk_gen/managers/integration_mappings.py index 5d436e5..a094cf5 100644 --- a/box_sdk_gen/managers/integration_mappings.py +++ b/box_sdk_gen/managers/integration_mappings.py @@ -45,11 +45,11 @@ from box_sdk_gen.json_data import SerializedData -class GetIntegrationMappingSlackPartnerItemTypeArg(str, Enum): +class GetSlackIntegrationMappingPartnerItemType(str, Enum): CHANNEL = 'channel' -class GetIntegrationMappingSlackBoxItemTypeArg(str, Enum): +class GetSlackIntegrationMappingBoxItemType(str, Enum): FOLDER = 'folder' @@ -57,21 +57,21 @@ class IntegrationMappingsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_integration_mapping_slack( + def get_slack_integration_mapping( self, marker: Optional[str] = None, limit: Optional[int] = None, - partner_item_type: Optional[ - GetIntegrationMappingSlackPartnerItemTypeArg - ] = None, + partner_item_type: Optional[GetSlackIntegrationMappingPartnerItemType] = None, partner_item_id: Optional[str] = None, box_item_id: Optional[str] = None, - box_item_type: Optional[GetIntegrationMappingSlackBoxItemTypeArg] = None, + box_item_type: Optional[GetSlackIntegrationMappingBoxItemType] = None, is_manually_created: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> IntegrationMappings: @@ -90,13 +90,13 @@ def get_integration_mapping_slack( :param limit: The maximum number of items to return per page. :type limit: Optional[int], optional :param partner_item_type: Mapped item type, for which the mapping should be returned - :type partner_item_type: Optional[GetIntegrationMappingSlackPartnerItemTypeArg], optional + :type partner_item_type: Optional[GetSlackIntegrationMappingPartnerItemType], optional :param partner_item_id: ID of the mapped item, for which the mapping should be returned :type partner_item_id: Optional[str], optional :param box_item_id: Box item ID, for which the mappings should be returned :type box_item_id: Optional[str], optional :param box_item_type: Box item type, for which the mappings should be returned - :type box_item_type: Optional[GetIntegrationMappingSlackBoxItemTypeArg], optional + :type box_item_type: Optional[GetSlackIntegrationMappingBoxItemType], optional :param is_manually_created: Whether the mapping has been manually created :type is_manually_created: Optional[bool], optional :param extra_headers: Extra headers that will be included in the HTTP request. @@ -115,7 +115,9 @@ def get_integration_mapping_slack( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/integration_mappings/slack']), + ''.join( + [self.network_session.base_urls.base_url, '/integration_mappings/slack'] + ), FetchOptions( method='GET', params=query_params_map, @@ -127,7 +129,7 @@ def get_integration_mapping_slack( ) return deserialize(response.data, IntegrationMappings) - def create_integration_mapping_slack( + def create_slack_integration_mapping( self, partner_item: IntegrationMappingPartnerItemSlack, box_item: IntegrationMappingBoxItemSlack, @@ -157,7 +159,9 @@ def create_integration_mapping_slack( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/integration_mappings/slack']), + ''.join( + [self.network_session.base_urls.base_url, '/integration_mappings/slack'] + ), FetchOptions( method='POST', headers=headers_map, @@ -170,7 +174,7 @@ def create_integration_mapping_slack( ) return deserialize(response.data, IntegrationMapping) - def update_integration_mapping_slack_by_id( + def update_slack_integration_mapping_by_id( self, integration_mapping_id: str, box_item: Optional[IntegrationMappingBoxItemSlack] = None, @@ -200,7 +204,8 @@ def update_integration_mapping_slack_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/integration_mappings/slack/', + self.network_session.base_urls.base_url, + '/integration_mappings/slack/', to_string(integration_mapping_id), ]), FetchOptions( @@ -215,7 +220,7 @@ def update_integration_mapping_slack_by_id( ) return deserialize(response.data, IntegrationMapping) - def delete_integration_mapping_slack_by_id( + def delete_slack_integration_mapping_by_id( self, integration_mapping_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -239,7 +244,8 @@ def delete_integration_mapping_slack_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/integration_mappings/slack/', + self.network_session.base_urls.base_url, + '/integration_mappings/slack/', to_string(integration_mapping_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/invites.py b/box_sdk_gen/managers/invites.py index 268f0f6..814091e 100644 --- a/box_sdk_gen/managers/invites.py +++ b/box_sdk_gen/managers/invites.py @@ -37,7 +37,7 @@ from box_sdk_gen.json_data import SerializedData -class CreateInviteEnterpriseArg(BaseObject): +class CreateInviteEnterprise(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of the enterprise @@ -47,7 +47,7 @@ def __init__(self, id: str, **kwargs): self.id = id -class CreateInviteActionableByArg(BaseObject): +class CreateInviteActionableBy(BaseObject): def __init__(self, login: Optional[str] = None, **kwargs): """ :param login: The login of the invited user @@ -61,15 +61,17 @@ class InvitesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def create_invite( self, - enterprise: CreateInviteEnterpriseArg, - actionable_by: CreateInviteActionableByArg, + enterprise: CreateInviteEnterprise, + actionable_by: CreateInviteActionableBy, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Invite: @@ -94,9 +96,9 @@ def create_invite( the application, which can be enabled within the developer console. :param enterprise: The enterprise to invite the user to - :type enterprise: CreateInviteEnterpriseArg + :type enterprise: CreateInviteEnterprise :param actionable_by: The user to invite - :type actionable_by: CreateInviteActionableByArg + :type actionable_by: CreateInviteActionableBy :param fields: 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. @@ -115,7 +117,7 @@ def create_invite( 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']), + ''.join([self.network_session.base_urls.base_url, '/invites']), FetchOptions( method='POST', params=query_params_map, @@ -157,7 +159,11 @@ def get_invite_by_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/invites/', to_string(invite_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/invites/', + to_string(invite_id), + ]), FetchOptions( method='GET', params=query_params_map, diff --git a/box_sdk_gen/managers/legal_hold_policies.py b/box_sdk_gen/managers/legal_hold_policies.py index 1c17b04..3fb5524 100644 --- a/box_sdk_gen/managers/legal_hold_policies.py +++ b/box_sdk_gen/managers/legal_hold_policies.py @@ -41,8 +41,10 @@ class LegalHoldPoliciesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -90,7 +92,7 @@ def get_legal_hold_policies( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/legal_hold_policies']), + ''.join([self.network_session.base_urls.base_url, '/legal_hold_policies']), FetchOptions( method='GET', params=query_params_map, @@ -157,7 +159,7 @@ def create_legal_hold_policy( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/legal_hold_policies']), + ''.join([self.network_session.base_urls.base_url, '/legal_hold_policies']), FetchOptions( method='POST', headers=headers_map, @@ -188,7 +190,8 @@ def get_legal_hold_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/legal_hold_policies/', + self.network_session.base_urls.base_url, + '/legal_hold_policies/', to_string(legal_hold_policy_id), ]), FetchOptions( @@ -233,7 +236,8 @@ def update_legal_hold_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/legal_hold_policies/', + self.network_session.base_urls.base_url, + '/legal_hold_policies/', to_string(legal_hold_policy_id), ]), FetchOptions( @@ -272,7 +276,8 @@ def delete_legal_hold_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/legal_hold_policies/', + self.network_session.base_urls.base_url, + '/legal_hold_policies/', to_string(legal_hold_policy_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/legal_hold_policy_assignments.py b/box_sdk_gen/managers/legal_hold_policy_assignments.py index 53f3ce6..274a0de 100644 --- a/box_sdk_gen/managers/legal_hold_policy_assignments.py +++ b/box_sdk_gen/managers/legal_hold_policy_assignments.py @@ -43,30 +43,27 @@ from box_sdk_gen.json_data import SerializedData -class GetLegalHoldPolicyAssignmentsAssignToTypeArg(str, Enum): +class GetLegalHoldPolicyAssignmentsAssignToType(str, Enum): FILE = 'file' FILE_VERSION = 'file_version' FOLDER = 'folder' USER = 'user' -class CreateLegalHoldPolicyAssignmentAssignToArgTypeField(str, Enum): +class CreateLegalHoldPolicyAssignmentAssignToTypeField(str, Enum): FILE = 'file' FILE_VERSION = 'file_version' FOLDER = 'folder' USER = 'user' -class CreateLegalHoldPolicyAssignmentAssignToArg(BaseObject): +class CreateLegalHoldPolicyAssignmentAssignTo(BaseObject): def __init__( - self, - type: CreateLegalHoldPolicyAssignmentAssignToArgTypeField, - id: str, - **kwargs + self, type: CreateLegalHoldPolicyAssignmentAssignToTypeField, id: str, **kwargs ): """ :param type: The type of item to assign the policy to - :type type: CreateLegalHoldPolicyAssignmentAssignToArgTypeField + :type type: CreateLegalHoldPolicyAssignmentAssignToTypeField :param id: The ID of item to assign the policy to :type id: str """ @@ -79,15 +76,17 @@ class LegalHoldPolicyAssignmentsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() 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_type: Optional[GetLegalHoldPolicyAssignmentsAssignToType] = None, assign_to_id: Optional[str] = None, marker: Optional[str] = None, limit: Optional[int] = None, @@ -100,7 +99,7 @@ def get_legal_hold_policy_assignments( :type policy_id: str :param assign_to_type: Filters the results by the type of item the policy was applied to. - :type assign_to_type: Optional[GetLegalHoldPolicyAssignmentsAssignToTypeArg], optional + :type assign_to_type: Optional[GetLegalHoldPolicyAssignmentsAssignToType], optional :param assign_to_id: Filters the results by the ID of item the policy was applied to. :type assign_to_id: Optional[str], optional @@ -134,7 +133,10 @@ def get_legal_hold_policy_assignments( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/legal_hold_policy_assignments']), + ''.join([ + self.network_session.base_urls.base_url, + '/legal_hold_policy_assignments', + ]), FetchOptions( method='GET', params=query_params_map, @@ -149,7 +151,7 @@ def get_legal_hold_policy_assignments( def create_legal_hold_policy_assignment( self, policy_id: str, - assign_to: CreateLegalHoldPolicyAssignmentAssignToArg, + assign_to: CreateLegalHoldPolicyAssignmentAssignTo, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> LegalHoldPolicyAssignment: """ @@ -157,7 +159,7 @@ def create_legal_hold_policy_assignment( :param policy_id: The ID of the policy to assign. :type policy_id: str :param assign_to: The item to assign the policy to - :type assign_to: CreateLegalHoldPolicyAssignmentAssignToArg + :type assign_to: CreateLegalHoldPolicyAssignmentAssignTo :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -166,7 +168,10 @@ def create_legal_hold_policy_assignment( request_body: Dict = {'policy_id': policy_id, 'assign_to': assign_to} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/legal_hold_policy_assignments']), + ''.join([ + self.network_session.base_urls.base_url, + '/legal_hold_policy_assignments', + ]), FetchOptions( method='POST', headers=headers_map, @@ -197,7 +202,8 @@ def get_legal_hold_policy_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/legal_hold_policy_assignments/', + self.network_session.base_urls.base_url, + '/legal_hold_policy_assignments/', to_string(legal_hold_policy_assignment_id), ]), FetchOptions( @@ -234,7 +240,8 @@ def delete_legal_hold_policy_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/legal_hold_policy_assignments/', + self.network_session.base_urls.base_url, + '/legal_hold_policy_assignments/', to_string(legal_hold_policy_assignment_id), ]), FetchOptions( @@ -324,7 +331,8 @@ def get_legal_hold_policy_assignment_file_on_hold( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/legal_hold_policy_assignments/', + self.network_session.base_urls.base_url, + '/legal_hold_policy_assignments/', to_string(legal_hold_policy_assignment_id), '/files_on_hold', ]), @@ -416,7 +424,8 @@ def get_legal_hold_policy_assignment_file_version_on_hold( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/legal_hold_policy_assignments/', + self.network_session.base_urls.base_url, + '/legal_hold_policy_assignments/', to_string(legal_hold_policy_assignment_id), '/file_versions_on_hold', ]), diff --git a/box_sdk_gen/managers/list_collaborations.py b/box_sdk_gen/managers/list_collaborations.py index 6f1c9c9..74cf020 100644 --- a/box_sdk_gen/managers/list_collaborations.py +++ b/box_sdk_gen/managers/list_collaborations.py @@ -35,7 +35,7 @@ from box_sdk_gen.json_data import SerializedData -class GetCollaborationsStatusArg(str, Enum): +class GetCollaborationsStatus(str, Enum): PENDING = 'pending' @@ -43,8 +43,10 @@ class ListCollaborationsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -100,7 +102,10 @@ def get_file_collaborations( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '/collaborations' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/collaborations', ]), FetchOptions( method='GET', @@ -153,7 +158,8 @@ def get_folder_collaborations( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '/collaborations', ]), @@ -170,7 +176,7 @@ def get_folder_collaborations( def get_collaborations( self, - status: GetCollaborationsStatusArg, + status: GetCollaborationsStatus, fields: Optional[List[str]] = None, offset: Optional[int] = None, limit: Optional[int] = None, @@ -179,7 +185,7 @@ def get_collaborations( """ Retrieves all pending collaboration invites for this user. :param status: The status of the collaborations to retrieve - :type status: GetCollaborationsStatusArg + :type status: GetCollaborationsStatus :param fields: 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. @@ -209,7 +215,7 @@ def get_collaborations( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/collaborations']), + ''.join([self.network_session.base_urls.base_url, '/collaborations']), FetchOptions( method='GET', params=query_params_map, @@ -254,13 +260,14 @@ def get_group_collaborations( """ 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/', + self.network_session.base_urls.base_url, + '/groups/', to_string(group_id), '/collaborations', ]), diff --git a/box_sdk_gen/managers/memberships.py b/box_sdk_gen/managers/memberships.py index 3211b88..182daab 100644 --- a/box_sdk_gen/managers/memberships.py +++ b/box_sdk_gen/managers/memberships.py @@ -41,7 +41,7 @@ from box_sdk_gen.json_data import SerializedData -class CreateGroupMembershipUserArg(BaseObject): +class CreateGroupMembershipUser(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of the user to add to the group @@ -51,7 +51,7 @@ def __init__(self, id: str, **kwargs): self.id = id -class CreateGroupMembershipGroupArg(BaseObject): +class CreateGroupMembershipGroup(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of the group to add the user to @@ -61,12 +61,12 @@ def __init__(self, id: str, **kwargs): self.id = id -class CreateGroupMembershipRoleArg(str, Enum): +class CreateGroupMembershipRole(str, Enum): MEMBER = 'member' ADMIN = 'admin' -class UpdateGroupMembershipByIdRoleArg(str, Enum): +class UpdateGroupMembershipByIdRole(str, Enum): MEMBER = 'member' ADMIN = 'admin' @@ -75,8 +75,10 @@ class MembershipsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -110,13 +112,16 @@ def get_user_memberships( """ 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/', to_string(user_id), '/memberships' + self.network_session.base_urls.base_url, + '/users/', + to_string(user_id), + '/memberships', ]), FetchOptions( method='GET', @@ -159,13 +164,16 @@ def get_group_memberships( """ 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/', to_string(group_id), '/memberships' + self.network_session.base_urls.base_url, + '/groups/', + to_string(group_id), + '/memberships', ]), FetchOptions( method='GET', @@ -180,9 +188,9 @@ def get_group_memberships( def create_group_membership( self, - user: CreateGroupMembershipUserArg, - group: CreateGroupMembershipGroupArg, - role: Optional[CreateGroupMembershipRoleArg] = None, + user: CreateGroupMembershipUser, + group: CreateGroupMembershipGroup, + role: Optional[CreateGroupMembershipRole] = None, configurable_permissions: Optional[Dict[str, bool]] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -193,11 +201,11 @@ def create_group_membership( admin-level permissions will be able to use this API. :param user: The user to add to the group. - :type user: CreateGroupMembershipUserArg + :type user: CreateGroupMembershipUser :param group: The group to add the user to. - :type group: CreateGroupMembershipGroupArg + :type group: CreateGroupMembershipGroup :param role: The role of the user in the group. - :type role: Optional[CreateGroupMembershipRoleArg], optional + :type role: Optional[CreateGroupMembershipRole], optional :param configurable_permissions: Custom configuration for the permissions an admin if a group will receive. This option has no effect on members with a role of `member`. @@ -230,7 +238,7 @@ def create_group_membership( 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']), + ''.join([self.network_session.base_urls.base_url, '/group_memberships']), FetchOptions( method='POST', params=query_params_map, @@ -279,7 +287,8 @@ def get_group_membership_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/group_memberships/', + self.network_session.base_urls.base_url, + '/group_memberships/', to_string(group_membership_id), ]), FetchOptions( @@ -296,7 +305,7 @@ def get_group_membership_by_id( def update_group_membership_by_id( self, group_membership_id: str, - role: Optional[UpdateGroupMembershipByIdRoleArg] = None, + role: Optional[UpdateGroupMembershipByIdRole] = None, configurable_permissions: Optional[Dict[str, bool]] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -313,7 +322,7 @@ def update_group_membership_by_id( Example: "434534" :type group_membership_id: str :param role: The role of the user in the group. - :type role: Optional[UpdateGroupMembershipByIdRoleArg], optional + :type role: Optional[UpdateGroupMembershipByIdRole], optional :param configurable_permissions: Custom configuration for the permissions an admin if a group will receive. This option has no effect on members with a role of `member`. @@ -345,7 +354,8 @@ def update_group_membership_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/group_memberships/', + self.network_session.base_urls.base_url, + '/group_memberships/', to_string(group_membership_id), ]), FetchOptions( @@ -385,7 +395,8 @@ def delete_group_membership_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/group_memberships/', + self.network_session.base_urls.base_url, + '/group_memberships/', to_string(group_membership_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/metadata_cascade_policies.py b/box_sdk_gen/managers/metadata_cascade_policies.py index 6be6521..4db35fe 100644 --- a/box_sdk_gen/managers/metadata_cascade_policies.py +++ b/box_sdk_gen/managers/metadata_cascade_policies.py @@ -39,12 +39,12 @@ from box_sdk_gen.json_data import SerializedData -class CreateMetadataCascadePolicyScopeArg(str, Enum): +class CreateMetadataCascadePolicyScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class CreateMetadataCascadePolicyApplyConflictResolutionArg(str, Enum): +class ApplyMetadataCascadePolicyConflictResolution(str, Enum): NONE = 'none' OVERWRITE = 'overwrite' @@ -53,8 +53,10 @@ class MetadataCascadePoliciesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -103,7 +105,9 @@ def get_metadata_cascade_policies( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/metadata_cascade_policies']), + ''.join( + [self.network_session.base_urls.base_url, '/metadata_cascade_policies'] + ), FetchOptions( method='GET', params=query_params_map, @@ -118,7 +122,7 @@ def get_metadata_cascade_policies( def create_metadata_cascade_policy( self, folder_id: str, - scope: CreateMetadataCascadePolicyScopeArg, + scope: CreateMetadataCascadePolicyScope, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> MetadataCascadePolicy: @@ -142,7 +146,7 @@ def create_metadata_cascade_policy( :type folder_id: str :param scope: The scope of the targeted metadata template. This template will need to already have an instance applied to the targeted folder. - :type scope: CreateMetadataCascadePolicyScopeArg + :type scope: CreateMetadataCascadePolicyScope :param template_key: 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 @@ -168,7 +172,9 @@ def create_metadata_cascade_policy( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/metadata_cascade_policies']), + ''.join( + [self.network_session.base_urls.base_url, '/metadata_cascade_policies'] + ), FetchOptions( method='POST', headers=headers_map, @@ -199,7 +205,8 @@ def get_metadata_cascade_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/metadata_cascade_policies/', + self.network_session.base_urls.base_url, + '/metadata_cascade_policies/', to_string(metadata_cascade_policy_id), ]), FetchOptions( @@ -230,7 +237,8 @@ def delete_metadata_cascade_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/metadata_cascade_policies/', + self.network_session.base_urls.base_url, + '/metadata_cascade_policies/', to_string(metadata_cascade_policy_id), ]), FetchOptions( @@ -243,10 +251,10 @@ def delete_metadata_cascade_policy_by_id( ) return None - def create_metadata_cascade_policy_apply( + def apply_metadata_cascade_policy( self, metadata_cascade_policy_id: str, - conflict_resolution: CreateMetadataCascadePolicyApplyConflictResolutionArg, + conflict_resolution: ApplyMetadataCascadePolicyConflictResolution, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> None: """ @@ -269,7 +277,7 @@ def create_metadata_cascade_policy_apply( * `none` will preserve the existing value on the file * `overwrite` will force-apply the templates values over any existing values. - :type conflict_resolution: CreateMetadataCascadePolicyApplyConflictResolutionArg + :type conflict_resolution: ApplyMetadataCascadePolicyConflictResolution :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -279,7 +287,8 @@ def create_metadata_cascade_policy_apply( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/metadata_cascade_policies/', + self.network_session.base_urls.base_url, + '/metadata_cascade_policies/', to_string(metadata_cascade_policy_id), '/apply', ]), diff --git a/box_sdk_gen/managers/metadata_templates.py b/box_sdk_gen/managers/metadata_templates.py index 7627a48..1e87c00 100644 --- a/box_sdk_gen/managers/metadata_templates.py +++ b/box_sdk_gen/managers/metadata_templates.py @@ -41,17 +41,17 @@ from box_sdk_gen.json_data import SerializedData -class GetMetadataTemplateScopeArg(str, Enum): +class GetMetadataTemplateScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class UpdateMetadataTemplateScopeArg(str, Enum): +class UpdateMetadataTemplateScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class UpdateMetadataTemplateRequestBodyArgOpField(str, Enum): +class UpdateMetadataTemplateRequestBodyOpField(str, Enum): EDITTEMPLATE = 'editTemplate' ADDFIELD = 'addField' REORDERFIELDS = 'reorderFields' @@ -67,7 +67,7 @@ class UpdateMetadataTemplateRequestBodyArgOpField(str, Enum): REMOVEMULTISELECTOPTION = 'removeMultiSelectOption' -class UpdateMetadataTemplateRequestBodyArg(BaseObject): +class UpdateMetadataTemplateRequestBody(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'field_key': 'fieldKey', 'field_keys': 'fieldKeys', @@ -89,7 +89,7 @@ class UpdateMetadataTemplateRequestBodyArg(BaseObject): def __init__( self, - op: UpdateMetadataTemplateRequestBodyArgOpField, + op: UpdateMetadataTemplateRequestBodyOpField, data: Optional[Dict[str, str]] = None, field_key: Optional[str] = None, field_keys: Optional[List[str]] = None, @@ -102,7 +102,7 @@ def __init__( """ :param op: The type of change to perform on the template. Some of these are hazardous as they will change existing templates. - :type op: UpdateMetadataTemplateRequestBodyArgOpField + :type op: UpdateMetadataTemplateRequestBodyOpField :param data: The data for the operation. This will vary depending on the operation being performed. :type data: Optional[Dict[str, str]], optional @@ -136,12 +136,12 @@ def __init__( self.multi_select_option_keys = multi_select_option_keys -class DeleteMetadataTemplateScopeArg(str, Enum): +class DeleteMetadataTemplateScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class CreateMetadataTemplateFieldsArgTypeField(str, Enum): +class CreateMetadataTemplateFieldsTypeField(str, Enum): STRING = 'string' FLOAT = 'float' DATE = 'date' @@ -149,7 +149,7 @@ class CreateMetadataTemplateFieldsArgTypeField(str, Enum): MULTISELECT = 'multiSelect' -class CreateMetadataTemplateFieldsArgOptionsField(BaseObject): +class CreateMetadataTemplateFieldsOptionsField(BaseObject): def __init__(self, key: str, **kwargs): """ :param key: The text value of the option. This represents both the display name of the @@ -160,7 +160,7 @@ def __init__(self, key: str, **kwargs): self.key = key -class CreateMetadataTemplateFieldsArg(BaseObject): +class CreateMetadataTemplateFields(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'display_name': 'displayName', **BaseObject._fields_to_json_mapping, @@ -172,12 +172,12 @@ class CreateMetadataTemplateFieldsArg(BaseObject): def __init__( self, - type: CreateMetadataTemplateFieldsArgTypeField, + type: CreateMetadataTemplateFieldsTypeField, key: str, display_name: str, description: Optional[str] = None, hidden: Optional[bool] = None, - options: Optional[List[CreateMetadataTemplateFieldsArgOptionsField]] = None, + options: Optional[List[CreateMetadataTemplateFieldsOptionsField]] = None, **kwargs ): """ @@ -187,7 +187,7 @@ def __init__( Additionally, metadata templates support an `enum` field for a basic list of items, and ` multiSelect` field for a similar list of items where the user can select more than one value. - :type type: CreateMetadataTemplateFieldsArgTypeField + :type type: CreateMetadataTemplateFieldsTypeField :param key: A unique identifier for the field. The identifier must be unique within the template to which it belongs. :type key: str @@ -201,7 +201,7 @@ def __init__( :type hidden: Optional[bool], optional :param options: A list of options for this field. This is used in combination with the `enum` and `multiSelect` field types. - :type options: Optional[List[CreateMetadataTemplateFieldsArgOptionsField]], optional + :type options: Optional[List[CreateMetadataTemplateFieldsOptionsField]], optional """ super().__init__(**kwargs) self.type = type @@ -216,8 +216,10 @@ class MetadataTemplatesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -238,12 +240,12 @@ def get_metadata_templates_by_instance_id( """ 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']), + ''.join([self.network_session.base_urls.base_url, '/metadata_templates']), FetchOptions( method='GET', params=query_params_map, @@ -257,7 +259,7 @@ def get_metadata_templates_by_instance_id( def get_metadata_template( self, - scope: GetMetadataTemplateScopeArg, + scope: GetMetadataTemplateScope, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> MetadataTemplate: @@ -271,7 +273,7 @@ def get_metadata_template( :param scope: The scope of the metadata template Example: "global" - :type scope: GetMetadataTemplateScopeArg + :type scope: GetMetadataTemplateScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str @@ -283,7 +285,8 @@ def get_metadata_template( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/metadata_templates/', + self.network_session.base_urls.base_url, + '/metadata_templates/', to_string(scope), '/', to_string(template_key), @@ -301,9 +304,9 @@ def get_metadata_template( def update_metadata_template( self, - scope: UpdateMetadataTemplateScopeArg, + scope: UpdateMetadataTemplateScope, template_key: str, - request_body: List[UpdateMetadataTemplateRequestBodyArg], + request_body: List[UpdateMetadataTemplateRequestBody], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> MetadataTemplate: """ @@ -322,12 +325,12 @@ def update_metadata_template( :param scope: The scope of the metadata template Example: "global" - :type scope: UpdateMetadataTemplateScopeArg + :type scope: UpdateMetadataTemplateScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str :param request_body: Request body of updateMetadataTemplate method - :type request_body: List[UpdateMetadataTemplateRequestBodyArg] + :type request_body: List[UpdateMetadataTemplateRequestBody] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -336,7 +339,8 @@ def update_metadata_template( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/metadata_templates/', + self.network_session.base_urls.base_url, + '/metadata_templates/', to_string(scope), '/', to_string(template_key), @@ -356,7 +360,7 @@ def update_metadata_template( def delete_metadata_template( self, - scope: DeleteMetadataTemplateScopeArg, + scope: DeleteMetadataTemplateScope, template_key: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> None: @@ -367,7 +371,7 @@ def delete_metadata_template( :param scope: The scope of the metadata template Example: "global" - :type scope: DeleteMetadataTemplateScopeArg + :type scope: DeleteMetadataTemplateScope :param template_key: The name of the metadata template Example: "properties" :type template_key: str @@ -379,7 +383,8 @@ def delete_metadata_template( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/metadata_templates/', + self.network_session.base_urls.base_url, + '/metadata_templates/', to_string(scope), '/', to_string(template_key), @@ -411,7 +416,9 @@ def get_metadata_template_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/metadata_templates/', to_string(template_id) + self.network_session.base_urls.base_url, + '/metadata_templates/', + to_string(template_id), ]), FetchOptions( method='GET', @@ -445,12 +452,14 @@ def get_global_metadata_templates( """ 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']), + ''.join( + [self.network_session.base_urls.base_url, '/metadata_templates/global'] + ), FetchOptions( method='GET', params=query_params_map, @@ -484,12 +493,15 @@ def get_enterprise_metadata_templates( """ 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']), + ''.join([ + self.network_session.base_urls.base_url, + '/metadata_templates/enterprise', + ]), FetchOptions( method='GET', params=query_params_map, @@ -507,7 +519,7 @@ def create_metadata_template( display_name: str, template_key: Optional[str] = None, hidden: Optional[bool] = None, - fields: Optional[List[CreateMetadataTemplateFieldsArg]] = None, + fields: Optional[List[CreateMetadataTemplateFields]] = None, copy_instance_on_item_copy: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> MetadataTemplate: @@ -536,7 +548,7 @@ def create_metadata_template( :param fields: An ordered list of template fields which are part of the template. Each field can be a regular text field, date field, number field, as well as a single or multi-select list. - :type fields: Optional[List[CreateMetadataTemplateFieldsArg]], optional + :type fields: Optional[List[CreateMetadataTemplateFields]], optional :param copy_instance_on_item_copy: Whether or not to copy any metadata attached to a file or folder when it is copied. By default, metadata is not copied along with a file or folder when it is copied. @@ -556,7 +568,9 @@ def create_metadata_template( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/metadata_templates/schema']), + ''.join( + [self.network_session.base_urls.base_url, '/metadata_templates/schema'] + ), FetchOptions( method='POST', headers=headers_map, diff --git a/box_sdk_gen/managers/recent_items.py b/box_sdk_gen/managers/recent_items.py index a754f79..b3c2912 100644 --- a/box_sdk_gen/managers/recent_items.py +++ b/box_sdk_gen/managers/recent_items.py @@ -37,8 +37,10 @@ class RecentItemsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -84,7 +86,7 @@ def get_recent_items( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/recent_items']), + ''.join([self.network_session.base_urls.base_url, '/recent_items']), FetchOptions( method='GET', params=query_params_map, diff --git a/box_sdk_gen/managers/retention_policies.py b/box_sdk_gen/managers/retention_policies.py index 13ecefc..55b5c26 100644 --- a/box_sdk_gen/managers/retention_policies.py +++ b/box_sdk_gen/managers/retention_policies.py @@ -43,22 +43,22 @@ from box_sdk_gen.json_data import SerializedData -class GetRetentionPoliciesPolicyTypeArg(str, Enum): +class GetRetentionPoliciesPolicyType(str, Enum): FINITE = 'finite' INDEFINITE = 'indefinite' -class CreateRetentionPolicyPolicyTypeArg(str, Enum): +class CreateRetentionPolicyPolicyType(str, Enum): FINITE = 'finite' INDEFINITE = 'indefinite' -class CreateRetentionPolicyDispositionActionArg(str, Enum): +class CreateRetentionPolicyDispositionAction(str, Enum): PERMANENTLY_DELETE = 'permanently_delete' REMOVE_RETENTION = 'remove_retention' -class CreateRetentionPolicyRetentionTypeArg(str, Enum): +class CreateRetentionPolicyRetentionType(str, Enum): MODIFIABLE = 'modifiable' NON_MODIFIABLE = 'non_modifiable' @@ -67,15 +67,17 @@ class RetentionPoliciesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def get_retention_policies( self, policy_name: Optional[str] = None, - policy_type: Optional[GetRetentionPoliciesPolicyTypeArg] = None, + policy_type: Optional[GetRetentionPoliciesPolicyType] = None, created_by_user_id: Optional[str] = None, fields: Optional[List[str]] = None, limit: Optional[int] = None, @@ -88,7 +90,7 @@ def get_retention_policies( retention policies. :type policy_name: Optional[str], optional :param policy_type: Filters results by the type of retention policy. - :type policy_type: Optional[GetRetentionPoliciesPolicyTypeArg], optional + :type policy_type: Optional[GetRetentionPoliciesPolicyType], optional :param created_by_user_id: Filters results by the ID of the user who created policy. :type created_by_user_id: Optional[str], optional :param fields: A comma-separated list of attributes to include in the @@ -120,7 +122,7 @@ def get_retention_policies( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/retention_policies']), + ''.join([self.network_session.base_urls.base_url, '/retention_policies']), FetchOptions( method='GET', params=query_params_map, @@ -135,11 +137,11 @@ def get_retention_policies( def create_retention_policy( self, policy_name: str, - policy_type: CreateRetentionPolicyPolicyTypeArg, - disposition_action: CreateRetentionPolicyDispositionActionArg, + policy_type: CreateRetentionPolicyPolicyType, + disposition_action: CreateRetentionPolicyDispositionAction, description: Optional[str] = None, retention_length: Optional[str] = None, - retention_type: Optional[CreateRetentionPolicyRetentionTypeArg] = None, + retention_type: Optional[CreateRetentionPolicyRetentionType] = None, can_owner_extend_retention: Optional[bool] = None, are_owners_notified: Optional[bool] = None, custom_notification_recipients: Optional[List[UserMini]] = None, @@ -154,14 +156,14 @@ def create_retention_policy( specific amount of time to retain the content is known upfront, or `indefinite`, where the amount of time to retain the content is still unknown. - :type policy_type: CreateRetentionPolicyPolicyTypeArg + :type policy_type: CreateRetentionPolicyPolicyType :param disposition_action: 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. - :type disposition_action: CreateRetentionPolicyDispositionActionArg + :type disposition_action: CreateRetentionPolicyDispositionAction :param description: The additional text description of the retention policy. :type description: Optional[str], optional :param retention_length: The length of the retention policy. This value @@ -184,7 +186,7 @@ def create_retention_policy( such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies. - :type retention_type: Optional[CreateRetentionPolicyRetentionTypeArg], optional + :type retention_type: Optional[CreateRetentionPolicyRetentionType], optional :param can_owner_extend_retention: Whether the owner of a file will be allowed to extend the retention. :type can_owner_extend_retention: Optional[bool], optional @@ -212,7 +214,7 @@ def create_retention_policy( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/retention_policies']), + ''.join([self.network_session.base_urls.base_url, '/retention_policies']), FetchOptions( method='POST', headers=headers_map, @@ -254,7 +256,8 @@ def get_retention_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/retention_policies/', + self.network_session.base_urls.base_url, + '/retention_policies/', to_string(retention_policy_id), ]), FetchOptions( @@ -358,7 +361,8 @@ def update_retention_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/retention_policies/', + self.network_session.base_urls.base_url, + '/retention_policies/', to_string(retention_policy_id), ]), FetchOptions( @@ -391,7 +395,8 @@ def delete_retention_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/retention_policies/', + self.network_session.base_urls.base_url, + '/retention_policies/', to_string(retention_policy_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/retention_policy_assignments.py b/box_sdk_gen/managers/retention_policy_assignments.py index 9782a7f..f955844 100644 --- a/box_sdk_gen/managers/retention_policy_assignments.py +++ b/box_sdk_gen/managers/retention_policy_assignments.py @@ -43,28 +43,28 @@ from box_sdk_gen.json_data import SerializedData -class GetRetentionPolicyAssignmentsTypeArg(str, Enum): +class GetRetentionPolicyAssignmentsType(str, Enum): FOLDER = 'folder' ENTERPRISE = 'enterprise' METADATA_TEMPLATE = 'metadata_template' -class CreateRetentionPolicyAssignmentAssignToArgTypeField(str, Enum): +class CreateRetentionPolicyAssignmentAssignToTypeField(str, Enum): ENTERPRISE = 'enterprise' FOLDER = 'folder' METADATA_TEMPLATE = 'metadata_template' -class CreateRetentionPolicyAssignmentAssignToArg(BaseObject): +class CreateRetentionPolicyAssignmentAssignTo(BaseObject): def __init__( self, - type: CreateRetentionPolicyAssignmentAssignToArgTypeField, + type: CreateRetentionPolicyAssignmentAssignToTypeField, id: Optional[str] = None, **kwargs ): """ :param type: The type of item to assign the policy to. - :type type: CreateRetentionPolicyAssignmentAssignToArgTypeField + :type type: CreateRetentionPolicyAssignmentAssignToTypeField :param id: The ID of item to assign the policy to. Set to `null` or omit when `type` is set to `enterprise`. @@ -75,7 +75,7 @@ def __init__( self.id = id -class CreateRetentionPolicyAssignmentFilterFieldsArg(BaseObject): +class CreateRetentionPolicyAssignmentFilterFields(BaseObject): def __init__( self, field: Optional[str] = None, value: Optional[str] = None, **kwargs ): @@ -95,15 +95,17 @@ class RetentionPolicyAssignmentsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def get_retention_policy_assignments( self, retention_policy_id: str, - type: Optional[GetRetentionPolicyAssignmentsTypeArg] = None, + type: Optional[GetRetentionPolicyAssignmentsType] = None, fields: Optional[List[str]] = None, marker: Optional[str] = None, limit: Optional[int] = None, @@ -118,7 +120,7 @@ def get_retention_policy_assignments( Example: "982312" :type retention_policy_id: str :param type: The type of the retention policy assignment to retrieve. - :type type: Optional[GetRetentionPolicyAssignmentsTypeArg], optional + :type type: Optional[GetRetentionPolicyAssignmentsType], optional :param fields: 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. @@ -147,7 +149,8 @@ def get_retention_policy_assignments( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/retention_policies/', + self.network_session.base_urls.base_url, + '/retention_policies/', to_string(retention_policy_id), '/assignments', ]), @@ -165,9 +168,9 @@ def get_retention_policy_assignments( def create_retention_policy_assignment( self, policy_id: str, - assign_to: CreateRetentionPolicyAssignmentAssignToArg, + assign_to: CreateRetentionPolicyAssignmentAssignTo, filter_fields: Optional[ - List[CreateRetentionPolicyAssignmentFilterFieldsArg] + List[CreateRetentionPolicyAssignmentFilterFields] ] = None, start_date_field: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -177,12 +180,12 @@ def create_retention_policy_assignment( :param policy_id: The ID of the retention policy to assign :type policy_id: str :param assign_to: The item to assign the policy to - :type assign_to: CreateRetentionPolicyAssignmentAssignToArg + :type assign_to: CreateRetentionPolicyAssignmentAssignTo :param filter_fields: 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. - :type filter_fields: Optional[List[CreateRetentionPolicyAssignmentFilterFieldsArg]], optional + :type filter_fields: Optional[List[CreateRetentionPolicyAssignmentFilterFields]], optional :param start_date_field: 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. @@ -200,7 +203,10 @@ def create_retention_policy_assignment( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/retention_policy_assignments']), + ''.join([ + self.network_session.base_urls.base_url, + '/retention_policy_assignments', + ]), FetchOptions( method='POST', headers=headers_map, @@ -242,7 +248,8 @@ def get_retention_policy_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/retention_policy_assignments/', + self.network_session.base_urls.base_url, + '/retention_policy_assignments/', to_string(retention_policy_assignment_id), ]), FetchOptions( @@ -277,7 +284,8 @@ def delete_retention_policy_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/retention_policy_assignments/', + self.network_session.base_urls.base_url, + '/retention_policy_assignments/', to_string(retention_policy_assignment_id), ]), FetchOptions( @@ -290,7 +298,7 @@ def delete_retention_policy_assignment_by_id( ) return None - def get_retention_policy_assignment_file_under_retention( + def get_files_under_retention_policy_assignment( self, retention_policy_assignment_id: str, marker: Optional[str] = None, @@ -313,13 +321,14 @@ def get_retention_policy_assignment_file_under_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/', + self.network_session.base_urls.base_url, + '/retention_policy_assignments/', to_string(retention_policy_assignment_id), '/files_under_retention', ]), @@ -334,7 +343,7 @@ def get_retention_policy_assignment_file_under_retention( ) return deserialize(response.data, FilesUnderRetention) - def get_retention_policy_assignment_file_version_under_retention( + def get_file_versions_under_retention_policy_assignment( self, retention_policy_assignment_id: str, marker: Optional[str] = None, @@ -360,13 +369,14 @@ def get_retention_policy_assignment_file_version_under_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/', + self.network_session.base_urls.base_url, + '/retention_policy_assignments/', to_string(retention_policy_assignment_id), '/file_versions_under_retention', ]), diff --git a/box_sdk_gen/managers/search.py b/box_sdk_gen/managers/search.py index 73b0da5..2a3edc3 100644 --- a/box_sdk_gen/managers/search.py +++ b/box_sdk_gen/managers/search.py @@ -51,18 +51,16 @@ from box_sdk_gen.json_data import sd_to_json -class CreateMetadataQueryExecuteReadOrderByArgDirectionField(str, Enum): +class SearchByMetadataQueryOrderByDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' -class CreateMetadataQueryExecuteReadOrderByArg(BaseObject): +class SearchByMetadataQueryOrderBy(BaseObject): def __init__( self, field_key: Optional[str] = None, - direction: Optional[ - CreateMetadataQueryExecuteReadOrderByArgDirectionField - ] = None, + direction: Optional[SearchByMetadataQueryOrderByDirectionField] = None, **kwargs ): """ @@ -73,24 +71,24 @@ def __init__( :param direction: The direction to order by, either ascending or descending. The `ordering` direction must be the same for each item in the array. - :type direction: Optional[CreateMetadataQueryExecuteReadOrderByArgDirectionField], optional + :type direction: Optional[SearchByMetadataQueryOrderByDirectionField], optional """ super().__init__(**kwargs) self.field_key = field_key self.direction = direction -class GetMetadataQueryIndicesScopeArg(str, Enum): +class GetMetadataQueryIndicesScope(str, Enum): GLOBAL = 'global' ENTERPRISE = 'enterprise' -class GetSearchScopeArg(str, Enum): +class SearchForContentScope(str, Enum): USER_CONTENT = 'user_content' ENTERPRISE_CONTENT = 'enterprise_content' -class GetSearchContentTypesArg(str, Enum): +class SearchForContentContentTypes(str, Enum): NAME = 'name' DESCRIPTION = 'description' FILE_CONTENT = 'file_content' @@ -98,24 +96,24 @@ class GetSearchContentTypesArg(str, Enum): TAG = 'tag' -class GetSearchTypeArg(str, Enum): +class SearchForContentType(str, Enum): FILE = 'file' FOLDER = 'folder' WEB_LINK = 'web_link' -class GetSearchTrashContentArg(str, Enum): +class SearchForContentTrashContent(str, Enum): NON_TRASHED_ONLY = 'non_trashed_only' TRASHED_ONLY = 'trashed_only' ALL_ITEMS = 'all_items' -class GetSearchSortArg(str, Enum): +class SearchForContentSort(str, Enum): MODIFIED_AT = 'modified_at' RELEVANCE = 'relevance' -class GetSearchDirectionArg(str, Enum): +class SearchForContentDirection(str, Enum): DESC = 'DESC' ASC = 'ASC' @@ -124,18 +122,20 @@ class SearchManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def create_metadata_query_execute_read( + def search_by_metadata_query( self, from_: str, ancestor_folder_id: str, query: Optional[str] = None, query_params: Optional[Dict[str, str]] = None, - order_by: Optional[List[CreateMetadataQueryExecuteReadOrderByArg]] = None, + order_by: Optional[List[SearchByMetadataQueryOrderBy]] = None, limit: Optional[int] = None, marker: Optional[str] = None, fields: Optional[List[str]] = None, @@ -179,7 +179,7 @@ def create_metadata_query_execute_read( :param order_by: 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. - :type order_by: Optional[List[CreateMetadataQueryExecuteReadOrderByArg]], optional + :type order_by: Optional[List[SearchByMetadataQueryOrderBy]], optional :param limit: 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 @@ -219,7 +219,10 @@ def create_metadata_query_execute_read( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/metadata_queries/execute_read']), + ''.join([ + self.network_session.base_urls.base_url, + '/metadata_queries/execute_read', + ]), FetchOptions( method='POST', headers=headers_map, @@ -234,14 +237,14 @@ def create_metadata_query_execute_read( def get_metadata_query_indices( self, - scope: GetMetadataQueryIndicesScopeArg, + scope: GetMetadataQueryIndicesScope, 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 - :type scope: GetMetadataQueryIndicesScopeArg + :type scope: GetMetadataQueryIndicesScope :param template_key: The name of the metadata template :type template_key: str :param extra_headers: Extra headers that will be included in the HTTP request. @@ -249,12 +252,14 @@ def get_metadata_query_indices( """ 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']), + ''.join( + [self.network_session.base_urls.base_url, '/metadata_query_indices'] + ), FetchOptions( method='GET', params=query_params_map, @@ -266,10 +271,10 @@ def get_metadata_query_indices( ) return deserialize(response.data, MetadataQueryIndices) - def get_search( + def search_for_content( self, query: Optional[str] = None, - scope: Optional[GetSearchScopeArg] = None, + scope: Optional[SearchForContentScope] = None, file_extensions: Optional[List[str]] = None, created_at_range: Optional[List[str]] = None, updated_at_range: Optional[List[str]] = None, @@ -277,12 +282,12 @@ def get_search( owner_user_ids: Optional[List[str]] = None, recent_updater_user_ids: Optional[List[str]] = None, ancestor_folder_ids: Optional[List[str]] = None, - content_types: Optional[List[GetSearchContentTypesArg]] = None, - type: Optional[GetSearchTypeArg] = None, - trash_content: Optional[GetSearchTrashContentArg] = None, + content_types: Optional[List[SearchForContentContentTypes]] = None, + type: Optional[SearchForContentType] = None, + trash_content: Optional[SearchForContentTrashContent] = None, mdfilters: Optional[List[MetadataFilter]] = None, - sort: Optional[GetSearchSortArg] = None, - direction: Optional[GetSearchDirectionArg] = None, + sort: Optional[SearchForContentSort] = None, + direction: Optional[SearchForContentDirection] = None, limit: Optional[int] = None, include_recent_shared_links: Optional[bool] = None, fields: Optional[List[str]] = None, @@ -336,7 +341,7 @@ def get_search( 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. - :type scope: Optional[GetSearchScopeArg], optional + :type scope: Optional[SearchForContentScope], optional :param file_extensions: 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. @@ -410,7 +415,7 @@ def get_search( folder. * `tags` - Any tags that are applied to an item, as defined by its `tags` field. - :type content_types: Optional[List[GetSearchContentTypesArg]], optional + :type content_types: Optional[List[SearchForContentContentTypes]], optional :param type: 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. @@ -418,7 +423,7 @@ def get_search( * `folder` - Limits the search results to folders * `web_link` - Limits the search results to web links, also known as bookmarks - :type type: Optional[GetSearchTypeArg], optional + :type type: Optional[SearchForContentType], optional :param trash_content: 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`). @@ -426,7 +431,7 @@ def get_search( * `non_trashed_only` - Only searches for items currently not in the trash * `all_items` - Searches for both trashed and non-trashed items. - :type trash_content: Optional[GetSearchTrashContentArg], optional + :type trash_content: Optional[SearchForContentTrashContent], optional :param mdfilters: Limits the search results to any items for which the metadata matches the provided filter. This parameter contains a list of 1 metadata template to filter @@ -442,13 +447,13 @@ def get_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. - :type sort: Optional[GetSearchSortArg], optional + :type sort: Optional[SearchForContentSort], optional :param direction: 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. - :type direction: Optional[GetSearchDirectionArg], optional + :type direction: Optional[SearchForContentDirection], optional :param limit: Defines the maximum number of items to return as part of a page of results. :type limit: Optional[int], optional @@ -526,7 +531,7 @@ def get_search( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/search']), + ''.join([self.network_session.base_urls.base_url, '/search']), FetchOptions( method='GET', params=query_params_map, diff --git a/box_sdk_gen/managers/session_termination.py b/box_sdk_gen/managers/session_termination.py index 05b4533..aee941c 100644 --- a/box_sdk_gen/managers/session_termination.py +++ b/box_sdk_gen/managers/session_termination.py @@ -35,12 +35,14 @@ class SessionTerminationManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def create_user_terminate_session( + def terminate_users_sessions( self, user_ids: List[str], user_logins: List[str], @@ -69,7 +71,9 @@ def create_user_terminate_session( request_body: Dict = {'user_ids': user_ids, 'user_logins': user_logins} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/users/terminate_sessions']), + ''.join( + [self.network_session.base_urls.base_url, '/users/terminate_sessions'] + ), FetchOptions( method='POST', headers=headers_map, @@ -82,7 +86,7 @@ def create_user_terminate_session( ) return deserialize(response.data, SessionTerminationMessage) - def create_group_terminate_session( + def terminate_groups_sessions( self, group_ids: List[str], extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -108,7 +112,9 @@ def create_group_terminate_session( request_body: Dict = {'group_ids': group_ids} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/groups/terminate_sessions']), + ''.join( + [self.network_session.base_urls.base_url, '/groups/terminate_sessions'] + ), FetchOptions( method='POST', headers=headers_map, diff --git a/box_sdk_gen/managers/shared_links_files.py b/box_sdk_gen/managers/shared_links_files.py index 4cf5239..72f33b9 100644 --- a/box_sdk_gen/managers/shared_links_files.py +++ b/box_sdk_gen/managers/shared_links_files.py @@ -39,13 +39,13 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFileAddSharedLinkSharedLinkArgAccessField(str, Enum): +class AddShareLinkToFileSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateFileAddSharedLinkSharedLinkArgPermissionsField(BaseObject): +class AddShareLinkToFileSharedLinkPermissionsField(BaseObject): def __init__( self, can_download: Optional[bool] = None, @@ -75,16 +75,14 @@ def __init__( self.can_edit = can_edit -class UpdateFileAddSharedLinkSharedLinkArg(BaseObject): +class AddShareLinkToFileSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateFileAddSharedLinkSharedLinkArgAccessField] = None, + access: Optional[AddShareLinkToFileSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, - permissions: Optional[ - UpdateFileAddSharedLinkSharedLinkArgPermissionsField - ] = None, + permissions: Optional[AddShareLinkToFileSharedLinkPermissionsField] = None, **kwargs ): """ @@ -98,7 +96,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateFileAddSharedLinkSharedLinkArgAccessField], optional + :type access: Optional[AddShareLinkToFileSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -126,13 +124,13 @@ def __init__( self.permissions = permissions -class UpdateFileUpdateSharedLinkSharedLinkArgAccessField(str, Enum): +class UpdateSharedLinkOnFileSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateFileUpdateSharedLinkSharedLinkArgPermissionsField(BaseObject): +class UpdateSharedLinkOnFileSharedLinkPermissionsField(BaseObject): def __init__( self, can_download: Optional[bool] = None, @@ -162,16 +160,14 @@ def __init__( self.can_edit = can_edit -class UpdateFileUpdateSharedLinkSharedLinkArg(BaseObject): +class UpdateSharedLinkOnFileSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateFileUpdateSharedLinkSharedLinkArgAccessField] = None, + access: Optional[UpdateSharedLinkOnFileSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, - permissions: Optional[ - UpdateFileUpdateSharedLinkSharedLinkArgPermissionsField - ] = None, + permissions: Optional[UpdateSharedLinkOnFileSharedLinkPermissionsField] = None, **kwargs ): """ @@ -185,7 +181,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateFileUpdateSharedLinkSharedLinkArgAccessField], optional + :type access: Optional[UpdateSharedLinkOnFileSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -213,7 +209,7 @@ def __init__( self.permissions = permissions -class UpdateFileRemoveSharedLinkSharedLinkArg(BaseObject): +class RemoveSharedLinkFromFileSharedLink(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) @@ -222,12 +218,14 @@ class SharedLinksFilesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_shared_items( + def find_file_for_shared_link( self, boxapi: str, fields: Optional[List[str]] = None, @@ -286,7 +284,7 @@ def get_shared_items( **extra_headers, }) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/shared_items']), + ''.join([self.network_session.base_urls.base_url, '/shared_items']), FetchOptions( method='GET', params=query_params_map, @@ -298,7 +296,7 @@ def get_shared_items( ) return deserialize(response.data, FileFull) - def get_file_get_shared_link( + def get_shared_link_for_file( self, file_id: str, fields: str, @@ -326,7 +324,10 @@ def get_file_get_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '#get_shared_link' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '#get_shared_link', ]), FetchOptions( method='GET', @@ -339,11 +340,11 @@ def get_file_get_shared_link( ) return deserialize(response.data, FileFull) - def update_file_add_shared_link( + def add_share_link_to_file( self, file_id: str, fields: str, - shared_link: Optional[UpdateFileAddSharedLinkSharedLinkArg] = None, + shared_link: Optional[AddShareLinkToFileSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FileFull: """ @@ -362,7 +363,7 @@ def update_file_add_shared_link( :param shared_link: The settings for the shared link to create on the file. Use an empty object (`{}`) to use the default settings for shared links. - :type shared_link: Optional[UpdateFileAddSharedLinkSharedLinkArg], optional + :type shared_link: Optional[AddShareLinkToFileSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -373,7 +374,10 @@ def update_file_add_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', to_string(file_id), '#add_shared_link' + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '#add_shared_link', ]), FetchOptions( method='PUT', @@ -388,11 +392,11 @@ def update_file_add_shared_link( ) return deserialize(response.data, FileFull) - def update_file_update_shared_link( + def update_shared_link_on_file( self, file_id: str, fields: str, - shared_link: Optional[UpdateFileUpdateSharedLinkSharedLinkArg] = None, + shared_link: Optional[UpdateSharedLinkOnFileSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FileFull: """ @@ -409,7 +413,7 @@ def update_file_update_shared_link( to be returned for this item. :type fields: str :param shared_link: The settings for the shared link to update. - :type shared_link: Optional[UpdateFileUpdateSharedLinkSharedLinkArg], optional + :type shared_link: Optional[UpdateSharedLinkOnFileSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -420,7 +424,8 @@ def update_file_update_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '#update_shared_link', ]), @@ -437,11 +442,11 @@ def update_file_update_shared_link( ) return deserialize(response.data, FileFull) - def update_file_remove_shared_link( + def remove_shared_link_from_file( self, file_id: str, fields: str, - shared_link: Optional[UpdateFileRemoveSharedLinkSharedLinkArg] = None, + shared_link: Optional[RemoveSharedLinkFromFileSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FileFull: """ @@ -459,7 +464,7 @@ def update_file_remove_shared_link( :type fields: str :param shared_link: By setting this value to `null`, the shared link is removed from the file. - :type shared_link: Optional[UpdateFileRemoveSharedLinkSharedLinkArg], optional + :type shared_link: Optional[RemoveSharedLinkFromFileSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -470,7 +475,8 @@ def update_file_remove_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '#remove_shared_link', ]), diff --git a/box_sdk_gen/managers/shared_links_folders.py b/box_sdk_gen/managers/shared_links_folders.py index fb8aa6e..33be0da 100644 --- a/box_sdk_gen/managers/shared_links_folders.py +++ b/box_sdk_gen/managers/shared_links_folders.py @@ -39,13 +39,13 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFolderAddSharedLinkSharedLinkArgAccessField(str, Enum): +class AddShareLinkToFolderSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateFolderAddSharedLinkSharedLinkArgPermissionsField(BaseObject): +class AddShareLinkToFolderSharedLinkPermissionsField(BaseObject): def __init__( self, can_download: Optional[bool] = None, @@ -72,16 +72,14 @@ def __init__( self.can_edit = can_edit -class UpdateFolderAddSharedLinkSharedLinkArg(BaseObject): +class AddShareLinkToFolderSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateFolderAddSharedLinkSharedLinkArgAccessField] = None, + access: Optional[AddShareLinkToFolderSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, - permissions: Optional[ - UpdateFolderAddSharedLinkSharedLinkArgPermissionsField - ] = None, + permissions: Optional[AddShareLinkToFolderSharedLinkPermissionsField] = None, **kwargs ): """ @@ -95,7 +93,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateFolderAddSharedLinkSharedLinkArgAccessField], optional + :type access: Optional[AddShareLinkToFolderSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -123,13 +121,13 @@ def __init__( self.permissions = permissions -class UpdateFolderUpdateSharedLinkSharedLinkArgAccessField(str, Enum): +class UpdateSharedLinkOnFolderSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateFolderUpdateSharedLinkSharedLinkArgPermissionsField(BaseObject): +class UpdateSharedLinkOnFolderSharedLinkPermissionsField(BaseObject): def __init__( self, can_download: Optional[bool] = None, @@ -156,15 +154,15 @@ def __init__( self.can_edit = can_edit -class UpdateFolderUpdateSharedLinkSharedLinkArg(BaseObject): +class UpdateSharedLinkOnFolderSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateFolderUpdateSharedLinkSharedLinkArgAccessField] = None, + access: Optional[UpdateSharedLinkOnFolderSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[ - UpdateFolderUpdateSharedLinkSharedLinkArgPermissionsField + UpdateSharedLinkOnFolderSharedLinkPermissionsField ] = None, **kwargs ): @@ -179,7 +177,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateFolderUpdateSharedLinkSharedLinkArgAccessField], optional + :type access: Optional[UpdateSharedLinkOnFolderSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -207,7 +205,7 @@ def __init__( self.permissions = permissions -class UpdateFolderRemoveSharedLinkSharedLinkArg(BaseObject): +class RemoveSharedLinkFromFolderSharedLink(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) @@ -216,12 +214,14 @@ class SharedLinksFoldersManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_shared_item_folders( + def find_folder_for_shared_link( self, boxapi: str, fields: Optional[List[str]] = None, @@ -274,7 +274,7 @@ def get_shared_item_folders( **extra_headers, }) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/shared_items#folders']), + ''.join([self.network_session.base_urls.base_url, '/shared_items#folders']), FetchOptions( method='GET', params=query_params_map, @@ -286,7 +286,7 @@ def get_shared_item_folders( ) return deserialize(response.data, FolderFull) - def get_folder_get_shared_link( + def get_shared_link_for_folder( self, folder_id: str, fields: str, @@ -316,7 +316,8 @@ def get_folder_get_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '#get_shared_link', ]), @@ -331,11 +332,11 @@ def get_folder_get_shared_link( ) return deserialize(response.data, FolderFull) - def update_folder_add_shared_link( + def add_share_link_to_folder( self, folder_id: str, fields: str, - shared_link: Optional[UpdateFolderAddSharedLinkSharedLinkArg] = None, + shared_link: Optional[AddShareLinkToFolderSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FolderFull: """ @@ -356,7 +357,7 @@ def update_folder_add_shared_link( :param shared_link: The settings for the shared link to create on the folder. Use an empty object (`{}`) to use the default settings for shared links. - :type shared_link: Optional[UpdateFolderAddSharedLinkSharedLinkArg], optional + :type shared_link: Optional[AddShareLinkToFolderSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -367,7 +368,8 @@ def update_folder_add_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '#add_shared_link', ]), @@ -384,11 +386,11 @@ def update_folder_add_shared_link( ) return deserialize(response.data, FolderFull) - def update_folder_update_shared_link( + def update_shared_link_on_folder( self, folder_id: str, fields: str, - shared_link: Optional[UpdateFolderUpdateSharedLinkSharedLinkArg] = None, + shared_link: Optional[UpdateSharedLinkOnFolderSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FolderFull: """ @@ -407,7 +409,7 @@ def update_folder_update_shared_link( to be returned for this item. :type fields: str :param shared_link: The settings for the shared link to update. - :type shared_link: Optional[UpdateFolderUpdateSharedLinkSharedLinkArg], optional + :type shared_link: Optional[UpdateSharedLinkOnFolderSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -418,7 +420,8 @@ def update_folder_update_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '#update_shared_link', ]), @@ -435,11 +438,11 @@ def update_folder_update_shared_link( ) return deserialize(response.data, FolderFull) - def update_folder_remove_shared_link( + def remove_shared_link_from_folder( self, folder_id: str, fields: str, - shared_link: Optional[UpdateFolderRemoveSharedLinkSharedLinkArg] = None, + shared_link: Optional[RemoveSharedLinkFromFolderSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> FolderFull: """ @@ -459,7 +462,7 @@ def update_folder_remove_shared_link( :type fields: str :param shared_link: By setting this value to `null`, the shared link is removed from the folder. - :type shared_link: Optional[UpdateFolderRemoveSharedLinkSharedLinkArg], optional + :type shared_link: Optional[RemoveSharedLinkFromFolderSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -470,7 +473,8 @@ def update_folder_remove_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', + self.network_session.base_urls.base_url, + '/folders/', to_string(folder_id), '#remove_shared_link', ]), diff --git a/box_sdk_gen/managers/shared_links_web_links.py b/box_sdk_gen/managers/shared_links_web_links.py index 091abb2..a3bc434 100644 --- a/box_sdk_gen/managers/shared_links_web_links.py +++ b/box_sdk_gen/managers/shared_links_web_links.py @@ -39,13 +39,13 @@ from box_sdk_gen.json_data import SerializedData -class UpdateWebLinkAddSharedLinkSharedLinkArgAccessField(str, Enum): +class AddShareLinkToWebLinkSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateWebLinkAddSharedLinkSharedLinkArgPermissionsField(BaseObject): +class AddShareLinkToWebLinkSharedLinkPermissionsField(BaseObject): def __init__( self, can_download: Optional[bool] = None, @@ -71,16 +71,14 @@ def __init__( self.can_edit = can_edit -class UpdateWebLinkAddSharedLinkSharedLinkArg(BaseObject): +class AddShareLinkToWebLinkSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateWebLinkAddSharedLinkSharedLinkArgAccessField] = None, + access: Optional[AddShareLinkToWebLinkSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, - permissions: Optional[ - UpdateWebLinkAddSharedLinkSharedLinkArgPermissionsField - ] = None, + permissions: Optional[AddShareLinkToWebLinkSharedLinkPermissionsField] = None, **kwargs ): """ @@ -94,7 +92,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateWebLinkAddSharedLinkSharedLinkArgAccessField], optional + :type access: Optional[AddShareLinkToWebLinkSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -122,13 +120,13 @@ def __init__( self.permissions = permissions -class UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField(str, Enum): +class UpdateSharedLinkOnWebLinkSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateWebLinkUpdateSharedLinkSharedLinkArgPermissionsField(BaseObject): +class UpdateSharedLinkOnWebLinkSharedLinkPermissionsField(BaseObject): def __init__( self, can_download: Optional[bool] = None, @@ -154,15 +152,15 @@ def __init__( self.can_edit = can_edit -class UpdateWebLinkUpdateSharedLinkSharedLinkArg(BaseObject): +class UpdateSharedLinkOnWebLinkSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField] = None, + access: Optional[UpdateSharedLinkOnWebLinkSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, permissions: Optional[ - UpdateWebLinkUpdateSharedLinkSharedLinkArgPermissionsField + UpdateSharedLinkOnWebLinkSharedLinkPermissionsField ] = None, **kwargs ): @@ -177,7 +175,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField], optional + :type access: Optional[UpdateSharedLinkOnWebLinkSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -205,7 +203,7 @@ def __init__( self.permissions = permissions -class UpdateWebLinkRemoveSharedLinkSharedLinkArg(BaseObject): +class RemoveSharedLinkFromWebLinkSharedLink(BaseObject): def __init__(self, **kwargs): super().__init__(**kwargs) @@ -214,12 +212,14 @@ class SharedLinksWebLinksManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_shared_item_web_links( + def find_web_link_for_shared_link( self, boxapi: str, fields: Optional[List[str]] = None, @@ -272,7 +272,9 @@ def get_shared_item_web_links( **extra_headers, }) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/shared_items#web_links']), + ''.join( + [self.network_session.base_urls.base_url, '/shared_items#web_links'] + ), FetchOptions( method='GET', params=query_params_map, @@ -284,7 +286,7 @@ def get_shared_item_web_links( ) return deserialize(response.data, WebLink) - def get_web_link_get_shared_link( + def get_shared_link_for_web_link( self, web_link_id: str, fields: str, @@ -307,7 +309,8 @@ def get_web_link_get_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/web_links/', + self.network_session.base_urls.base_url, + '/web_links/', to_string(web_link_id), '#get_shared_link', ]), @@ -322,11 +325,11 @@ def get_web_link_get_shared_link( ) return deserialize(response.data, WebLink) - def update_web_link_add_shared_link( + def add_share_link_to_web_link( self, web_link_id: str, fields: str, - shared_link: Optional[UpdateWebLinkAddSharedLinkSharedLinkArg] = None, + shared_link: Optional[AddShareLinkToWebLinkSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> WebLink: """ @@ -340,7 +343,7 @@ def update_web_link_add_shared_link( :param shared_link: The settings for the shared link to create on the web link. Use an empty object (`{}`) to use the default settings for shared links. - :type shared_link: Optional[UpdateWebLinkAddSharedLinkSharedLinkArg], optional + :type shared_link: Optional[AddShareLinkToWebLinkSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -351,7 +354,8 @@ def update_web_link_add_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/web_links/', + self.network_session.base_urls.base_url, + '/web_links/', to_string(web_link_id), '#add_shared_link', ]), @@ -368,11 +372,11 @@ def update_web_link_add_shared_link( ) return deserialize(response.data, WebLink) - def update_web_link_update_shared_link( + def update_shared_link_on_web_link( self, web_link_id: str, fields: str, - shared_link: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArg] = None, + shared_link: Optional[UpdateSharedLinkOnWebLinkSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> WebLink: """ @@ -384,7 +388,7 @@ def update_web_link_update_shared_link( to be returned for this item. :type fields: str :param shared_link: The settings for the shared link to update. - :type shared_link: Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArg], optional + :type shared_link: Optional[UpdateSharedLinkOnWebLinkSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -395,7 +399,8 @@ def update_web_link_update_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/web_links/', + self.network_session.base_urls.base_url, + '/web_links/', to_string(web_link_id), '#update_shared_link', ]), @@ -412,11 +417,11 @@ def update_web_link_update_shared_link( ) return deserialize(response.data, WebLink) - def update_web_link_remove_shared_link( + def remove_shared_link_from_web_link( self, web_link_id: str, fields: str, - shared_link: Optional[UpdateWebLinkRemoveSharedLinkSharedLinkArg] = None, + shared_link: Optional[RemoveSharedLinkFromWebLinkSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> WebLink: """ @@ -429,7 +434,7 @@ def update_web_link_remove_shared_link( :type fields: str :param shared_link: By setting this value to `null`, the shared link is removed from the web link. - :type shared_link: Optional[UpdateWebLinkRemoveSharedLinkSharedLinkArg], optional + :type shared_link: Optional[RemoveSharedLinkFromWebLinkSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -440,7 +445,8 @@ def update_web_link_remove_shared_link( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/web_links/', + self.network_session.base_urls.base_url, + '/web_links/', to_string(web_link_id), '#remove_shared_link', ]), diff --git a/box_sdk_gen/managers/shield_information_barrier_reports.py b/box_sdk_gen/managers/shield_information_barrier_reports.py index 9adf82b..872d367 100644 --- a/box_sdk_gen/managers/shield_information_barrier_reports.py +++ b/box_sdk_gen/managers/shield_information_barrier_reports.py @@ -43,8 +43,10 @@ class ShieldInformationBarrierReportsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -77,7 +79,10 @@ def get_shield_information_barrier_reports( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/shield_information_barrier_reports']), + ''.join([ + self.network_session.base_urls.base_url, + '/shield_information_barrier_reports', + ]), FetchOptions( method='GET', params=query_params_map, @@ -104,7 +109,10 @@ def create_shield_information_barrier_report( request_body: Dict = {'shield_information_barrier': shield_information_barrier} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/shield_information_barrier_reports']), + ''.join([ + self.network_session.base_urls.base_url, + '/shield_information_barrier_reports', + ]), FetchOptions( method='POST', headers=headers_map, @@ -135,7 +143,8 @@ def get_shield_information_barrier_report_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_reports/', + self.network_session.base_urls.base_url, + '/shield_information_barrier_reports/', to_string(shield_information_barrier_report_id), ]), FetchOptions( 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 91cc9ff..57e2824 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segment_members.py +++ b/box_sdk_gen/managers/shield_information_barrier_segment_members.py @@ -43,26 +43,26 @@ from box_sdk_gen.json_data import SerializedData -class CreateShieldInformationBarrierSegmentMemberTypeArg(str, Enum): +class CreateShieldInformationBarrierSegmentMemberType(str, Enum): SHIELD_INFORMATION_BARRIER_SEGMENT_MEMBER = ( 'shield_information_barrier_segment_member' ) -class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField( +class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField( str, Enum ): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' -class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg( +class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment( BaseObject ): def __init__( self, id: Optional[str] = None, type: Optional[ - CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField + CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField ] = None, **kwargs ): @@ -71,7 +71,7 @@ def __init__( requesting shield information barrier segment. :type id: Optional[str], optional :param type: The type of the shield barrier segment for this member. - :type type: Optional[CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField], optional + :type type: Optional[CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField], optional """ super().__init__(**kwargs) self.id = id @@ -82,8 +82,10 @@ class ShieldInformationBarrierSegmentMembersManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -108,7 +110,8 @@ def get_shield_information_barrier_segment_member_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segment_members/', + self.network_session.base_urls.base_url, + '/shield_information_barrier_segment_members/', to_string(shield_information_barrier_segment_member_id), ]), FetchOptions( @@ -142,7 +145,8 @@ def delete_shield_information_barrier_segment_member_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segment_members/', + self.network_session.base_urls.base_url, + '/shield_information_barrier_segment_members/', to_string(shield_information_barrier_segment_member_id), ]), FetchOptions( @@ -190,7 +194,8 @@ def get_shield_information_barrier_segment_members( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segment_members' + self.network_session.base_urls.base_url, + '/shield_information_barrier_segment_members', ]), FetchOptions( method='GET', @@ -205,9 +210,9 @@ def get_shield_information_barrier_segment_members( def create_shield_information_barrier_segment_member( self, - shield_information_barrier_segment: CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg, + shield_information_barrier_segment: CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment, user: UserBase, - type: Optional[CreateShieldInformationBarrierSegmentMemberTypeArg] = None, + type: Optional[CreateShieldInformationBarrierSegmentMemberType] = None, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> ShieldInformationBarrierSegmentMember: @@ -215,11 +220,11 @@ def create_shield_information_barrier_segment_member( Creates a new shield information barrier segment member. :param shield_information_barrier_segment: The `type` and `id` of the requested shield information barrier segment. - :type shield_information_barrier_segment: CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg + :type shield_information_barrier_segment: CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment :param user: User to which restriction will be applied. :type user: UserBase :param type: -| A type of the shield barrier segment member. - :type type: Optional[CreateShieldInformationBarrierSegmentMemberTypeArg], optional + :type type: Optional[CreateShieldInformationBarrierSegmentMemberType], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -234,7 +239,8 @@ def create_shield_information_barrier_segment_member( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segment_members' + self.network_session.base_urls.base_url, + '/shield_information_barrier_segment_members', ]), FetchOptions( method='POST', 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 c65464d..52660b5 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py +++ b/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py @@ -41,26 +41,26 @@ from box_sdk_gen.json_data import SerializedData -class CreateShieldInformationBarrierSegmentRestrictionTypeArg(str, Enum): +class CreateShieldInformationBarrierSegmentRestrictionType(str, Enum): SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION = ( 'shield_information_barrier_segment_restriction' ) -class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField( +class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField( str, Enum ): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' -class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg( +class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment( BaseObject ): def __init__( self, id: Optional[str] = None, type: Optional[ - CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField + CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField ] = None, **kwargs ): @@ -69,25 +69,25 @@ def __init__( shield information barrier segment. :type id: Optional[str], optional :param type: The type of the shield barrier segment for this member. - :type type: Optional[CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField], optional + :type type: Optional[CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField], optional """ super().__init__(**kwargs) self.id = id self.type = type -class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField( +class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField( str, Enum ): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' -class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg(BaseObject): +class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment(BaseObject): def __init__( self, id: Optional[str] = None, type: Optional[ - CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField + CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField ] = None, **kwargs ): @@ -97,7 +97,7 @@ def __init__( :type id: Optional[str], optional :param type: The type of the restricted shield information barrier segment. - :type type: Optional[CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField], optional + :type type: Optional[CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField], optional """ super().__init__(**kwargs) self.id = id @@ -108,8 +108,10 @@ class ShieldInformationBarrierSegmentRestrictionsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -134,7 +136,8 @@ def get_shield_information_barrier_segment_restriction_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segment_restrictions/', + self.network_session.base_urls.base_url, + '/shield_information_barrier_segment_restrictions/', to_string(shield_information_barrier_segment_restriction_id), ]), FetchOptions( @@ -168,7 +171,8 @@ def delete_shield_information_barrier_segment_restriction_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segment_restrictions/', + self.network_session.base_urls.base_url, + '/shield_information_barrier_segment_restrictions/', to_string(shield_information_barrier_segment_restriction_id), ]), FetchOptions( @@ -216,7 +220,8 @@ def get_shield_information_barrier_segment_restrictions( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segment_restrictions' + self.network_session.base_urls.base_url, + '/shield_information_barrier_segment_restrictions', ]), FetchOptions( method='GET', @@ -231,9 +236,9 @@ def get_shield_information_barrier_segment_restrictions( def create_shield_information_barrier_segment_restriction( self, - type: CreateShieldInformationBarrierSegmentRestrictionTypeArg, - shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg, - restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg, + type: CreateShieldInformationBarrierSegmentRestrictionType, + shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment, + restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment, shield_information_barrier: Optional[ShieldInformationBarrierBase] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> ShieldInformationBarrierSegmentRestriction: @@ -244,13 +249,13 @@ def create_shield_information_barrier_segment_restriction( :param type: The type of the shield barrier segment restriction for this member. - :type type: CreateShieldInformationBarrierSegmentRestrictionTypeArg + :type type: CreateShieldInformationBarrierSegmentRestrictionType :param shield_information_barrier_segment: The `type` and `id` of the requested shield information barrier segment. - :type shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg + :type shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment :param restricted_segment: The `type` and `id` of the restricted shield information barrier segment. - :type restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg + :type restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -265,7 +270,8 @@ def create_shield_information_barrier_segment_restriction( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segment_restrictions' + self.network_session.base_urls.base_url, + '/shield_information_barrier_segment_restrictions', ]), FetchOptions( method='POST', diff --git a/box_sdk_gen/managers/shield_information_barrier_segments.py b/box_sdk_gen/managers/shield_information_barrier_segments.py index 5bb0513..ed61301 100644 --- a/box_sdk_gen/managers/shield_information_barrier_segments.py +++ b/box_sdk_gen/managers/shield_information_barrier_segments.py @@ -41,8 +41,10 @@ class ShieldInformationBarrierSegmentsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -64,7 +66,8 @@ def get_shield_information_barrier_segment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segments/', + self.network_session.base_urls.base_url, + '/shield_information_barrier_segments/', to_string(shield_information_barrier_segment_id), ]), FetchOptions( @@ -103,7 +106,8 @@ def update_shield_information_barrier_segment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segments/', + self.network_session.base_urls.base_url, + '/shield_information_barrier_segments/', to_string(shield_information_barrier_segment_id), ]), FetchOptions( @@ -139,7 +143,8 @@ def delete_shield_information_barrier_segment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barrier_segments/', + self.network_session.base_urls.base_url, + '/shield_information_barrier_segments/', to_string(shield_information_barrier_segment_id), ]), FetchOptions( @@ -184,7 +189,10 @@ def get_shield_information_barrier_segments( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/shield_information_barrier_segments']), + ''.join([ + self.network_session.base_urls.base_url, + '/shield_information_barrier_segments', + ]), FetchOptions( method='GET', params=query_params_map, @@ -221,7 +229,10 @@ def create_shield_information_barrier_segment( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/shield_information_barrier_segments']), + ''.join([ + self.network_session.base_urls.base_url, + '/shield_information_barrier_segments', + ]), FetchOptions( method='POST', headers=headers_map, diff --git a/box_sdk_gen/managers/shield_information_barriers.py b/box_sdk_gen/managers/shield_information_barriers.py index 2ea1154..9c864bf 100644 --- a/box_sdk_gen/managers/shield_information_barriers.py +++ b/box_sdk_gen/managers/shield_information_barriers.py @@ -39,7 +39,7 @@ from box_sdk_gen.json_data import SerializedData -class CreateShieldInformationBarrierChangeStatusStatusArg(str, Enum): +class UpdateShieldInformationBarrierStatusStatus(str, Enum): PENDING = 'pending' DISABLED = 'disabled' @@ -48,8 +48,10 @@ class ShieldInformationBarriersManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -71,7 +73,8 @@ def get_shield_information_barrier_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/shield_information_barriers/', + self.network_session.base_urls.base_url, + '/shield_information_barriers/', to_string(shield_information_barrier_id), ]), FetchOptions( @@ -84,10 +87,10 @@ def get_shield_information_barrier_by_id( ) return deserialize(response.data, ShieldInformationBarrier) - def create_shield_information_barrier_change_status( + def update_shield_information_barrier_status( self, id: str, - status: CreateShieldInformationBarrierChangeStatusStatusArg, + status: UpdateShieldInformationBarrierStatusStatus, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> ShieldInformationBarrier: """ @@ -95,7 +98,7 @@ def create_shield_information_barrier_change_status( :param id: The ID of the shield information barrier. :type id: str :param status: The desired status for the shield information barrier. - :type status: CreateShieldInformationBarrierChangeStatusStatusArg + :type status: UpdateShieldInformationBarrierStatusStatus :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -105,7 +108,8 @@ def create_shield_information_barrier_change_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' + self.network_session.base_urls.base_url, + '/shield_information_barriers/change_status', ]), FetchOptions( method='POST', @@ -140,12 +144,15 @@ def get_shield_information_barriers( """ 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']), + ''.join([ + self.network_session.base_urls.base_url, + '/shield_information_barriers', + ]), FetchOptions( method='GET', params=query_params_map, @@ -180,7 +187,10 @@ def create_shield_information_barrier( request_body: Dict = {'enterprise': enterprise} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/shield_information_barriers']), + ''.join([ + self.network_session.base_urls.base_url, + '/shield_information_barriers', + ]), FetchOptions( method='POST', headers=headers_map, diff --git a/box_sdk_gen/managers/sign_requests.py b/box_sdk_gen/managers/sign_requests.py index b4ef203..396f39d 100644 --- a/box_sdk_gen/managers/sign_requests.py +++ b/box_sdk_gen/managers/sign_requests.py @@ -49,7 +49,7 @@ from box_sdk_gen.json_data import SerializedData -class CreateSignRequestSignatureColorArg(str, Enum): +class CreateSignRequestSignatureColor(str, Enum): BLUE = 'blue' BLACK = 'black' RED = 'red' @@ -59,8 +59,10 @@ class SignRequestsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -82,7 +84,8 @@ def cancel_sign_request( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/sign_requests/', + self.network_session.base_urls.base_url, + '/sign_requests/', to_string(sign_request_id), '/cancel', ]), @@ -114,7 +117,8 @@ def resend_sign_request( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/sign_requests/', + self.network_session.base_urls.base_url, + '/sign_requests/', to_string(sign_request_id), '/resend', ]), @@ -146,7 +150,9 @@ def get_sign_request_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/sign_requests/', to_string(sign_request_id) + self.network_session.base_urls.base_url, + '/sign_requests/', + to_string(sign_request_id), ]), FetchOptions( method='GET', @@ -180,12 +186,12 @@ def get_sign_requests( """ 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']), + ''.join([self.network_session.base_urls.base_url, '/sign_requests']), FetchOptions( method='GET', params=query_params_map, @@ -202,7 +208,7 @@ def create_sign_request( signers: List[SignRequestCreateSigner], parent_folder: FolderMini, source_files: Optional[List[FileBase]] = None, - signature_color: Optional[CreateSignRequestSignatureColorArg] = None, + signature_color: Optional[CreateSignRequestSignatureColor] = None, is_document_preparation_needed: Optional[bool] = None, redirect_url: Optional[str] = None, declined_redirect_url: Optional[str] = None, @@ -228,7 +234,7 @@ def create_sign_request( :param source_files: List of files to create a signing document from. This is currently limited to ten files. Only the ID and type fields are required for each file. :type source_files: Optional[List[FileBase]], optional :param signature_color: Force a specific color for the signature (blue, black, or red) - :type signature_color: Optional[CreateSignRequestSignatureColorArg], optional + :type signature_color: Optional[CreateSignRequestSignatureColor], optional :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 :param redirect_url: When specified, signature request will be redirected to this url when a document is signed. @@ -283,7 +289,7 @@ def create_sign_request( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/sign_requests']), + ''.join([self.network_session.base_urls.base_url, '/sign_requests']), FetchOptions( method='POST', headers=headers_map, diff --git a/box_sdk_gen/managers/sign_templates.py b/box_sdk_gen/managers/sign_templates.py index ba2baf2..afd5f72 100644 --- a/box_sdk_gen/managers/sign_templates.py +++ b/box_sdk_gen/managers/sign_templates.py @@ -37,8 +37,10 @@ class SignTemplatesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -61,12 +63,12 @@ def get_sign_templates( """ 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']), + ''.join([self.network_session.base_urls.base_url, '/sign_templates']), FetchOptions( method='GET', params=query_params_map, @@ -94,7 +96,9 @@ def get_sign_template_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/sign_templates/', to_string(template_id) + self.network_session.base_urls.base_url, + '/sign_templates/', + to_string(template_id), ]), FetchOptions( method='GET', diff --git a/box_sdk_gen/managers/skills.py b/box_sdk_gen/managers/skills.py index 161d11a..882891b 100644 --- a/box_sdk_gen/managers/skills.py +++ b/box_sdk_gen/managers/skills.py @@ -49,14 +49,14 @@ from box_sdk_gen.json_data import SerializedData -class UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField(str, Enum): +class UpdateBoxSkillCardsOnFileRequestBodyOpField(str, Enum): REPLACE = 'replace' -class UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg(BaseObject): +class UpdateBoxSkillCardsOnFileRequestBody(BaseObject): def __init__( self, - op: Optional[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField] = None, + op: Optional[UpdateBoxSkillCardsOnFileRequestBodyOpField] = None, path: Optional[str] = None, value: Optional[ Union[ @@ -70,7 +70,7 @@ def __init__( ): """ :param op: `replace` - :type op: Optional[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField], optional + :type op: Optional[UpdateBoxSkillCardsOnFileRequestBodyOpField], optional :param path: The JSON Path that represents the card to replace. In most cases this will be in the format `/cards/{index}` where `index` is the zero-indexed position of the card in the list of cards. @@ -82,7 +82,7 @@ def __init__( self.value = value -class UpdateSkillInvocationByIdStatusArg(str, Enum): +class UpdateAllSkillCardsOnFileStatus(str, Enum): INVOKED = 'invoked' PROCESSING = 'processing' SUCCESS = 'success' @@ -90,7 +90,7 @@ class UpdateSkillInvocationByIdStatusArg(str, Enum): PERMANENT_FAILURE = 'permanent_failure' -class UpdateSkillInvocationByIdMetadataArg(BaseObject): +class UpdateAllSkillCardsOnFileMetadata(BaseObject): def __init__( self, cards: Optional[ @@ -113,20 +113,20 @@ def __init__( self.cards = cards -class UpdateSkillInvocationByIdFileArgTypeField(str, Enum): +class UpdateAllSkillCardsOnFileFileTypeField(str, Enum): FILE = 'file' -class UpdateSkillInvocationByIdFileArg(BaseObject): +class UpdateAllSkillCardsOnFileFile(BaseObject): def __init__( self, - type: Optional[UpdateSkillInvocationByIdFileArgTypeField] = None, + type: Optional[UpdateAllSkillCardsOnFileFileTypeField] = None, id: Optional[str] = None, **kwargs ): """ :param type: `file` - :type type: Optional[UpdateSkillInvocationByIdFileArgTypeField], optional + :type type: Optional[UpdateAllSkillCardsOnFileFileTypeField], optional :param id: The ID of the file :type id: Optional[str], optional """ @@ -135,20 +135,20 @@ def __init__( self.id = id -class UpdateSkillInvocationByIdFileVersionArgTypeField(str, Enum): +class UpdateAllSkillCardsOnFileFileVersionTypeField(str, Enum): FILE_VERSION = 'file_version' -class UpdateSkillInvocationByIdFileVersionArg(BaseObject): +class UpdateAllSkillCardsOnFileFileVersion(BaseObject): def __init__( self, - type: Optional[UpdateSkillInvocationByIdFileVersionArgTypeField] = None, + type: Optional[UpdateAllSkillCardsOnFileFileVersionTypeField] = None, id: Optional[str] = None, **kwargs ): """ :param type: `file_version` - :type type: Optional[UpdateSkillInvocationByIdFileVersionArgTypeField], optional + :type type: Optional[UpdateAllSkillCardsOnFileFileVersionTypeField], optional :param id: The ID of the file version :type id: Optional[str], optional """ @@ -157,7 +157,7 @@ def __init__( self.id = id -class UpdateSkillInvocationByIdUsageArg(BaseObject): +class UpdateAllSkillCardsOnFileUsage(BaseObject): def __init__( self, unit: Optional[str] = None, value: Optional[float] = None, **kwargs ): @@ -176,12 +176,14 @@ class SkillsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_file_metadata_global_box_skills_cards( + def get_box_skill_cards_on_file( self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> SkillCardsMetadata: """ @@ -202,7 +204,8 @@ def get_file_metadata_global_box_skills_cards( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/global/boxSkillsCards', ]), @@ -216,7 +219,7 @@ def get_file_metadata_global_box_skills_cards( ) return deserialize(response.data, SkillCardsMetadata) - def create_file_metadata_global_box_skills_card( + def create_box_skill_cards_on_file( self, file_id: str, cards: List[ @@ -250,7 +253,8 @@ def create_file_metadata_global_box_skills_card( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/global/boxSkillsCards', ]), @@ -266,10 +270,10 @@ def create_file_metadata_global_box_skills_card( ) return deserialize(response.data, SkillCardsMetadata) - def update_file_metadata_global_box_skills_card( + def update_box_skill_cards_on_file( self, file_id: str, - request_body: List[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg], + request_body: List[UpdateBoxSkillCardsOnFileRequestBody], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> SkillCardsMetadata: """ @@ -282,8 +286,8 @@ def update_file_metadata_global_box_skills_card( the `file_id` is `123`. Example: "12345" :type file_id: str - :param request_body: Request body of updateFileMetadataGlobalBoxSkillsCard method - :type request_body: List[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg] + :param request_body: Request body of updateBoxSkillCardsOnFile method + :type request_body: List[UpdateBoxSkillCardsOnFileRequestBody] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -292,7 +296,8 @@ def update_file_metadata_global_box_skills_card( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/global/boxSkillsCards', ]), @@ -308,7 +313,7 @@ def update_file_metadata_global_box_skills_card( ) return deserialize(response.data, SkillCardsMetadata) - def delete_file_metadata_global_box_skills_card( + def delete_box_skill_cards_from_file( self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> None: """ @@ -329,7 +334,8 @@ def delete_file_metadata_global_box_skills_card( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/files/', + self.network_session.base_urls.base_url, + '/files/', to_string(file_id), '/metadata/global/boxSkillsCards', ]), @@ -343,14 +349,14 @@ def delete_file_metadata_global_box_skills_card( ) return None - def update_skill_invocation_by_id( + def update_all_skill_cards_on_file( self, skill_id: str, - status: UpdateSkillInvocationByIdStatusArg, - metadata: UpdateSkillInvocationByIdMetadataArg, - file: UpdateSkillInvocationByIdFileArg, - file_version: Optional[UpdateSkillInvocationByIdFileVersionArg] = None, - usage: Optional[UpdateSkillInvocationByIdUsageArg] = None, + status: UpdateAllSkillCardsOnFileStatus, + metadata: UpdateAllSkillCardsOnFileMetadata, + file: UpdateAllSkillCardsOnFileFile, + file_version: Optional[UpdateAllSkillCardsOnFileFileVersion] = None, + usage: Optional[UpdateAllSkillCardsOnFileUsage] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> None: """ @@ -362,19 +368,19 @@ def update_skill_invocation_by_id( Example: "33243242" :type skill_id: str :param status: Defines the status of this invocation. Set this to `success` when setting Skill cards. - :type status: UpdateSkillInvocationByIdStatusArg + :type status: UpdateAllSkillCardsOnFileStatus :param metadata: The metadata to set for this skill. This is a list of Box Skills cards. These cards will overwrite any existing Box skill cards on the file. - :type metadata: UpdateSkillInvocationByIdMetadataArg + :type metadata: UpdateAllSkillCardsOnFileMetadata :param file: The file to assign the cards to. - :type file: UpdateSkillInvocationByIdFileArg + :type file: UpdateAllSkillCardsOnFileFile :param file_version: The optional file version to assign the cards to. - :type file_version: Optional[UpdateSkillInvocationByIdFileVersionArg], optional + :type file_version: Optional[UpdateAllSkillCardsOnFileFileVersion], optional :param usage: 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. - :type usage: Optional[UpdateSkillInvocationByIdUsageArg], optional + :type usage: Optional[UpdateAllSkillCardsOnFileUsage], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -390,7 +396,9 @@ def update_skill_invocation_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/skill_invocations/', to_string(skill_id) + self.network_session.base_urls.base_url, + '/skill_invocations/', + to_string(skill_id), ]), FetchOptions( method='PUT', diff --git a/box_sdk_gen/managers/storage_policies.py b/box_sdk_gen/managers/storage_policies.py index 907c44e..1c55efb 100644 --- a/box_sdk_gen/managers/storage_policies.py +++ b/box_sdk_gen/managers/storage_policies.py @@ -39,8 +39,10 @@ class StoragePoliciesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -80,7 +82,7 @@ def get_storage_policies( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/storage_policies']), + ''.join([self.network_session.base_urls.base_url, '/storage_policies']), FetchOptions( method='GET', params=query_params_map, @@ -110,7 +112,8 @@ def get_storage_policy_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/storage_policies/', + self.network_session.base_urls.base_url, + '/storage_policies/', to_string(storage_policy_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/storage_policy_assignments.py b/box_sdk_gen/managers/storage_policy_assignments.py index 803f5fb..a959039 100644 --- a/box_sdk_gen/managers/storage_policy_assignments.py +++ b/box_sdk_gen/managers/storage_policy_assignments.py @@ -39,25 +39,25 @@ from box_sdk_gen.json_data import SerializedData -class GetStoragePolicyAssignmentsResolvedForTypeArg(str, Enum): +class GetStoragePolicyAssignmentsResolvedForType(str, Enum): USER = 'user' ENTERPRISE = 'enterprise' -class CreateStoragePolicyAssignmentStoragePolicyArgTypeField(str, Enum): +class CreateStoragePolicyAssignmentStoragePolicyTypeField(str, Enum): STORAGE_POLICY = 'storage_policy' -class CreateStoragePolicyAssignmentStoragePolicyArg(BaseObject): +class CreateStoragePolicyAssignmentStoragePolicy(BaseObject): def __init__( self, - type: CreateStoragePolicyAssignmentStoragePolicyArgTypeField, + type: CreateStoragePolicyAssignmentStoragePolicyTypeField, id: str, **kwargs ): """ :param type: The type to assign. - :type type: CreateStoragePolicyAssignmentStoragePolicyArgTypeField + :type type: CreateStoragePolicyAssignmentStoragePolicyTypeField :param id: The ID of the storage policy to assign. :type id: str """ @@ -66,21 +66,18 @@ def __init__( self.id = id -class CreateStoragePolicyAssignmentAssignedToArgTypeField(str, Enum): +class CreateStoragePolicyAssignmentAssignedToTypeField(str, Enum): USER = 'user' ENTERPRISE = 'enterprise' -class CreateStoragePolicyAssignmentAssignedToArg(BaseObject): +class CreateStoragePolicyAssignmentAssignedTo(BaseObject): def __init__( - self, - type: CreateStoragePolicyAssignmentAssignedToArgTypeField, - id: str, - **kwargs + self, type: CreateStoragePolicyAssignmentAssignedToTypeField, id: str, **kwargs ): """ :param type: The type to assign the policy to. - :type type: CreateStoragePolicyAssignmentAssignedToArgTypeField + :type type: CreateStoragePolicyAssignmentAssignedToTypeField :param id: The ID of the user or enterprise :type id: str """ @@ -89,20 +86,20 @@ def __init__( self.id = id -class UpdateStoragePolicyAssignmentByIdStoragePolicyArgTypeField(str, Enum): +class UpdateStoragePolicyAssignmentByIdStoragePolicyTypeField(str, Enum): STORAGE_POLICY = 'storage_policy' -class UpdateStoragePolicyAssignmentByIdStoragePolicyArg(BaseObject): +class UpdateStoragePolicyAssignmentByIdStoragePolicy(BaseObject): def __init__( self, - type: UpdateStoragePolicyAssignmentByIdStoragePolicyArgTypeField, + type: UpdateStoragePolicyAssignmentByIdStoragePolicyTypeField, id: str, **kwargs ): """ :param type: The type to assign. - :type type: UpdateStoragePolicyAssignmentByIdStoragePolicyArgTypeField + :type type: UpdateStoragePolicyAssignmentByIdStoragePolicyTypeField :param id: The ID of the storage policy to assign. :type id: str """ @@ -115,14 +112,16 @@ class StoragePolicyAssignmentsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def get_storage_policy_assignments( self, - resolved_for_type: GetStoragePolicyAssignmentsResolvedForTypeArg, + resolved_for_type: GetStoragePolicyAssignmentsResolvedForType, resolved_for_id: str, marker: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -130,7 +129,7 @@ def get_storage_policy_assignments( """ Fetches all the storage policy assignment for an enterprise or user. :param resolved_for_type: The target type to return assignments for - :type resolved_for_type: GetStoragePolicyAssignmentsResolvedForTypeArg + :type resolved_for_type: GetStoragePolicyAssignmentsResolvedForType :param resolved_for_id: The ID of the user or enterprise to return assignments for :type resolved_for_id: str :param marker: Defines the position marker at which to begin returning results. This is @@ -149,7 +148,9 @@ def get_storage_policy_assignments( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/storage_policy_assignments']), + ''.join( + [self.network_session.base_urls.base_url, '/storage_policy_assignments'] + ), FetchOptions( method='GET', params=query_params_map, @@ -163,18 +164,18 @@ def get_storage_policy_assignments( def create_storage_policy_assignment( self, - storage_policy: CreateStoragePolicyAssignmentStoragePolicyArg, - assigned_to: CreateStoragePolicyAssignmentAssignedToArg, + storage_policy: CreateStoragePolicyAssignmentStoragePolicy, + assigned_to: CreateStoragePolicyAssignmentAssignedTo, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> StoragePolicyAssignment: """ Creates a storage policy assignment for an enterprise or user. :param storage_policy: The storage policy to assign to the user or enterprise - :type storage_policy: CreateStoragePolicyAssignmentStoragePolicyArg + :type storage_policy: CreateStoragePolicyAssignmentStoragePolicy :param assigned_to: The user or enterprise to assign the storage policy to. - :type assigned_to: CreateStoragePolicyAssignmentAssignedToArg + :type assigned_to: CreateStoragePolicyAssignmentAssignedTo :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -186,7 +187,9 @@ def create_storage_policy_assignment( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/storage_policy_assignments']), + ''.join( + [self.network_session.base_urls.base_url, '/storage_policy_assignments'] + ), FetchOptions( method='POST', headers=headers_map, @@ -217,7 +220,8 @@ def get_storage_policy_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/storage_policy_assignments/', + self.network_session.base_urls.base_url, + '/storage_policy_assignments/', to_string(storage_policy_assignment_id), ]), FetchOptions( @@ -233,7 +237,7 @@ def get_storage_policy_assignment_by_id( def update_storage_policy_assignment_by_id( self, storage_policy_assignment_id: str, - storage_policy: UpdateStoragePolicyAssignmentByIdStoragePolicyArg, + storage_policy: UpdateStoragePolicyAssignmentByIdStoragePolicy, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> StoragePolicyAssignment: """ @@ -243,7 +247,7 @@ def update_storage_policy_assignment_by_id( :type storage_policy_assignment_id: str :param storage_policy: The storage policy to assign to the user or enterprise - :type storage_policy: UpdateStoragePolicyAssignmentByIdStoragePolicyArg + :type storage_policy: UpdateStoragePolicyAssignmentByIdStoragePolicy :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -253,7 +257,8 @@ def update_storage_policy_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/storage_policy_assignments/', + self.network_session.base_urls.base_url, + '/storage_policy_assignments/', to_string(storage_policy_assignment_id), ]), FetchOptions( @@ -301,7 +306,8 @@ def delete_storage_policy_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/storage_policy_assignments/', + self.network_session.base_urls.base_url, + '/storage_policy_assignments/', to_string(storage_policy_assignment_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/task_assignments.py b/box_sdk_gen/managers/task_assignments.py index 416fd38..76c7d44 100644 --- a/box_sdk_gen/managers/task_assignments.py +++ b/box_sdk_gen/managers/task_assignments.py @@ -39,24 +39,24 @@ from box_sdk_gen.json_data import SerializedData -class CreateTaskAssignmentTaskArgTypeField(str, Enum): +class CreateTaskAssignmentTaskTypeField(str, Enum): TASK = 'task' -class CreateTaskAssignmentTaskArg(BaseObject): - def __init__(self, id: str, type: CreateTaskAssignmentTaskArgTypeField, **kwargs): +class CreateTaskAssignmentTask(BaseObject): + def __init__(self, id: str, type: CreateTaskAssignmentTaskTypeField, **kwargs): """ :param id: The ID of the task :type id: str :param type: The type of the item to assign. - :type type: CreateTaskAssignmentTaskArgTypeField + :type type: CreateTaskAssignmentTaskTypeField """ super().__init__(**kwargs) self.id = id self.type = type -class CreateTaskAssignmentAssignToArg(BaseObject): +class CreateTaskAssignmentAssignTo(BaseObject): def __init__(self, id: Optional[str] = None, login: Optional[str] = None, **kwargs): """ :param id: The ID of the user to assign to the @@ -73,7 +73,7 @@ def __init__(self, id: Optional[str] = None, login: Optional[str] = None, **kwar self.login = login -class UpdateTaskAssignmentByIdResolutionStateArg(str, Enum): +class UpdateTaskAssignmentByIdResolutionState(str, Enum): COMPLETED = 'completed' INCOMPLETE = 'incomplete' APPROVED = 'approved' @@ -84,8 +84,10 @@ class TaskAssignmentsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -105,7 +107,10 @@ def get_task_assignments( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/tasks/', to_string(task_id), '/assignments' + self.network_session.base_urls.base_url, + '/tasks/', + to_string(task_id), + '/assignments', ]), FetchOptions( method='GET', @@ -119,8 +124,8 @@ def get_task_assignments( def create_task_assignment( self, - task: CreateTaskAssignmentTaskArg, - assign_to: CreateTaskAssignmentAssignToArg, + task: CreateTaskAssignmentTask, + assign_to: CreateTaskAssignmentAssignTo, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> TaskAssignment: """ @@ -132,9 +137,9 @@ def create_task_assignment( assignments. :param task: The task to assign to a user. - :type task: CreateTaskAssignmentTaskArg + :type task: CreateTaskAssignmentTask :param assign_to: The user to assign the task to. - :type assign_to: CreateTaskAssignmentAssignToArg + :type assign_to: CreateTaskAssignmentAssignTo :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -143,7 +148,7 @@ def create_task_assignment( request_body: Dict = {'task': task, 'assign_to': assign_to} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/task_assignments']), + ''.join([self.network_session.base_urls.base_url, '/task_assignments']), FetchOptions( method='POST', headers=headers_map, @@ -174,7 +179,8 @@ def get_task_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/task_assignments/', + self.network_session.base_urls.base_url, + '/task_assignments/', to_string(task_assignment_id), ]), FetchOptions( @@ -191,7 +197,7 @@ def update_task_assignment_by_id( self, task_assignment_id: str, message: Optional[str] = None, - resolution_state: Optional[UpdateTaskAssignmentByIdResolutionStateArg] = None, + resolution_state: Optional[UpdateTaskAssignmentByIdResolutionState] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> TaskAssignment: """ @@ -209,7 +215,7 @@ def update_task_assignment_by_id( `incomplete` or `completed`. * For a task with an `action` of `review` this can be `incomplete`, `approved`, or `rejected`. - :type resolution_state: Optional[UpdateTaskAssignmentByIdResolutionStateArg], optional + :type resolution_state: Optional[UpdateTaskAssignmentByIdResolutionState], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -219,7 +225,8 @@ def update_task_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/task_assignments/', + self.network_session.base_urls.base_url, + '/task_assignments/', to_string(task_assignment_id), ]), FetchOptions( @@ -252,7 +259,8 @@ def delete_task_assignment_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/task_assignments/', + self.network_session.base_urls.base_url, + '/task_assignments/', to_string(task_assignment_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/tasks.py b/box_sdk_gen/managers/tasks.py index 56fc2bb..c6c4221 100644 --- a/box_sdk_gen/managers/tasks.py +++ b/box_sdk_gen/managers/tasks.py @@ -39,44 +39,44 @@ from box_sdk_gen.json_data import SerializedData -class CreateTaskItemArgTypeField(str, Enum): +class CreateTaskItemTypeField(str, Enum): FILE = 'file' -class CreateTaskItemArg(BaseObject): +class CreateTaskItem(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[CreateTaskItemArgTypeField] = None, + type: Optional[CreateTaskItemTypeField] = None, **kwargs ): """ :param id: The ID of the file :type id: Optional[str], optional :param type: `file` - :type type: Optional[CreateTaskItemArgTypeField], optional + :type type: Optional[CreateTaskItemTypeField], optional """ super().__init__(**kwargs) self.id = id self.type = type -class CreateTaskActionArg(str, Enum): +class CreateTaskAction(str, Enum): REVIEW = 'review' COMPLETE = 'complete' -class CreateTaskCompletionRuleArg(str, Enum): +class CreateTaskCompletionRule(str, Enum): ALL_ASSIGNEES = 'all_assignees' ANY_ASSIGNEE = 'any_assignee' -class UpdateTaskByIdActionArg(str, Enum): +class UpdateTaskByIdAction(str, Enum): REVIEW = 'review' COMPLETE = 'complete' -class UpdateTaskByIdCompletionRuleArg(str, Enum): +class UpdateTaskByIdCompletionRule(str, Enum): ALL_ASSIGNEES = 'all_assignees' ANY_ASSIGNEE = 'any_assignee' @@ -85,8 +85,10 @@ class TasksManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -113,7 +115,12 @@ def get_file_tasks( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/files/', to_string(file_id), '/tasks']), + ''.join([ + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/tasks', + ]), FetchOptions( method='GET', headers=headers_map, @@ -126,11 +133,11 @@ def get_file_tasks( def create_task( self, - item: CreateTaskItemArg, - action: Optional[CreateTaskActionArg] = None, + item: CreateTaskItem, + action: Optional[CreateTaskAction] = None, message: Optional[str] = None, due_at: Optional[str] = None, - completion_rule: Optional[CreateTaskCompletionRuleArg] = None, + completion_rule: Optional[CreateTaskCompletionRule] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Task: """ @@ -139,12 +146,12 @@ def create_task( will need to be assigned separately. :param item: The file to attach the task to. - :type item: CreateTaskItemArg + :type item: CreateTaskItem :param action: 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 - :type action: Optional[CreateTaskActionArg], optional + :type action: Optional[CreateTaskAction], optional :param message: An optional message to include with the task. :type message: Optional[str], optional :param due_at: Defines when the task is due. Defaults to `null` if not @@ -156,7 +163,7 @@ def create_task( 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. - :type completion_rule: Optional[CreateTaskCompletionRuleArg], optional + :type completion_rule: Optional[CreateTaskCompletionRule], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -171,7 +178,7 @@ def create_task( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/tasks']), + ''.join([self.network_session.base_urls.base_url, '/tasks']), FetchOptions( method='POST', headers=headers_map, @@ -199,7 +206,9 @@ def get_task_by_id( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/tasks/', to_string(task_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/tasks/', to_string(task_id)] + ), FetchOptions( method='GET', headers=headers_map, @@ -213,10 +222,10 @@ def get_task_by_id( def update_task_by_id( self, task_id: str, - action: Optional[UpdateTaskByIdActionArg] = None, + action: Optional[UpdateTaskByIdAction] = None, message: Optional[str] = None, due_at: Optional[str] = None, - completion_rule: Optional[UpdateTaskByIdCompletionRuleArg] = None, + completion_rule: Optional[UpdateTaskByIdCompletionRule] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Task: """ @@ -231,7 +240,7 @@ def update_task_by_id( * `review` defines an approval task that can be approved or rejected * `complete` defines a general task which can be completed - :type action: Optional[UpdateTaskByIdActionArg], optional + :type action: Optional[UpdateTaskByIdAction], optional :param message: The message included with the task. :type message: Optional[str], optional :param due_at: When the task is due at. @@ -242,7 +251,7 @@ def update_task_by_id( 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. - :type completion_rule: Optional[UpdateTaskByIdCompletionRuleArg], optional + :type completion_rule: Optional[UpdateTaskByIdCompletionRule], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -256,7 +265,9 @@ def update_task_by_id( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/tasks/', to_string(task_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/tasks/', to_string(task_id)] + ), FetchOptions( method='PUT', headers=headers_map, @@ -284,7 +295,9 @@ def delete_task_by_id( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/tasks/', to_string(task_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/tasks/', to_string(task_id)] + ), FetchOptions( method='DELETE', headers=headers_map, 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 a42a6c3..429c12c 100644 --- a/box_sdk_gen/managers/terms_of_service_user_statuses.py +++ b/box_sdk_gen/managers/terms_of_service_user_statuses.py @@ -39,17 +39,17 @@ from box_sdk_gen.json_data import SerializedData -class CreateTermOfServiceUserStatusTosArgTypeField(str, Enum): +class CreateTermsOfServiceStatusForUserTosTypeField(str, Enum): TERMS_OF_SERVICE = 'terms_of_service' -class CreateTermOfServiceUserStatusTosArg(BaseObject): +class CreateTermsOfServiceStatusForUserTos(BaseObject): def __init__( - self, type: CreateTermOfServiceUserStatusTosArgTypeField, id: str, **kwargs + self, type: CreateTermsOfServiceStatusForUserTosTypeField, id: str, **kwargs ): """ :param type: The type of object. - :type type: CreateTermOfServiceUserStatusTosArgTypeField + :type type: CreateTermsOfServiceStatusForUserTosTypeField :param id: The ID of terms of service :type id: str """ @@ -58,17 +58,17 @@ def __init__( self.id = id -class CreateTermOfServiceUserStatusUserArgTypeField(str, Enum): +class CreateTermsOfServiceStatusForUserUserTypeField(str, Enum): USER = 'user' -class CreateTermOfServiceUserStatusUserArg(BaseObject): +class CreateTermsOfServiceStatusForUserUser(BaseObject): def __init__( - self, type: CreateTermOfServiceUserStatusUserArgTypeField, id: str, **kwargs + self, type: CreateTermsOfServiceStatusForUserUserTypeField, id: str, **kwargs ): """ :param type: The type of object. - :type type: CreateTermOfServiceUserStatusUserArgTypeField + :type type: CreateTermsOfServiceStatusForUserUserTypeField :param id: The ID of user :type id: str """ @@ -81,12 +81,14 @@ class TermsOfServiceUserStatusesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_term_of_service_user_statuses( + def get_terms_of_service_user_statuses( self, tos_id: str, user_id: Optional[str] = None, @@ -109,12 +111,15 @@ def get_term_of_service_user_statuses( """ 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']), + ''.join([ + self.network_session.base_urls.base_url, + '/terms_of_service_user_statuses', + ]), FetchOptions( method='GET', params=query_params_map, @@ -126,19 +131,19 @@ def get_term_of_service_user_statuses( ) return deserialize(response.data, TermsOfServiceUserStatuses) - def create_term_of_service_user_status( + def create_terms_of_service_status_for_user( self, - tos: CreateTermOfServiceUserStatusTosArg, - user: CreateTermOfServiceUserStatusUserArg, + tos: CreateTermsOfServiceStatusForUserTos, + user: CreateTermsOfServiceStatusForUserUser, 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. - :type tos: CreateTermOfServiceUserStatusTosArg + :type tos: CreateTermsOfServiceStatusForUserTos :param user: The user to set the status for. - :type user: CreateTermOfServiceUserStatusUserArg + :type user: CreateTermsOfServiceStatusForUserUser :param is_accepted: Whether the user has accepted the terms. :type is_accepted: bool :param extra_headers: Extra headers that will be included in the HTTP request. @@ -149,7 +154,10 @@ def create_term_of_service_user_status( request_body: Dict = {'tos': tos, 'user': user, 'is_accepted': is_accepted} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/terms_of_service_user_statuses']), + ''.join([ + self.network_session.base_urls.base_url, + '/terms_of_service_user_statuses', + ]), FetchOptions( method='POST', headers=headers_map, @@ -162,7 +170,7 @@ def create_term_of_service_user_status( ) return deserialize(response.data, TermsOfServiceUserStatus) - def update_term_of_service_user_status_by_id( + def update_terms_of_service_status_for_user_by_id( self, terms_of_service_user_status_id: str, is_accepted: bool, @@ -184,7 +192,8 @@ def update_term_of_service_user_status_by_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/', + self.network_session.base_urls.base_url, + '/terms_of_service_user_statuses/', to_string(terms_of_service_user_status_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/terms_of_services.py b/box_sdk_gen/managers/terms_of_services.py index 93379ca..6a9a60a 100644 --- a/box_sdk_gen/managers/terms_of_services.py +++ b/box_sdk_gen/managers/terms_of_services.py @@ -39,22 +39,22 @@ from box_sdk_gen.json_data import SerializedData -class GetTermOfServicesTosTypeArg(str, Enum): +class GetTermsOfServiceTosType(str, Enum): EXTERNAL = 'external' MANAGED = 'managed' -class CreateTermOfServiceStatusArg(str, Enum): +class CreateTermsOfServiceStatus(str, Enum): ENABLED = 'enabled' DISABLED = 'disabled' -class CreateTermOfServiceTosTypeArg(str, Enum): +class CreateTermsOfServiceTosType(str, Enum): EXTERNAL = 'external' MANAGED = 'managed' -class UpdateTermOfServiceByIdStatusArg(str, Enum): +class UpdateTermsOfServiceByIdStatus(str, Enum): ENABLED = 'enabled' DISABLED = 'disabled' @@ -63,14 +63,16 @@ class TermsOfServicesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_term_of_services( + def get_terms_of_service( self, - tos_type: Optional[GetTermOfServicesTosTypeArg] = None, + tos_type: Optional[GetTermsOfServiceTosType] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> TermsOfServices: """ @@ -79,18 +81,18 @@ def get_term_of_services( for the enterprise. :param tos_type: Limits the results to the terms of service of the given type. - :type tos_type: Optional[GetTermOfServicesTosTypeArg], optional + :type tos_type: Optional[GetTermsOfServiceTosType], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ if extra_headers is None: extra_headers = {} - 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']), + ''.join([self.network_session.base_urls.base_url, '/terms_of_services']), FetchOptions( method='GET', params=query_params_map, @@ -102,11 +104,11 @@ def get_term_of_services( ) return deserialize(response.data, TermsOfServices) - def create_term_of_service( + def create_terms_of_service( self, - status: CreateTermOfServiceStatusArg, + status: CreateTermsOfServiceStatus, text: str, - tos_type: Optional[CreateTermOfServiceTosTypeArg] = None, + tos_type: Optional[CreateTermsOfServiceTosType] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Task: """ @@ -115,13 +117,13 @@ def create_term_of_service( and type of user. :param status: Whether this terms of service is active. - :type status: CreateTermOfServiceStatusArg + :type status: CreateTermsOfServiceStatus :param text: The terms of service text to display to users. The text can be set to empty if the `status` is set to `disabled`. :type text: str :param tos_type: The type of user to set the terms of service for. - :type tos_type: Optional[CreateTermOfServiceTosTypeArg], optional + :type tos_type: Optional[CreateTermsOfServiceTosType], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -130,7 +132,7 @@ def create_term_of_service( request_body: Dict = {'status': status, 'tos_type': tos_type, 'text': text} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/terms_of_services']), + ''.join([self.network_session.base_urls.base_url, '/terms_of_services']), FetchOptions( method='POST', headers=headers_map, @@ -143,7 +145,7 @@ def create_term_of_service( ) return deserialize(response.data, Task) - def get_term_of_service_by_id( + def get_terms_of_service_by_id( self, terms_of_service_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -161,7 +163,8 @@ def get_term_of_service_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/terms_of_services/', + self.network_session.base_urls.base_url, + '/terms_of_services/', to_string(terms_of_service_id), ]), FetchOptions( @@ -174,10 +177,10 @@ def get_term_of_service_by_id( ) return deserialize(response.data, TermsOfService) - def update_term_of_service_by_id( + def update_terms_of_service_by_id( self, terms_of_service_id: str, - status: UpdateTermOfServiceByIdStatusArg, + status: UpdateTermsOfServiceByIdStatus, text: str, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> TermsOfService: @@ -187,7 +190,7 @@ def update_term_of_service_by_id( Example: "324234" :type terms_of_service_id: str :param status: Whether this terms of service is active. - :type status: UpdateTermOfServiceByIdStatusArg + :type status: UpdateTermsOfServiceByIdStatus :param text: The terms of service text to display to users. The text can be set to empty if the `status` is set to `disabled`. :type text: str @@ -200,7 +203,8 @@ def update_term_of_service_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/terms_of_services/', + self.network_session.base_urls.base_url, + '/terms_of_services/', to_string(terms_of_service_id), ]), FetchOptions( diff --git a/box_sdk_gen/managers/transfer.py b/box_sdk_gen/managers/transfer.py index 31842ad..f8e1d43 100644 --- a/box_sdk_gen/managers/transfer.py +++ b/box_sdk_gen/managers/transfer.py @@ -37,7 +37,7 @@ from box_sdk_gen.json_data import SerializedData -class TransferOwnedFolderOwnedByArg(BaseObject): +class TransferOwnedFolderOwnedBy(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of the user who the folder will be @@ -52,15 +52,17 @@ class TransferManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def transfer_owned_folder( self, user_id: str, - owned_by: TransferOwnedFolderOwnedByArg, + owned_by: TransferOwnedFolderOwnedBy, fields: Optional[List[str]] = None, notify: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -137,7 +139,7 @@ def transfer_owned_folder( Example: "12345" :type user_id: str :param owned_by: The user who the folder will be transferred to - :type owned_by: TransferOwnedFolderOwnedByArg + :type owned_by: TransferOwnedFolderOwnedBy :param fields: 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. @@ -156,13 +158,16 @@ def transfer_owned_folder( if extra_headers is None: extra_headers = {} request_body: Dict = {'owned_by': owned_by} - query_params_map: Dict[str, str] = prepare_params({ - 'fields': to_string(fields), 'notify': to_string(notify) - }) + 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/', to_string(user_id), '/folders/0' + self.network_session.base_urls.base_url, + '/users/', + to_string(user_id), + '/folders/0', ]), FetchOptions( method='PUT', diff --git a/box_sdk_gen/managers/trashed_files.py b/box_sdk_gen/managers/trashed_files.py index 8f2ff8f..b0200fe 100644 --- a/box_sdk_gen/managers/trashed_files.py +++ b/box_sdk_gen/managers/trashed_files.py @@ -39,7 +39,7 @@ from box_sdk_gen.json_data import SerializedData -class RestoreFileFromTrashParentArg(BaseObject): +class RestoreFileFromTrashParent(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ :param id: The ID of parent item @@ -53,8 +53,10 @@ class TrashedFilesManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -62,7 +64,7 @@ def restore_file_from_trash( self, file_id: str, name: Optional[str] = None, - parent: Optional[RestoreFileFromTrashParentArg] = None, + parent: Optional[RestoreFileFromTrashParent] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> TrashFileRestored: @@ -102,7 +104,9 @@ def restore_file_from_trash( 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/', to_string(file_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/files/', to_string(file_id)] + ), FetchOptions( method='POST', params=query_params_map, @@ -116,7 +120,7 @@ def restore_file_from_trash( ) return deserialize(response.data, TrashFileRestored) - def get_file_trash( + def get_trashed_file_by_id( self, file_id: str, fields: Optional[List[str]] = None, @@ -173,7 +177,12 @@ def get_file_trash( 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/', to_string(file_id), '/trash']), + ''.join([ + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/trash', + ]), FetchOptions( method='GET', params=query_params_map, @@ -185,7 +194,7 @@ def get_file_trash( ) return deserialize(response.data, TrashFile) - def delete_file_trash( + def delete_trashed_file_by_id( self, file_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> None: """ @@ -208,7 +217,12 @@ def delete_file_trash( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/files/', to_string(file_id), '/trash']), + ''.join([ + self.network_session.base_urls.base_url, + '/files/', + to_string(file_id), + '/trash', + ]), FetchOptions( method='DELETE', headers=headers_map, diff --git a/box_sdk_gen/managers/trashed_folders.py b/box_sdk_gen/managers/trashed_folders.py index b9a485f..d6a8b27 100644 --- a/box_sdk_gen/managers/trashed_folders.py +++ b/box_sdk_gen/managers/trashed_folders.py @@ -39,7 +39,7 @@ from box_sdk_gen.json_data import SerializedData -class RestoreFolderFromTrashParentArg(BaseObject): +class RestoreFolderFromTrashParent(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ :param id: The ID of parent item @@ -53,8 +53,10 @@ class TrashedFoldersManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -62,7 +64,7 @@ def restore_folder_from_trash( self, folder_id: str, name: Optional[str] = None, - parent: Optional[RestoreFolderFromTrashParentArg] = None, + parent: Optional[RestoreFolderFromTrashParent] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> TrashFolderRestored: @@ -122,7 +124,11 @@ def restore_folder_from_trash( 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/', to_string(folder_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + ]), FetchOptions( method='POST', params=query_params_map, @@ -136,7 +142,7 @@ def restore_folder_from_trash( ) return deserialize(response.data, TrashFolderRestored) - def get_folder_trash( + def get_trashed_folder_by_id( self, folder_id: str, fields: Optional[List[str]] = None, @@ -196,7 +202,10 @@ def get_folder_trash( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', to_string(folder_id), '/trash' + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + '/trash', ]), FetchOptions( method='GET', @@ -209,7 +218,7 @@ def get_folder_trash( ) return deserialize(response.data, TrashFolder) - def delete_folder_trash( + def delete_trashed_folder_by_id( self, folder_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> None: """ @@ -235,7 +244,10 @@ def delete_folder_trash( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/folders/', to_string(folder_id), '/trash' + self.network_session.base_urls.base_url, + '/folders/', + to_string(folder_id), + '/trash', ]), FetchOptions( method='DELETE', diff --git a/box_sdk_gen/managers/trashed_items.py b/box_sdk_gen/managers/trashed_items.py index fcdfa8b..e009927 100644 --- a/box_sdk_gen/managers/trashed_items.py +++ b/box_sdk_gen/managers/trashed_items.py @@ -35,12 +35,12 @@ from box_sdk_gen.json_data import SerializedData -class GetFolderTrashItemsDirectionArg(str, Enum): +class GetTrashedItemsDirection(str, Enum): ASC = 'ASC' DESC = 'DESC' -class GetFolderTrashItemsSortArg(str, Enum): +class GetTrashedItemsSort(str, Enum): NAME = 'name' DATE = 'date' SIZE = 'size' @@ -50,20 +50,22 @@ class TrashedItemsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session - def get_folder_trash_items( + def get_trashed_items( self, fields: Optional[List[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, + direction: Optional[GetTrashedItemsDirection] = None, + sort: Optional[GetTrashedItemsSort] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Items: """ @@ -115,14 +117,14 @@ def get_folder_trash_items( :type marker: Optional[str], optional :param direction: The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order. - :type direction: Optional[GetFolderTrashItemsDirectionArg], optional + :type direction: Optional[GetTrashedItemsDirection], optional :param sort: 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. - :type sort: Optional[GetFolderTrashItemsSortArg], optional + :type sort: Optional[GetTrashedItemsSort], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -139,7 +141,7 @@ def get_folder_trash_items( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/folders/trash/items']), + ''.join([self.network_session.base_urls.base_url, '/folders/trash/items']), FetchOptions( method='GET', params=query_params_map, diff --git a/box_sdk_gen/managers/trashed_web_links.py b/box_sdk_gen/managers/trashed_web_links.py index 4039257..53cb4fd 100644 --- a/box_sdk_gen/managers/trashed_web_links.py +++ b/box_sdk_gen/managers/trashed_web_links.py @@ -39,7 +39,7 @@ from box_sdk_gen.json_data import SerializedData -class RestoreWeblinkFromTrashParentArg(BaseObject): +class RestoreWeblinkFromTrashParent(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ :param id: The ID of parent item @@ -53,8 +53,10 @@ class TrashedWebLinksManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -62,7 +64,7 @@ def restore_weblink_from_trash( self, web_link_id: str, name: Optional[str] = None, - parent: Optional[RestoreWeblinkFromTrashParentArg] = None, + parent: Optional[RestoreWeblinkFromTrashParent] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> TrashWebLinkRestored: @@ -97,7 +99,11 @@ def restore_weblink_from_trash( 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/', to_string(web_link_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/web_links/', + to_string(web_link_id), + ]), FetchOptions( method='POST', params=query_params_map, @@ -111,7 +117,7 @@ def restore_weblink_from_trash( ) return deserialize(response.data, TrashWebLinkRestored) - def get_web_link_trash( + def get_trashed_web_link_by_id( self, web_link_id: str, fields: Optional[List[str]] = None, @@ -140,7 +146,10 @@ def get_web_link_trash( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/web_links/', to_string(web_link_id), '/trash' + self.network_session.base_urls.base_url, + '/web_links/', + to_string(web_link_id), + '/trash', ]), FetchOptions( method='GET', @@ -153,7 +162,7 @@ def get_web_link_trash( ) return deserialize(response.data, TrashWebLink) - def delete_web_link_trash( + def delete_trashed_web_link_by_id( self, web_link_id: str, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> None: """ @@ -172,7 +181,10 @@ def delete_web_link_trash( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/web_links/', to_string(web_link_id), '/trash' + self.network_session.base_urls.base_url, + '/web_links/', + to_string(web_link_id), + '/trash', ]), FetchOptions( method='DELETE', diff --git a/box_sdk_gen/managers/uploads.py b/box_sdk_gen/managers/uploads.py index 872ee78..c14177e 100644 --- a/box_sdk_gen/managers/uploads.py +++ b/box_sdk_gen/managers/uploads.py @@ -43,7 +43,7 @@ from box_sdk_gen.json_data import SerializedData -class UploadFileVersionAttributesArg(BaseObject): +class UploadFileVersionAttributes(BaseObject): def __init__(self, name: str, content_modified_at: Optional[str] = None, **kwargs): """ :param name: An optional new name for the file. If specified, the file @@ -58,7 +58,7 @@ def __init__(self, name: str, content_modified_at: Optional[str] = None, **kwarg self.content_modified_at = content_modified_at -class UploadFileAttributesArgParentField(BaseObject): +class UploadFileAttributesParentField(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The id of the parent folder. Use @@ -69,11 +69,11 @@ def __init__(self, id: str, **kwargs): self.id = id -class UploadFileAttributesArg(BaseObject): +class UploadFileAttributes(BaseObject): def __init__( self, name: str, - parent: UploadFileAttributesArgParentField, + parent: UploadFileAttributesParentField, content_created_at: Optional[str] = None, content_modified_at: Optional[str] = None, **kwargs @@ -82,7 +82,7 @@ def __init__( :param name: The name of the file :type name: str :param parent: The parent folder to upload the file to - :type parent: UploadFileAttributesArgParentField + :type parent: UploadFileAttributesParentField :param content_created_at: Defines the time the file was originally created at. If not set, the upload time will be used. :type content_created_at: Optional[str], optional @@ -97,7 +97,7 @@ def __init__( self.content_modified_at = content_modified_at -class PreflightFileUploadParentArg(BaseObject): +class PreflightFileUploadCheckParent(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ :param id: The ID of parent item @@ -111,15 +111,17 @@ class UploadsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def upload_file_version( self, file_id: str, - attributes: UploadFileVersionAttributesArg, + attributes: UploadFileVersionAttributes, file: ByteStream, file_file_name: Optional[str] = None, file_content_type: Optional[str] = None, @@ -165,7 +167,7 @@ def upload_file_version( uploading the file will receive a HTTP `400` error with a `metadata_after_file_contents` error code. - :type attributes: UploadFileVersionAttributesArg + :type attributes: UploadFileVersionAttributes :param file: The content of the file to upload to Box. The `attributes` part of the body must come **before** the @@ -212,7 +214,10 @@ def upload_file_version( }) response: FetchResponse = fetch( ''.join([ - 'https://upload.box.com/api/2.0/files/', to_string(file_id), '/content' + self.network_session.base_urls.upload_url, + '/files/', + to_string(file_id), + '/content', ]), FetchOptions( method='POST', @@ -240,7 +245,7 @@ def upload_file_version( def upload_file( self, - attributes: UploadFileAttributesArg, + attributes: UploadFileAttributes, file: ByteStream, file_file_name: Optional[str] = None, file_content_type: Optional[str] = None, @@ -277,7 +282,7 @@ def upload_file( uploading the file will receive a HTTP `400` error with a `metadata_after_file_contents` error code. - :type attributes: UploadFileAttributesArg + :type attributes: UploadFileAttributes :param file: The content of the file to upload to Box. The `attributes` part of the body must come **before** the @@ -310,11 +315,11 @@ def upload_file( '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 - }) + 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']), + ''.join([self.network_session.base_urls.upload_url, '/files/content']), FetchOptions( method='POST', params=query_params_map, @@ -339,11 +344,11 @@ def upload_file( ) return deserialize(response.data, Files) - def preflight_file_upload( + def preflight_file_upload_check( self, name: Optional[str] = None, size: Optional[int] = None, - parent: Optional[PreflightFileUploadParentArg] = None, + parent: Optional[PreflightFileUploadCheckParent] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> UploadUrl: """ @@ -363,7 +368,7 @@ def preflight_file_upload( request_body: Dict = {'name': name, 'size': size, 'parent': parent} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/files/content']), + ''.join([self.network_session.base_urls.base_url, '/files/content']), FetchOptions( method='OPTIONS', headers=headers_map, diff --git a/box_sdk_gen/managers/user_collaborations.py b/box_sdk_gen/managers/user_collaborations.py index 73f91a7..8fcbc28 100644 --- a/box_sdk_gen/managers/user_collaborations.py +++ b/box_sdk_gen/managers/user_collaborations.py @@ -39,7 +39,7 @@ from box_sdk_gen.json_data import SerializedData -class UpdateCollaborationByIdRoleArg(str, Enum): +class UpdateCollaborationByIdRole(str, Enum): EDITOR = 'editor' VIEWER = 'viewer' PREVIEWER = 'previewer' @@ -50,28 +50,28 @@ class UpdateCollaborationByIdRoleArg(str, Enum): OWNER = 'owner' -class UpdateCollaborationByIdStatusArg(str, Enum): +class UpdateCollaborationByIdStatus(str, Enum): PENDING = 'pending' ACCEPTED = 'accepted' REJECTED = 'rejected' -class CreateCollaborationItemArgTypeField(str, Enum): +class CreateCollaborationItemTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' -class CreateCollaborationItemArg(BaseObject): +class CreateCollaborationItem(BaseObject): def __init__( self, - type: Optional[CreateCollaborationItemArgTypeField] = None, + type: Optional[CreateCollaborationItemTypeField] = None, id: Optional[str] = None, **kwargs ): """ :param type: The type of the item that this collaboration will be granted access to - :type type: Optional[CreateCollaborationItemArgTypeField], optional + :type type: Optional[CreateCollaborationItemTypeField], optional :param id: The ID of the item that will be granted access to :type id: Optional[str], optional """ @@ -80,22 +80,22 @@ def __init__( self.id = id -class CreateCollaborationAccessibleByArgTypeField(str, Enum): +class CreateCollaborationAccessibleByTypeField(str, Enum): USER = 'user' GROUP = 'group' -class CreateCollaborationAccessibleByArg(BaseObject): +class CreateCollaborationAccessibleBy(BaseObject): def __init__( self, - type: CreateCollaborationAccessibleByArgTypeField, + type: CreateCollaborationAccessibleByTypeField, id: Optional[str] = None, login: Optional[str] = None, **kwargs ): """ :param type: The type of collaborator to invite. - :type type: CreateCollaborationAccessibleByArgTypeField + :type type: CreateCollaborationAccessibleByTypeField :param id: The ID of the user or group. Alternatively, use `login` to specify a user by email address. @@ -110,7 +110,7 @@ def __init__( self.login = login -class CreateCollaborationRoleArg(str, Enum): +class CreateCollaborationRole(str, Enum): EDITOR = 'editor' VIEWER = 'viewer' PREVIEWER = 'previewer' @@ -124,8 +124,10 @@ class UserCollaborationsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -158,7 +160,9 @@ def get_collaboration_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/collaborations/', to_string(collaboration_id) + self.network_session.base_urls.base_url, + '/collaborations/', + to_string(collaboration_id), ]), FetchOptions( method='GET', @@ -174,8 +178,8 @@ def get_collaboration_by_id( def update_collaboration_by_id( self, collaboration_id: str, - role: UpdateCollaborationByIdRoleArg, - status: Optional[UpdateCollaborationByIdStatusArg] = None, + role: UpdateCollaborationByIdRole, + status: Optional[UpdateCollaborationByIdStatus] = None, expires_at: Optional[str] = None, can_view_path: Optional[bool] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -192,11 +196,11 @@ def update_collaboration_by_id( Example: "1234" :type collaboration_id: str :param role: The level of access granted. - :type role: UpdateCollaborationByIdRoleArg + :type role: UpdateCollaborationByIdRole :param status: Set the status of a `pending` collaboration invitation, effectively accepting, or rejecting the invite. - :type status: Optional[UpdateCollaborationByIdStatusArg], optional + :type status: Optional[UpdateCollaborationByIdStatus], optional :param expires_at: 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 @@ -234,7 +238,9 @@ def update_collaboration_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/collaborations/', to_string(collaboration_id) + self.network_session.base_urls.base_url, + '/collaborations/', + to_string(collaboration_id), ]), FetchOptions( method='PUT', @@ -266,7 +272,9 @@ def delete_collaboration_by_id( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/collaborations/', to_string(collaboration_id) + self.network_session.base_urls.base_url, + '/collaborations/', + to_string(collaboration_id), ]), FetchOptions( method='DELETE', @@ -280,9 +288,9 @@ def delete_collaboration_by_id( def create_collaboration( self, - item: CreateCollaborationItemArg, - accessible_by: CreateCollaborationAccessibleByArg, - role: CreateCollaborationRoleArg, + item: CreateCollaborationItem, + accessible_by: CreateCollaborationAccessibleBy, + role: CreateCollaborationRole, is_access_only: Optional[bool] = None, can_view_path: Optional[bool] = None, expires_at: Optional[str] = None, @@ -323,11 +331,11 @@ def create_collaboration( - `name` is hidden if a collaboration was created using `login`. :param item: The item to attach the comment to. - :type item: CreateCollaborationItemArg + :type item: CreateCollaborationItem :param accessible_by: The user or group to give access to the item. - :type accessible_by: CreateCollaborationAccessibleByArg + :type accessible_by: CreateCollaborationAccessibleBy :param role: The level of access granted. - :type role: CreateCollaborationRoleArg + :type role: CreateCollaborationRole :param is_access_only: If set to `true`, collaborators have access to shared items, but such items won't be visible in the All Files list. Additionally, collaborators won't @@ -379,12 +387,12 @@ def create_collaboration( '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) - }) + 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']), + ''.join([self.network_session.base_urls.base_url, '/collaborations']), FetchOptions( method='POST', params=query_params_map, diff --git a/box_sdk_gen/managers/users.py b/box_sdk_gen/managers/users.py index 0b639ef..67f6fcb 100644 --- a/box_sdk_gen/managers/users.py +++ b/box_sdk_gen/managers/users.py @@ -43,37 +43,37 @@ from box_sdk_gen.json_data import SerializedData -class GetUsersUserTypeArg(str, Enum): +class GetUsersUserType(str, Enum): ALL = 'all' MANAGED = 'managed' EXTERNAL = 'external' -class CreateUserRoleArg(str, Enum): +class CreateUserRole(str, Enum): COADMIN = 'coadmin' USER = 'user' -class CreateUserStatusArg(str, Enum): +class CreateUserStatus(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' CANNOT_DELETE_EDIT = 'cannot_delete_edit' CANNOT_DELETE_EDIT_UPLOAD = 'cannot_delete_edit_upload' -class UpdateUserByIdRoleArg(str, Enum): +class UpdateUserByIdRole(str, Enum): COADMIN = 'coadmin' USER = 'user' -class UpdateUserByIdStatusArg(str, Enum): +class UpdateUserByIdStatus(str, Enum): ACTIVE = 'active' INACTIVE = 'inactive' CANNOT_DELETE_EDIT = 'cannot_delete_edit' CANNOT_DELETE_EDIT_UPLOAD = 'cannot_delete_edit_upload' -class UpdateUserByIdNotificationEmailArg(BaseObject): +class UpdateUserByIdNotificationEmail(BaseObject): def __init__(self, email: Optional[str] = None, **kwargs): """ :param email: The email address to send the notifications to. @@ -87,15 +87,17 @@ class UsersManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def get_users( self, filter_term: Optional[str] = None, - user_type: Optional[GetUsersUserTypeArg] = None, + user_type: Optional[GetUsersUserType] = None, external_app_user_id: Optional[str] = None, fields: Optional[List[str]] = None, offset: Optional[int] = None, @@ -135,7 +137,7 @@ def get_users( `filter_term`. * `external` returns all external users for whom the `login` matches the `filter_term` exactly. - :type user_type: Optional[GetUsersUserTypeArg], optional + :type user_type: Optional[GetUsersUserType], optional :param external_app_user_id: Limits the results to app users with the given `external_app_user_id` value. When creating an app user, an @@ -187,7 +189,7 @@ def get_users( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/users']), + ''.join([self.network_session.base_urls.base_url, '/users']), FetchOptions( method='GET', params=query_params_map, @@ -204,7 +206,7 @@ def create_user( name: str, login: Optional[str] = None, is_platform_access_only: Optional[bool] = None, - role: Optional[CreateUserRoleArg] = None, + role: Optional[CreateUserRole] = None, language: Optional[str] = None, is_sync_enabled: Optional[bool] = None, job_title: Optional[str] = None, @@ -217,7 +219,7 @@ def create_user( 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, + status: Optional[CreateUserStatus] = None, external_app_user_id: Optional[str] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -239,7 +241,7 @@ def create_user( :param is_platform_access_only: Specifies that the user is an app user. :type is_platform_access_only: Optional[bool], optional :param role: The user’s enterprise role - :type role: Optional[CreateUserRoleArg], optional + :type role: Optional[CreateUserRole], optional :param language: The language of the user, formatted in modified version of the [ISO 639-1](/guides/api-calls/language-codes) format. :type language: Optional[str], optional @@ -272,7 +274,7 @@ def create_user( :param is_exempt_from_login_verification: Whether the user must use two-factor authentication :type is_exempt_from_login_verification: Optional[bool], optional :param status: The user's account status - :type status: Optional[CreateUserStatusArg], optional + :type status: Optional[CreateUserStatus], optional :param external_app_user_id: 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. @@ -314,7 +316,7 @@ def create_user( 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']), + ''.join([self.network_session.base_urls.base_url, '/users']), FetchOptions( method='POST', params=query_params_map, @@ -370,7 +372,7 @@ def get_user_me( 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']), + ''.join([self.network_session.base_urls.base_url, '/users/me']), FetchOptions( method='GET', params=query_params_map, @@ -434,7 +436,9 @@ def get_user_by_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/', to_string(user_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/users/', to_string(user_id)] + ), FetchOptions( method='GET', params=query_params_map, @@ -453,7 +457,7 @@ def update_user_by_id( notify: Optional[bool] = None, name: Optional[str] = None, login: Optional[str] = None, - role: Optional[UpdateUserByIdRoleArg] = None, + role: Optional[UpdateUserByIdRole] = None, language: Optional[str] = None, is_sync_enabled: Optional[bool] = None, job_title: Optional[str] = None, @@ -466,9 +470,9 @@ def update_user_by_id( 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, + status: Optional[UpdateUserByIdStatus] = None, space_amount: Optional[int] = None, - notification_email: Optional[UpdateUserByIdNotificationEmailArg] = None, + notification_email: Optional[UpdateUserByIdNotificationEmail] = None, external_app_user_id: Optional[str] = None, fields: Optional[List[str]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -497,7 +501,7 @@ def update_user_by_id( primary login address cannot be changed. :type login: Optional[str], optional :param role: The user’s enterprise role - :type role: Optional[UpdateUserByIdRoleArg], optional + :type role: Optional[UpdateUserByIdRole], optional :param language: The language of the user, formatted in modified version of the [ISO 639-1](/guides/api-calls/language-codes) format. :type language: Optional[str], optional @@ -529,7 +533,7 @@ def update_user_by_id( :param is_password_reset_required: Whether the user is required to reset their password :type is_password_reset_required: Optional[bool], optional :param status: The user's account status - :type status: Optional[UpdateUserByIdStatusArg], optional + :type status: Optional[UpdateUserByIdStatus], optional :param space_amount: The user’s total available space in bytes. Set this to `-1` to indicate unlimited storage. :type space_amount: Optional[int], optional @@ -538,7 +542,7 @@ def update_user_by_id( 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. - :type notification_email: Optional[UpdateUserByIdNotificationEmailArg], optional + :type notification_email: Optional[UpdateUserByIdNotificationEmail], optional :param external_app_user_id: 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. @@ -585,7 +589,9 @@ def update_user_by_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/', to_string(user_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/users/', to_string(user_id)] + ), FetchOptions( method='PUT', params=query_params_map, @@ -631,12 +637,14 @@ def delete_user_by_id( """ 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/', to_string(user_id)]), + ''.join( + [self.network_session.base_urls.base_url, '/users/', to_string(user_id)] + ), FetchOptions( method='DELETE', params=query_params_map, diff --git a/box_sdk_gen/managers/web_links.py b/box_sdk_gen/managers/web_links.py index 0c44aab..9ab14bb 100644 --- a/box_sdk_gen/managers/web_links.py +++ b/box_sdk_gen/managers/web_links.py @@ -37,7 +37,7 @@ from box_sdk_gen.json_data import sd_to_json -class CreateWebLinkParentArg(BaseObject): +class CreateWebLinkParent(BaseObject): def __init__(self, id: str, **kwargs): """ :param id: The ID of parent folder @@ -47,7 +47,7 @@ def __init__(self, id: str, **kwargs): self.id = id -class UpdateWebLinkByIdParentArg(BaseObject): +class UpdateWebLinkByIdParent(BaseObject): def __init__(self, id: Optional[str] = None, **kwargs): """ :param id: The ID of parent item @@ -57,16 +57,16 @@ def __init__(self, id: Optional[str] = None, **kwargs): self.id = id -class UpdateWebLinkByIdSharedLinkArgAccessField(str, Enum): +class UpdateWebLinkByIdSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class UpdateWebLinkByIdSharedLinkArg(BaseObject): +class UpdateWebLinkByIdSharedLink(BaseObject): def __init__( self, - access: Optional[UpdateWebLinkByIdSharedLinkArgAccessField] = None, + access: Optional[UpdateWebLinkByIdSharedLinkAccessField] = None, password: Optional[str] = None, vanity_name: Optional[str] = None, unshared_at: Optional[str] = None, @@ -83,7 +83,7 @@ def __init__( no `access` field, for example `{ "shared_link": {} }`. The `company` access level is only available to paid accounts. - :type access: Optional[UpdateWebLinkByIdSharedLinkArgAccessField], optional + :type access: Optional[UpdateWebLinkByIdSharedLinkAccessField], optional :param password: The password required to access the shared link. Set the password to `null` to remove it. Passwords must now be at least eight characters @@ -114,15 +114,17 @@ class WebLinksManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def create_web_link( self, url: str, - parent: CreateWebLinkParentArg, + parent: CreateWebLinkParent, name: Optional[str] = None, description: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, @@ -133,7 +135,7 @@ def create_web_link( `"http://"` or `"https://"`. :type url: str :param parent: The parent folder to create the web link within. - :type parent: CreateWebLinkParentArg + :type parent: CreateWebLinkParent :param name: Name of the web link. Defaults to the URL if not set. :type name: Optional[str], optional :param description: Description of the web link. @@ -151,7 +153,7 @@ def create_web_link( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/web_links']), + ''.join([self.network_session.base_urls.base_url, '/web_links']), FetchOptions( method='POST', headers=headers_map, @@ -188,11 +190,15 @@ def get_web_link_by_id( """ if extra_headers is None: extra_headers = {} - headers_map: Dict[str, str] = prepare_params({ - 'boxapi': to_string(boxapi), **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/', to_string(web_link_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/web_links/', + to_string(web_link_id), + ]), FetchOptions( method='GET', headers=headers_map, @@ -207,10 +213,10 @@ def update_web_link_by_id( self, web_link_id: str, url: Optional[str] = None, - parent: Optional[UpdateWebLinkByIdParentArg] = None, + parent: Optional[UpdateWebLinkByIdParent] = None, name: Optional[str] = None, description: Optional[str] = None, - shared_link: Optional[UpdateWebLinkByIdSharedLinkArg] = None, + shared_link: Optional[UpdateWebLinkByIdSharedLink] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> WebLink: """ @@ -226,7 +232,7 @@ def update_web_link_by_id( :param description: A new description of the web link. :type description: Optional[str], optional :param shared_link: The settings for the shared link to update. - :type shared_link: Optional[UpdateWebLinkByIdSharedLinkArg], optional + :type shared_link: Optional[UpdateWebLinkByIdSharedLink], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -241,7 +247,11 @@ def update_web_link_by_id( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/web_links/', to_string(web_link_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/web_links/', + to_string(web_link_id), + ]), FetchOptions( method='PUT', headers=headers_map, @@ -269,7 +279,11 @@ def delete_web_link_by_id( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/web_links/', to_string(web_link_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/web_links/', + to_string(web_link_id), + ]), FetchOptions( method='DELETE', headers=headers_map, diff --git a/box_sdk_gen/managers/webhooks.py b/box_sdk_gen/managers/webhooks.py index 770d3b8..0a15991 100644 --- a/box_sdk_gen/managers/webhooks.py +++ b/box_sdk_gen/managers/webhooks.py @@ -41,30 +41,30 @@ from box_sdk_gen.json_data import SerializedData -class CreateWebhookTargetArgTypeField(str, Enum): +class CreateWebhookTargetTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' -class CreateWebhookTargetArg(BaseObject): +class CreateWebhookTarget(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[CreateWebhookTargetArgTypeField] = None, + type: Optional[CreateWebhookTargetTypeField] = None, **kwargs ): """ :param id: The ID of the item to trigger a webhook :type id: Optional[str], optional :param type: The type of item to trigger a webhook - :type type: Optional[CreateWebhookTargetArgTypeField], optional + :type type: Optional[CreateWebhookTargetTypeField], optional """ super().__init__(**kwargs) self.id = id self.type = type -class CreateWebhookTriggersArg(str, Enum): +class CreateWebhookTriggers(str, Enum): FILE_UPLOADED = 'FILE.UPLOADED' FILE_PREVIEWED = 'FILE.PREVIEWED' FILE_DOWNLOADED = 'FILE.DOWNLOADED' @@ -107,30 +107,30 @@ class CreateWebhookTriggersArg(str, Enum): SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED' -class UpdateWebhookByIdTargetArgTypeField(str, Enum): +class UpdateWebhookByIdTargetTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' -class UpdateWebhookByIdTargetArg(BaseObject): +class UpdateWebhookByIdTarget(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[UpdateWebhookByIdTargetArgTypeField] = None, + type: Optional[UpdateWebhookByIdTargetTypeField] = None, **kwargs ): """ :param id: The ID of the item to trigger a webhook :type id: Optional[str], optional :param type: The type of item to trigger a webhook - :type type: Optional[UpdateWebhookByIdTargetArgTypeField], optional + :type type: Optional[UpdateWebhookByIdTargetTypeField], optional """ super().__init__(**kwargs) self.id = id self.type = type -class UpdateWebhookByIdTriggersArg(str, Enum): +class UpdateWebhookByIdTriggers(str, Enum): FILE_UPLOADED = 'FILE.UPLOADED' FILE_PREVIEWED = 'FILE.PREVIEWED' FILE_DOWNLOADED = 'FILE.DOWNLOADED' @@ -177,8 +177,10 @@ class WebhooksManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -213,12 +215,12 @@ def get_webhooks( """ 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']), + ''.join([self.network_session.base_urls.base_url, '/webhooks']), FetchOptions( method='GET', params=query_params_map, @@ -232,20 +234,20 @@ def get_webhooks( def create_webhook( self, - target: CreateWebhookTargetArg, + target: CreateWebhookTarget, address: str, - triggers: List[CreateWebhookTriggersArg], + triggers: List[CreateWebhookTriggers], extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Webhook: """ Creates a webhook. :param target: The item that will trigger the webhook - :type target: CreateWebhookTargetArg + :type target: CreateWebhookTarget :param address: The URL that is notified by this webhook :type address: str :param triggers: An array of event names that this webhook is to be triggered for - :type triggers: List[CreateWebhookTriggersArg] + :type triggers: List[CreateWebhookTriggers] :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -258,7 +260,7 @@ def create_webhook( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/webhooks']), + ''.join([self.network_session.base_urls.base_url, '/webhooks']), FetchOptions( method='POST', headers=headers_map, @@ -286,7 +288,11 @@ def get_webhook_by_id( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/webhooks/', to_string(webhook_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/webhooks/', + to_string(webhook_id), + ]), FetchOptions( method='GET', headers=headers_map, @@ -300,9 +306,9 @@ def get_webhook_by_id( def update_webhook_by_id( self, webhook_id: str, - target: Optional[UpdateWebhookByIdTargetArg] = None, + target: Optional[UpdateWebhookByIdTarget] = None, address: Optional[str] = None, - triggers: Optional[List[UpdateWebhookByIdTriggersArg]] = None, + triggers: Optional[List[UpdateWebhookByIdTriggers]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> Webhook: """ @@ -311,12 +317,12 @@ def update_webhook_by_id( Example: "3321123" :type webhook_id: str :param target: The item that will trigger the webhook - :type target: Optional[UpdateWebhookByIdTargetArg], optional + :type target: Optional[UpdateWebhookByIdTarget], optional :param address: The URL that is notified by this webhook :type address: Optional[str], optional :param triggers: An array of event names that this webhook is to be triggered for - :type triggers: Optional[List[UpdateWebhookByIdTriggersArg]], optional + :type triggers: Optional[List[UpdateWebhookByIdTriggers]], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -329,7 +335,11 @@ def update_webhook_by_id( } headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/webhooks/', to_string(webhook_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/webhooks/', + to_string(webhook_id), + ]), FetchOptions( method='PUT', headers=headers_map, @@ -357,7 +367,11 @@ def delete_webhook_by_id( extra_headers = {} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/webhooks/', to_string(webhook_id)]), + ''.join([ + self.network_session.base_urls.base_url, + '/webhooks/', + to_string(webhook_id), + ]), FetchOptions( method='DELETE', headers=headers_map, diff --git a/box_sdk_gen/managers/workflows.py b/box_sdk_gen/managers/workflows.py index f9bab8a..015c496 100644 --- a/box_sdk_gen/managers/workflows.py +++ b/box_sdk_gen/managers/workflows.py @@ -39,11 +39,11 @@ from box_sdk_gen.json_data import SerializedData -class CreateWorkflowStartTypeArg(str, Enum): +class StartWorkflowType(str, Enum): WORKFLOW_PARAMETERS = 'workflow_parameters' -class CreateWorkflowStartFlowArg(BaseObject): +class StartWorkflowFlow(BaseObject): def __init__(self, type: Optional[str] = None, id: Optional[str] = None, **kwargs): """ :param type: The type of the flow object @@ -56,20 +56,20 @@ def __init__(self, type: Optional[str] = None, id: Optional[str] = None, **kwarg self.id = id -class CreateWorkflowStartFilesArgTypeField(str, Enum): +class StartWorkflowFilesTypeField(str, Enum): FILE = 'file' -class CreateWorkflowStartFilesArg(BaseObject): +class StartWorkflowFiles(BaseObject): def __init__( self, - type: Optional[CreateWorkflowStartFilesArgTypeField] = None, + type: Optional[StartWorkflowFilesTypeField] = None, id: Optional[str] = None, **kwargs ): """ :param type: The type of the file object - :type type: Optional[CreateWorkflowStartFilesArgTypeField], optional + :type type: Optional[StartWorkflowFilesTypeField], optional :param id: The id of the file :type id: Optional[str], optional """ @@ -78,20 +78,20 @@ def __init__( self.id = id -class CreateWorkflowStartFolderArgTypeField(str, Enum): +class StartWorkflowFolderTypeField(str, Enum): FOLDER = 'folder' -class CreateWorkflowStartFolderArg(BaseObject): +class StartWorkflowFolder(BaseObject): def __init__( self, - type: Optional[CreateWorkflowStartFolderArgTypeField] = None, + type: Optional[StartWorkflowFolderTypeField] = None, id: Optional[str] = None, **kwargs ): """ :param type: The type of the folder object - :type type: Optional[CreateWorkflowStartFolderArgTypeField], optional + :type type: Optional[StartWorkflowFolderTypeField], optional :param id: The id of the folder :type id: Optional[str], optional """ @@ -100,15 +100,15 @@ def __init__( self.id = id -class CreateWorkflowStartOutcomesArgTypeField(str, Enum): +class StartWorkflowOutcomesTypeField(str, Enum): OUTCOME = 'outcome' -class CreateWorkflowStartOutcomesArg(BaseObject): +class StartWorkflowOutcomes(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[CreateWorkflowStartOutcomesArgTypeField] = None, + type: Optional[StartWorkflowOutcomesTypeField] = None, parameter: Optional[str] = None, **kwargs ): @@ -116,7 +116,7 @@ def __init__( :param id: The id of the outcome :type id: Optional[str], optional :param type: The type of the outcome object - :type type: Optional[CreateWorkflowStartOutcomesArgTypeField], optional + :type type: Optional[StartWorkflowOutcomesTypeField], optional :param parameter: This is a placeholder example for various objects that can be passed in - refer to the guides section to find out more information. @@ -132,8 +132,10 @@ class WorkflowsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session @@ -186,7 +188,7 @@ def get_workflows( }) headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/workflows']), + ''.join([self.network_session.base_urls.base_url, '/workflows']), FetchOptions( method='GET', params=query_params_map, @@ -198,14 +200,14 @@ def get_workflows( ) return deserialize(response.data, Workflows) - def create_workflow_start( + def start_workflow( self, workflow_id: str, - flow: CreateWorkflowStartFlowArg, - files: List[CreateWorkflowStartFilesArg], - folder: CreateWorkflowStartFolderArg, - type: Optional[CreateWorkflowStartTypeArg] = None, - outcomes: Optional[List[CreateWorkflowStartOutcomesArg]] = None, + flow: StartWorkflowFlow, + files: List[StartWorkflowFiles], + folder: StartWorkflowFolder, + type: Optional[StartWorkflowType] = None, + outcomes: Optional[List[StartWorkflowOutcomes]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> None: """ @@ -220,16 +222,16 @@ def create_workflow_start( Example: "12345" :type workflow_id: str :param flow: The flow that will be triggered - :type flow: CreateWorkflowStartFlowArg + :type flow: StartWorkflowFlow :param files: The array of files for which the workflow should start. All files must be in the workflow's configured folder. - :type files: List[CreateWorkflowStartFilesArg] + :type files: List[StartWorkflowFiles] :param folder: The folder object for which the workflow is configured. - :type folder: CreateWorkflowStartFolderArg + :type folder: StartWorkflowFolder :param type: The type of the parameters object - :type type: Optional[CreateWorkflowStartTypeArg], optional + :type type: Optional[StartWorkflowType], optional :param outcomes: A list of outcomes required to be configured at start time. - :type outcomes: Optional[List[CreateWorkflowStartOutcomesArg]], optional + :type outcomes: Optional[List[StartWorkflowOutcomes]], optional :param extra_headers: Extra headers that will be included in the HTTP request. :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ @@ -245,7 +247,10 @@ def create_workflow_start( headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( ''.join([ - 'https://api.box.com/2.0/workflows/', to_string(workflow_id), '/start' + self.network_session.base_urls.base_url, + '/workflows/', + to_string(workflow_id), + '/start', ]), FetchOptions( method='POST', diff --git a/box_sdk_gen/managers/zip_downloads.py b/box_sdk_gen/managers/zip_downloads.py index 19a2081..591cd6d 100644 --- a/box_sdk_gen/managers/zip_downloads.py +++ b/box_sdk_gen/managers/zip_downloads.py @@ -41,16 +41,16 @@ from box_sdk_gen.json_data import sd_to_json -class CreateZipDownloadItemsArgTypeField(str, Enum): +class CreateZipDownloadItemsTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' -class CreateZipDownloadItemsArg(BaseObject): - def __init__(self, type: CreateZipDownloadItemsArgTypeField, id: str, **kwargs): +class CreateZipDownloadItems(BaseObject): + def __init__(self, type: CreateZipDownloadItemsTypeField, id: str, **kwargs): """ :param type: The type of the item to add to the archive. - :type type: CreateZipDownloadItemsArgTypeField + :type type: CreateZipDownloadItemsTypeField :param id: The identifier of the item to add to the archive. When this item is a folder then this can not be the root folder with ID `0`. :type id: str @@ -60,16 +60,16 @@ def __init__(self, type: CreateZipDownloadItemsArgTypeField, id: str, **kwargs): self.id = id -class DownloadZipItemsArgTypeField(str, Enum): +class DownloadZipItemsTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' -class DownloadZipItemsArg(BaseObject): - def __init__(self, type: DownloadZipItemsArgTypeField, id: str, **kwargs): +class DownloadZipItems(BaseObject): + def __init__(self, type: DownloadZipItemsTypeField, id: str, **kwargs): """ :param type: The type of the item to add to the archive. - :type type: DownloadZipItemsArgTypeField + :type type: DownloadZipItemsTypeField :param id: The identifier of the item to add to the archive. When this item is a folder then this can not be the root folder with ID `0`. :type id: str @@ -83,14 +83,16 @@ class ZipDownloadsManager: def __init__( self, auth: Optional[Authentication] = None, - network_session: Optional[NetworkSession] = None, + network_session: NetworkSession = None, ): + if network_session is None: + network_session = NetworkSession() self.auth = auth self.network_session = network_session def create_zip_download( self, - items: List[CreateZipDownloadItemsArg], + items: List[CreateZipDownloadItems], download_file_name: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> ZipDownload: @@ -137,7 +139,7 @@ def create_zip_download( :param items: A list of items to add to the `zip` archive. These can be folders or files. - :type items: List[CreateZipDownloadItemsArg] + :type items: List[CreateZipDownloadItems] :param download_file_name: The optional name of the `zip` archive. This name will be appended by the `.zip` file extension, for example `January Financials.zip`. :type download_file_name: Optional[str], optional @@ -149,7 +151,7 @@ def create_zip_download( request_body: Dict = {'items': items, 'download_file_name': download_file_name} headers_map: Dict[str, str] = prepare_params({**extra_headers}) response: FetchResponse = fetch( - ''.join(['https://api.box.com/2.0/zip_downloads']), + ''.join([self.network_session.base_urls.base_url, '/zip_downloads']), FetchOptions( method='POST', headers=headers_map, @@ -275,7 +277,7 @@ def get_zip_download_status( def download_zip( self, - items: List[DownloadZipItemsArg], + items: List[DownloadZipItems], download_file_name: Optional[str] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None, ) -> ByteStream: @@ -283,7 +285,7 @@ def download_zip( Creates a zip and downloads its content :param items: A list of items to add to the `zip` archive. These can be folders or files. - :type items: List[DownloadZipItemsArg] + :type items: List[DownloadZipItems] :param download_file_name: The optional name of the `zip` archive. This name will be appended by the `.zip` file extension, for example `January Financials.zip`. :type download_file_name: Optional[str], optional diff --git a/box_sdk_gen/network.py b/box_sdk_gen/network.py index f5ccfd5..aa86450 100644 --- a/box_sdk_gen/network.py +++ b/box_sdk_gen/network.py @@ -1,15 +1,21 @@ import requests from typing import Dict +from .base_urls import BaseUrls class NetworkSession: MAX_ATTEMPTS = 5 - def __init__(self, additional_headers: Dict[str, str] = None): + def __init__( + self, additional_headers: Dict[str, str] = None, base_urls: BaseUrls = None + ): if additional_headers is None: additional_headers = {} + if base_urls is None: + base_urls = BaseUrls() self.requests_session = requests.Session() self.additional_headers = additional_headers + self.base_urls = base_urls def with_additional_headers( self, additional_headers: Dict[str, str] = None @@ -20,4 +26,15 @@ def with_additional_headers( :param additional_headers: Dict of headers, which are appended to each API request :return: a new instance of NetworkSession """ - return NetworkSession({**self.additional_headers, **additional_headers}) + return NetworkSession( + {**self.additional_headers, **additional_headers}, self.base_urls + ) + + def with_custom_base_urls(self, base_urls: BaseUrls) -> 'NetworkSession': + """ + Generate a fresh network session by duplicating the existing configuration and network parameters, + while also including additional base urls to be used for each API call. + :param base_urls: Dict of base urls, which are appended to each API request + :return: a new instance of NetworkSession + """ + return NetworkSession(self.additional_headers, base_urls) diff --git a/box_sdk_gen/schemas.py b/box_sdk_gen/schemas.py index 5f92a54..bd5ea6f 100644 --- a/box_sdk_gen/schemas.py +++ b/box_sdk_gen/schemas.py @@ -193,16 +193,16 @@ def __init__( self.token = token -class ZipDownloadRequestItemsFieldTypeField(str, Enum): +class ZipDownloadRequestItemsTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' class ZipDownloadRequestItemsField(BaseObject): - def __init__(self, type: ZipDownloadRequestItemsFieldTypeField, id: str, **kwargs): + def __init__(self, type: ZipDownloadRequestItemsTypeField, id: str, **kwargs): """ :param type: The type of the item to add to the archive. - :type type: ZipDownloadRequestItemsFieldTypeField + :type type: ZipDownloadRequestItemsTypeField :param id: The identifier of the item to add to the archive. When this item is a folder then this can not be the root folder with ID `0`. :type id: str @@ -232,7 +232,7 @@ def __init__( self.download_file_name = download_file_name -class MetadataQueryOrderByFieldDirectionField(str, Enum): +class MetadataQueryOrderByDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -241,7 +241,7 @@ class MetadataQueryOrderByField(BaseObject): def __init__( self, field_key: Optional[str] = None, - direction: Optional[MetadataQueryOrderByFieldDirectionField] = None, + direction: Optional[MetadataQueryOrderByDirectionField] = None, **kwargs ): """ @@ -252,7 +252,7 @@ def __init__( :param direction: The direction to order by, either ascending or descending. The `ordering` direction must be the same for each item in the array. - :type direction: Optional[MetadataQueryOrderByFieldDirectionField], optional + :type direction: Optional[MetadataQueryOrderByDirectionField], optional """ super().__init__(**kwargs) self.field_key = field_key @@ -401,7 +401,7 @@ def __init__( self.expires_at = expires_at -class FileRequestCopyRequestFolderFieldTypeField(str, Enum): +class FileRequestCopyRequestFolderTypeField(str, Enum): FOLDER = 'folder' @@ -409,7 +409,7 @@ class FileRequestCopyRequestFolderField(BaseObject): def __init__( self, id: str, - type: Optional[FileRequestCopyRequestFolderFieldTypeField] = None, + type: Optional[FileRequestCopyRequestFolderTypeField] = None, **kwargs ): """ @@ -417,7 +417,7 @@ def __init__( file request to. :type id: str :param type: `folder` - :type type: Optional[FileRequestCopyRequestFolderFieldTypeField], optional + :type type: Optional[FileRequestCopyRequestFolderTypeField], optional """ super().__init__(**kwargs) self.id = id @@ -667,21 +667,19 @@ class ClassificationTemplateDisplayNameField(str, Enum): CLASSIFICATION = 'Classification' -class ClassificationTemplateFieldsFieldTypeField(str, Enum): +class ClassificationTemplateFieldsTypeField(str, Enum): ENUM = 'enum' -class ClassificationTemplateFieldsFieldKeyField(str, Enum): +class ClassificationTemplateFieldsKeyField(str, Enum): BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key' -class ClassificationTemplateFieldsFieldDisplayNameField(str, Enum): +class ClassificationTemplateFieldsDisplayNameField(str, Enum): CLASSIFICATION = 'Classification' -class ClassificationTemplateFieldsFieldOptionsFieldStaticConfigFieldClassificationField( - BaseObject -): +class ClassificationTemplateFieldsOptionsStaticConfigClassificationField(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'classification_definition': 'classificationDefinition', 'color_id': 'colorID', @@ -722,11 +720,11 @@ def __init__( self.color_id = color_id -class ClassificationTemplateFieldsFieldOptionsFieldStaticConfigField(BaseObject): +class ClassificationTemplateFieldsOptionsStaticConfigField(BaseObject): def __init__( self, classification: Optional[ - ClassificationTemplateFieldsFieldOptionsFieldStaticConfigFieldClassificationField + ClassificationTemplateFieldsOptionsStaticConfigClassificationField ] = None, **kwargs ): @@ -737,13 +735,13 @@ def __init__( are used for internal Box Shield and Box Governance purposes and no additional value must be derived from these fields. - :type classification: Optional[ClassificationTemplateFieldsFieldOptionsFieldStaticConfigFieldClassificationField], optional + :type classification: Optional[ClassificationTemplateFieldsOptionsStaticConfigClassificationField], optional """ super().__init__(**kwargs) self.classification = classification -class ClassificationTemplateFieldsFieldOptionsField(BaseObject): +class ClassificationTemplateFieldsOptionsField(BaseObject): _fields_to_json_mapping: Dict[str, str] = { 'static_config': 'staticConfig', **BaseObject._fields_to_json_mapping, @@ -758,7 +756,7 @@ def __init__( id: str, key: str, static_config: Optional[ - ClassificationTemplateFieldsFieldOptionsFieldStaticConfigField + ClassificationTemplateFieldsOptionsStaticConfigField ] = None, **kwargs ): @@ -768,7 +766,7 @@ def __init__( :param key: The display name and key for this classification. :type key: str :param static_config: Additional information about the classification. - :type static_config: Optional[ClassificationTemplateFieldsFieldOptionsFieldStaticConfigField], optional + :type static_config: Optional[ClassificationTemplateFieldsOptionsStaticConfigField], optional """ super().__init__(**kwargs) self.id = id @@ -789,10 +787,10 @@ class ClassificationTemplateFieldsField(BaseObject): def __init__( self, id: str, - type: ClassificationTemplateFieldsFieldTypeField, - key: ClassificationTemplateFieldsFieldKeyField, - display_name: ClassificationTemplateFieldsFieldDisplayNameField, - options: List[ClassificationTemplateFieldsFieldOptionsField], + type: ClassificationTemplateFieldsTypeField, + key: ClassificationTemplateFieldsKeyField, + display_name: ClassificationTemplateFieldsDisplayNameField, + options: List[ClassificationTemplateFieldsOptionsField], hidden: Optional[bool] = None, **kwargs ): @@ -800,14 +798,14 @@ def __init__( :param id: The unique ID of the field. :type id: str :param type: The array item type. - :type type: ClassificationTemplateFieldsFieldTypeField + :type type: ClassificationTemplateFieldsTypeField :param key: Defines classifications available in the enterprise. - :type key: ClassificationTemplateFieldsFieldKeyField + :type key: ClassificationTemplateFieldsKeyField :param display_name: `Classification` - :type display_name: ClassificationTemplateFieldsFieldDisplayNameField + :type display_name: ClassificationTemplateFieldsDisplayNameField :param options: A list of classifications available in this enterprise. - :type options: List[ClassificationTemplateFieldsFieldOptionsField] + :type options: List[ClassificationTemplateFieldsOptionsField] :param hidden: Classifications are always visible to web and mobile users. :type hidden: Optional[bool], optional """ @@ -892,7 +890,7 @@ class CollaborationAllowlistEntryDirectionField(str, Enum): BOTH = 'both' -class CollaborationAllowlistEntryEnterpriseFieldTypeField(str, Enum): +class CollaborationAllowlistEntryEnterpriseTypeField(str, Enum): ENTERPRISE = 'enterprise' @@ -900,7 +898,7 @@ class CollaborationAllowlistEntryEnterpriseField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[CollaborationAllowlistEntryEnterpriseFieldTypeField] = None, + type: Optional[CollaborationAllowlistEntryEnterpriseTypeField] = None, name: Optional[str] = None, **kwargs ): @@ -908,7 +906,7 @@ def __init__( :param id: The unique identifier for this enterprise. :type id: Optional[str], optional :param type: `enterprise` - :type type: Optional[CollaborationAllowlistEntryEnterpriseFieldTypeField], optional + :type type: Optional[CollaborationAllowlistEntryEnterpriseTypeField], optional :param name: The name of the enterprise :type name: Optional[str], optional """ @@ -1018,7 +1016,7 @@ def __init__( self.collection_type = collection_type -class CollectionsOrderFieldDirectionField(str, Enum): +class CollectionsOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -1027,14 +1025,14 @@ class CollectionsOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[CollectionsOrderFieldDirectionField] = None, + direction: Optional[CollectionsOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[CollectionsOrderFieldDirectionField], optional + :type direction: Optional[CollectionsOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -1814,7 +1812,7 @@ def __init__( self.permissions = permissions -class GroupsOrderFieldDirectionField(str, Enum): +class GroupsOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -1823,14 +1821,14 @@ class GroupsOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[GroupsOrderFieldDirectionField] = None, + direction: Optional[GroupsOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[GroupsOrderFieldDirectionField], optional + :type direction: Optional[GroupsOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -2082,20 +2080,20 @@ class MetadataCascadePolicyTypeField(str, Enum): METADATA_CASCADE_POLICY = 'metadata_cascade_policy' -class MetadataCascadePolicyOwnerEnterpriseFieldTypeField(str, Enum): +class MetadataCascadePolicyOwnerEnterpriseTypeField(str, Enum): ENTERPRISE = 'enterprise' class MetadataCascadePolicyOwnerEnterpriseField(BaseObject): def __init__( self, - type: Optional[MetadataCascadePolicyOwnerEnterpriseFieldTypeField] = None, + type: Optional[MetadataCascadePolicyOwnerEnterpriseTypeField] = None, id: Optional[str] = None, **kwargs ): """ :param type: `enterprise` - :type type: Optional[MetadataCascadePolicyOwnerEnterpriseFieldTypeField], optional + :type type: Optional[MetadataCascadePolicyOwnerEnterpriseTypeField], optional :param id: The ID of the enterprise that owns the policy. :type id: Optional[str], optional """ @@ -2104,20 +2102,20 @@ def __init__( self.id = id -class MetadataCascadePolicyParentFieldTypeField(str, Enum): +class MetadataCascadePolicyParentTypeField(str, Enum): FOLDER = 'folder' class MetadataCascadePolicyParentField(BaseObject): def __init__( self, - type: Optional[MetadataCascadePolicyParentFieldTypeField] = None, + type: Optional[MetadataCascadePolicyParentTypeField] = None, id: Optional[str] = None, **kwargs ): """ :param type: `folder` - :type type: Optional[MetadataCascadePolicyParentFieldTypeField], optional + :type type: Optional[MetadataCascadePolicyParentTypeField], optional :param id: The ID of the folder the policy is applied to. :type id: Optional[str], optional """ @@ -2218,7 +2216,7 @@ class MetadataQueryIndexStatusField(str, Enum): DISABLED = 'disabled' -class MetadataQueryIndexFieldsFieldSortDirectionField(str, Enum): +class MetadataQueryIndexFieldsSortDirectionField(str, Enum): ASC = 'asc' DESC = 'desc' @@ -2227,16 +2225,14 @@ class MetadataQueryIndexFieldsField(BaseObject): def __init__( self, key: Optional[str] = None, - sort_direction: Optional[ - MetadataQueryIndexFieldsFieldSortDirectionField - ] = None, + sort_direction: Optional[MetadataQueryIndexFieldsSortDirectionField] = None, **kwargs ): """ :param key: The metadata template field key. :type key: Optional[str], optional :param sort_direction: The sort direction of the field. - :type sort_direction: Optional[MetadataQueryIndexFieldsFieldSortDirectionField], optional + :type sort_direction: Optional[MetadataQueryIndexFieldsSortDirectionField], optional """ super().__init__(**kwargs) self.key = key @@ -2295,7 +2291,7 @@ class MetadataTemplateTypeField(str, Enum): METADATA_TEMPLATE = 'metadata_template' -class MetadataTemplateFieldsFieldTypeField(str, Enum): +class MetadataTemplateFieldsTypeField(str, Enum): STRING = 'string' FLOAT = 'float' DATE = 'date' @@ -2304,7 +2300,7 @@ class MetadataTemplateFieldsFieldTypeField(str, Enum): INTEGER = 'integer' -class MetadataTemplateFieldsFieldOptionsField(BaseObject): +class MetadataTemplateFieldsOptionsField(BaseObject): def __init__(self, key: str, id: Optional[str] = None, **kwargs): """ :param key: The text value of the option. This represents both the display name of the @@ -2330,12 +2326,12 @@ class MetadataTemplateFieldsField(BaseObject): def __init__( self, - type: MetadataTemplateFieldsFieldTypeField, + type: MetadataTemplateFieldsTypeField, key: str, display_name: str, description: Optional[str] = None, hidden: Optional[bool] = None, - options: Optional[List[MetadataTemplateFieldsFieldOptionsField]] = None, + options: Optional[List[MetadataTemplateFieldsOptionsField]] = None, id: Optional[str] = None, **kwargs ): @@ -2349,7 +2345,7 @@ def __init__( **Note**: The `integer` value is deprecated. It is still present in the response, but cannot be used in the POST request. - :type type: MetadataTemplateFieldsFieldTypeField + :type type: MetadataTemplateFieldsTypeField :param key: A unique identifier for the field. The identifier must be unique within the template to which it belongs. :type key: str @@ -2363,7 +2359,7 @@ def __init__( :type hidden: Optional[bool], optional :param options: A list of options for this field. This is used in combination with the `enum` and `multiSelect` field types. - :type options: Optional[List[MetadataTemplateFieldsFieldOptionsField]], optional + :type options: Optional[List[MetadataTemplateFieldsOptionsField]], optional :param id: The unique ID of the metadata template field. :type id: Optional[str], optional """ @@ -2772,7 +2768,7 @@ def __init__( self.id = id -class ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentFieldTypeField( +class ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentTypeField( str, Enum ): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' @@ -2785,7 +2781,7 @@ def __init__( self, id: Optional[str] = None, type: Optional[ - ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentFieldTypeField + ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentTypeField ] = None, **kwargs ): @@ -2794,14 +2790,14 @@ def __init__( requesting shield information barrier segment. :type id: Optional[str], optional :param type: The type of the shield information barrier segment - :type type: Optional[ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentFieldTypeField], optional + :type type: Optional[ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentTypeField], optional """ super().__init__(**kwargs) self.id = id self.type = type -class ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentFieldTypeField( +class ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField( str, Enum ): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' @@ -2812,7 +2808,7 @@ def __init__( self, id: Optional[str] = None, type: Optional[ - ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentFieldTypeField + ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField ] = None, **kwargs ): @@ -2821,7 +2817,7 @@ def __init__( restricted shield information barrier segment. :type id: Optional[str], optional :param type: The type of the shield information segment - :type type: Optional[ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentFieldTypeField], optional + :type type: Optional[ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField], optional """ super().__init__(**kwargs) self.id = id @@ -3017,7 +3013,7 @@ class TermsOfServiceStatusField(str, Enum): DISABLED = 'disabled' -class TermsOfServiceEnterpriseFieldTypeField(str, Enum): +class TermsOfServiceEnterpriseTypeField(str, Enum): ENTERPRISE = 'enterprise' @@ -3025,7 +3021,7 @@ class TermsOfServiceEnterpriseField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[TermsOfServiceEnterpriseFieldTypeField] = None, + type: Optional[TermsOfServiceEnterpriseTypeField] = None, name: Optional[str] = None, **kwargs ): @@ -3033,7 +3029,7 @@ def __init__( :param id: The unique identifier for this enterprise. :type id: Optional[str], optional :param type: `enterprise` - :type type: Optional[TermsOfServiceEnterpriseFieldTypeField], optional + :type type: Optional[TermsOfServiceEnterpriseTypeField], optional :param name: The name of the enterprise :type name: Optional[str], optional """ @@ -3163,7 +3159,7 @@ def __init__( self.sha_1 = sha_1 -class UploadPartsOrderFieldDirectionField(str, Enum): +class UploadPartsOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -3172,14 +3168,14 @@ class UploadPartsOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[UploadPartsOrderFieldDirectionField] = None, + direction: Optional[UploadPartsOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[UploadPartsOrderFieldDirectionField], optional + :type direction: Optional[UploadPartsOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -3969,14 +3965,14 @@ class TrashWebLinkTypeField(str, Enum): WEB_LINK = 'web_link' -class TrashWebLinkPathCollectionFieldEntriesFieldTypeField(str, Enum): +class TrashWebLinkPathCollectionEntriesTypeField(str, Enum): FOLDER = 'folder' -class TrashWebLinkPathCollectionFieldEntriesField(BaseObject): +class TrashWebLinkPathCollectionEntriesField(BaseObject): def __init__( self, - type: Optional[TrashWebLinkPathCollectionFieldEntriesFieldTypeField] = None, + type: Optional[TrashWebLinkPathCollectionEntriesTypeField] = None, id: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, @@ -3985,7 +3981,7 @@ def __init__( ): """ :param type: `folder` - :type type: Optional[TrashWebLinkPathCollectionFieldEntriesFieldTypeField], optional + :type type: Optional[TrashWebLinkPathCollectionEntriesTypeField], optional :param id: The unique identifier that represent a folder. :type id: Optional[str], optional :param sequence_id: This field is null for the Trash folder @@ -4007,14 +4003,14 @@ class TrashWebLinkPathCollectionField(BaseObject): def __init__( self, total_count: int, - entries: List[TrashWebLinkPathCollectionFieldEntriesField], + entries: List[TrashWebLinkPathCollectionEntriesField], **kwargs ): """ :param total_count: The number of folders in this list. :type total_count: int :param entries: Array of folders for this item's path collection - :type entries: List[TrashWebLinkPathCollectionFieldEntriesField] + :type entries: List[TrashWebLinkPathCollectionEntriesField] """ super().__init__(**kwargs) self.total_count = total_count @@ -4108,14 +4104,14 @@ class TrashFolderTypeField(str, Enum): FOLDER = 'folder' -class TrashFolderPathCollectionFieldEntriesFieldTypeField(str, Enum): +class TrashFolderPathCollectionEntriesTypeField(str, Enum): FOLDER = 'folder' -class TrashFolderPathCollectionFieldEntriesField(BaseObject): +class TrashFolderPathCollectionEntriesField(BaseObject): def __init__( self, - type: Optional[TrashFolderPathCollectionFieldEntriesFieldTypeField] = None, + type: Optional[TrashFolderPathCollectionEntriesTypeField] = None, id: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, @@ -4124,7 +4120,7 @@ def __init__( ): """ :param type: `folder` - :type type: Optional[TrashFolderPathCollectionFieldEntriesFieldTypeField], optional + :type type: Optional[TrashFolderPathCollectionEntriesTypeField], optional :param id: The unique identifier that represent a folder. :type id: Optional[str], optional :param sequence_id: This field is null for the Trash folder @@ -4146,14 +4142,14 @@ class TrashFolderPathCollectionField(BaseObject): def __init__( self, total_count: int, - entries: List[TrashFolderPathCollectionFieldEntriesField], + entries: List[TrashFolderPathCollectionEntriesField], **kwargs ): """ :param total_count: The number of folders in this list. :type total_count: int :param entries: Array of folders for this item's path collection - :type entries: List[TrashFolderPathCollectionFieldEntriesField] + :type entries: List[TrashFolderPathCollectionEntriesField] """ super().__init__(**kwargs) self.total_count = total_count @@ -4272,14 +4268,14 @@ class TrashFileTypeField(str, Enum): FILE = 'file' -class TrashFilePathCollectionFieldEntriesFieldTypeField(str, Enum): +class TrashFilePathCollectionEntriesTypeField(str, Enum): FOLDER = 'folder' -class TrashFilePathCollectionFieldEntriesField(BaseObject): +class TrashFilePathCollectionEntriesField(BaseObject): def __init__( self, - type: Optional[TrashFilePathCollectionFieldEntriesFieldTypeField] = None, + type: Optional[TrashFilePathCollectionEntriesTypeField] = None, id: Optional[str] = None, sequence_id: Optional[str] = None, etag: Optional[str] = None, @@ -4288,7 +4284,7 @@ def __init__( ): """ :param type: `folder` - :type type: Optional[TrashFilePathCollectionFieldEntriesFieldTypeField], optional + :type type: Optional[TrashFilePathCollectionEntriesTypeField], optional :param id: The unique identifier that represent a folder. :type id: Optional[str], optional :param sequence_id: This field is null for the Trash folder @@ -4310,14 +4306,14 @@ class TrashFilePathCollectionField(BaseObject): def __init__( self, total_count: int, - entries: List[TrashFilePathCollectionFieldEntriesField], + entries: List[TrashFilePathCollectionEntriesField], **kwargs ): """ :param total_count: The number of folders in this list. :type total_count: int :param entries: Array of folders for this item's path collection - :type entries: List[TrashFilePathCollectionFieldEntriesField] + :type entries: List[TrashFilePathCollectionEntriesField] """ super().__init__(**kwargs) self.total_count = total_count @@ -4666,7 +4662,7 @@ class RetentionPolicyAssignmentTypeField(str, Enum): RETENTION_POLICY_ASSIGNMENT = 'retention_policy_assignment' -class RetentionPolicyAssignmentAssignedToFieldTypeField(str, Enum): +class RetentionPolicyAssignmentAssignedToTypeField(str, Enum): FOLDER = 'folder' ENTERPRISE = 'enterprise' METADATA_TEMPLATE = 'metadata_template' @@ -4676,7 +4672,7 @@ class RetentionPolicyAssignmentAssignedToField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[RetentionPolicyAssignmentAssignedToFieldTypeField] = None, + type: Optional[RetentionPolicyAssignmentAssignedToTypeField] = None, **kwargs ): """ @@ -4685,7 +4681,7 @@ def __init__( Set to null or omit when type is set to enterprise. :type id: Optional[str], optional :param type: The type of resource the policy is assigned to. - :type type: Optional[RetentionPolicyAssignmentAssignedToFieldTypeField], optional + :type type: Optional[RetentionPolicyAssignmentAssignedToTypeField], optional """ super().__init__(**kwargs) self.id = id @@ -4711,8 +4707,8 @@ def __init__( class RetentionPolicyAssignment(BaseObject): def __init__( self, - id: Optional[str] = None, - type: Optional[RetentionPolicyAssignmentTypeField] = None, + id: str, + type: RetentionPolicyAssignmentTypeField, retention_policy: Optional[RetentionPolicyMini] = None, assigned_to: Optional[RetentionPolicyAssignmentAssignedToField] = None, filter_fields: Optional[ @@ -4725,9 +4721,9 @@ def __init__( ): """ :param id: The unique identifier for a retention policy assignment. - :type id: Optional[str], optional + :type id: str :param type: `retention_policy_assignment` - :type type: Optional[RetentionPolicyAssignmentTypeField], optional + :type type: RetentionPolicyAssignmentTypeField :param assigned_to: The `type` and `id` of the content that is under retention. The `type` can either be `folder` `enterprise`, or `metadata_template`. @@ -5083,7 +5079,7 @@ class InviteTypeField(str, Enum): INVITE = 'invite' -class InviteInvitedToFieldTypeField(str, Enum): +class InviteInvitedToTypeField(str, Enum): ENTERPRISE = 'enterprise' @@ -5091,7 +5087,7 @@ class InviteInvitedToField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[InviteInvitedToFieldTypeField] = None, + type: Optional[InviteInvitedToTypeField] = None, name: Optional[str] = None, **kwargs ): @@ -5099,7 +5095,7 @@ def __init__( :param id: The unique identifier for this enterprise. :type id: Optional[str], optional :param type: `enterprise` - :type type: Optional[InviteInvitedToFieldTypeField], optional + :type type: Optional[InviteInvitedToTypeField], optional :param name: The name of the enterprise :type name: Optional[str], optional """ @@ -5190,7 +5186,7 @@ def __init__( self.modified_at = modified_at -class GroupMembershipsOrderFieldDirectionField(str, Enum): +class GroupMembershipsOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -5199,14 +5195,14 @@ class GroupMembershipsOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[GroupMembershipsOrderFieldDirectionField] = None, + direction: Optional[GroupMembershipsOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[GroupMembershipsOrderFieldDirectionField], optional + :type direction: Optional[GroupMembershipsOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -5373,7 +5369,7 @@ def __init__( self.version_number = version_number -class FileVersionsOrderFieldDirectionField(str, Enum): +class FileVersionsOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -5382,14 +5378,14 @@ class FileVersionsOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[FileVersionsOrderFieldDirectionField] = None, + direction: Optional[FileVersionsOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[FileVersionsOrderFieldDirectionField], optional + :type direction: Optional[FileVersionsOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -5554,26 +5550,26 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.entries = entries -class FileSharedLinkFieldAccessField(str, Enum): +class FileSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class FileSharedLinkFieldEffectiveAccessField(str, Enum): +class FileSharedLinkEffectiveAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class FileSharedLinkFieldEffectivePermissionField(str, Enum): +class FileSharedLinkEffectivePermissionField(str, Enum): CAN_EDIT = 'can_edit' CAN_DOWNLOAD = 'can_download' CAN_PREVIEW = 'can_preview' NO_ACCESS = 'no_access' -class FileSharedLinkFieldPermissionsField(BaseObject): +class FileSharedLinkPermissionsField(BaseObject): def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwargs): """ :param can_download: Defines if the shared link allows for the item to be downloaded. For @@ -5600,17 +5596,17 @@ class FileSharedLinkField(BaseObject): def __init__( self, url: str, - effective_access: FileSharedLinkFieldEffectiveAccessField, - effective_permission: FileSharedLinkFieldEffectivePermissionField, + effective_access: FileSharedLinkEffectiveAccessField, + effective_permission: FileSharedLinkEffectivePermissionField, 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, + access: Optional[FileSharedLinkAccessField] = None, unshared_at: Optional[str] = None, - permissions: Optional[FileSharedLinkFieldPermissionsField] = None, + permissions: Optional[FileSharedLinkPermissionsField] = None, **kwargs ): """ @@ -5623,13 +5619,13 @@ def __init__( :param effective_access: The effective access level for the shared link. This can be a more restrictive access level than the value in the `access` field when the enterprise settings restrict the allowed access levels. - :type effective_access: FileSharedLinkFieldEffectiveAccessField + :type effective_access: FileSharedLinkEffectiveAccessField :param effective_permission: The effective permissions for this shared link. These result in the more restrictive combination of the share link permissions and the item permissions set by the administrator, the owner, and any ancestor item such as a folder. - :type effective_permission: FileSharedLinkFieldEffectivePermissionField + :type effective_permission: FileSharedLinkEffectivePermissionField :param is_password_enabled: Defines if the shared link requires a password to access the item. :type is_password_enabled: bool :param download_count: The number of times this item has been downloaded. @@ -5653,14 +5649,14 @@ def __init__( collaborators on this item If this field is omitted when creating the shared link, the access level will be set to the default access level specified by the enterprise admin. - :type access: Optional[FileSharedLinkFieldAccessField], optional + :type access: Optional[FileSharedLinkAccessField], optional :param unshared_at: The date and time when this link will be unshared. This field can only be set by users with paid accounts. :type unshared_at: Optional[str], optional :param permissions: Defines if this link allows a user to preview, edit, and download an item. These permissions refer to the shared link only and do not supersede permissions applied to the item itself. - :type permissions: Optional[FileSharedLinkFieldPermissionsField], optional + :type permissions: Optional[FileSharedLinkPermissionsField], optional """ super().__init__(**kwargs) self.url = url @@ -5845,11 +5841,11 @@ def __init__( self.can_view_annotations_self = can_view_annotations_self -class FileFullLockFieldTypeField(str, Enum): +class FileFullLockTypeField(str, Enum): LOCK = 'lock' -class FileFullLockFieldAppTypeField(str, Enum): +class FileFullLockAppTypeField(str, Enum): GSUITE = 'gsuite' OFFICE_WOPI = 'office_wopi' OFFICE_WOPIPLUS = 'office_wopiplus' @@ -5860,19 +5856,19 @@ class FileFullLockField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[FileFullLockFieldTypeField] = None, + type: Optional[FileFullLockTypeField] = 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, + app_type: Optional[FileFullLockAppTypeField] = None, **kwargs ): """ :param id: The unique identifier for this lock :type id: Optional[str], optional :param type: `lock` - :type type: Optional[FileFullLockFieldTypeField], optional + :type type: Optional[FileFullLockTypeField], optional :param created_at: The time this lock was created at. :type created_at: Optional[str], optional :param expired_at: The time this lock is to expire at, which might be in the past. @@ -5883,7 +5879,7 @@ def __init__( field identifies the type of the application that holds the lock. This is an open enum and may be extended with additional values in the future. - :type app_type: Optional[FileFullLockFieldAppTypeField], optional + :type app_type: Optional[FileFullLockAppTypeField], optional """ super().__init__(**kwargs) self.id = id @@ -5895,7 +5891,7 @@ def __init__( self.app_type = app_type -class FileFullExpiringEmbedLinkFieldTokenTypeField(str, Enum): +class FileFullExpiringEmbedLinkTokenTypeField(str, Enum): BEARER = 'bearer' @@ -5904,7 +5900,7 @@ def __init__( self, access_token: Optional[str] = None, expires_in: Optional[int] = None, - token_type: Optional[FileFullExpiringEmbedLinkFieldTokenTypeField] = None, + token_type: Optional[FileFullExpiringEmbedLinkTokenTypeField] = None, restricted_to: Optional[List[FileScope]] = None, url: Optional[str] = None, **kwargs @@ -5915,7 +5911,7 @@ def __init__( :param expires_in: The time in seconds by which this token will expire. :type expires_in: Optional[int], optional :param token_type: The type of access token returned. - :type token_type: Optional[FileFullExpiringEmbedLinkFieldTokenTypeField], optional + :type token_type: Optional[FileFullExpiringEmbedLinkTokenTypeField], optional :param restricted_to: The permissions that this access token permits, providing a list of resources (files, folders, etc) and the scopes permitted for each of those resources. @@ -5958,7 +5954,7 @@ def __init__(self, **kwargs): self.extra_data = kwargs -class FileFullRepresentationsFieldEntriesFieldContentField(BaseObject): +class FileFullRepresentationsEntriesContentField(BaseObject): def __init__(self, url_template: Optional[str] = None, **kwargs): """ :param url_template: The download URL that can be used to fetch the representation. @@ -5987,7 +5983,7 @@ def __init__(self, url_template: Optional[str] = None, **kwargs): self.url_template = url_template -class FileFullRepresentationsFieldEntriesFieldInfoField(BaseObject): +class FileFullRepresentationsEntriesInfoField(BaseObject): def __init__(self, url: Optional[str] = None, **kwargs): """ :param url: The API URL that can be used to get more info on this file @@ -5999,7 +5995,7 @@ def __init__(self, url: Optional[str] = None, **kwargs): self.url = url -class FileFullRepresentationsFieldEntriesFieldPropertiesField(BaseObject): +class FileFullRepresentationsEntriesPropertiesField(BaseObject): def __init__( self, dimensions: Optional[str] = None, @@ -6023,19 +6019,17 @@ def __init__( self.thumb = thumb -class FileFullRepresentationsFieldEntriesFieldStatusFieldStateField(str, Enum): +class FileFullRepresentationsEntriesStatusStateField(str, Enum): SUCCESS = 'success' VIEWABLE = 'viewable' PENDING = 'pending' NONE = 'none' -class FileFullRepresentationsFieldEntriesFieldStatusField(BaseObject): +class FileFullRepresentationsEntriesStatusField(BaseObject): def __init__( self, - state: Optional[ - FileFullRepresentationsFieldEntriesFieldStatusFieldStateField - ] = None, + state: Optional[FileFullRepresentationsEntriesStatusStateField] = None, **kwargs ): """ @@ -6047,37 +6041,35 @@ def __init__( * `none` defines that the representation will be created when requested. Request the URL defined in the `info` object to trigger this generation. - :type state: Optional[FileFullRepresentationsFieldEntriesFieldStatusFieldStateField], optional + :type state: Optional[FileFullRepresentationsEntriesStatusStateField], optional """ super().__init__(**kwargs) self.state = state -class FileFullRepresentationsFieldEntriesField(BaseObject): +class FileFullRepresentationsEntriesField(BaseObject): def __init__( self, - content: Optional[FileFullRepresentationsFieldEntriesFieldContentField] = None, - info: Optional[FileFullRepresentationsFieldEntriesFieldInfoField] = None, - properties: Optional[ - FileFullRepresentationsFieldEntriesFieldPropertiesField - ] = None, + content: Optional[FileFullRepresentationsEntriesContentField] = None, + info: Optional[FileFullRepresentationsEntriesInfoField] = None, + properties: Optional[FileFullRepresentationsEntriesPropertiesField] = None, representation: Optional[str] = None, - status: Optional[FileFullRepresentationsFieldEntriesFieldStatusField] = None, + status: Optional[FileFullRepresentationsEntriesStatusField] = None, **kwargs ): """ :param content: An object containing the URL that can be used to actually fetch the representation. - :type content: Optional[FileFullRepresentationsFieldEntriesFieldContentField], optional + :type content: Optional[FileFullRepresentationsEntriesContentField], optional :param info: An object containing the URL that can be used to fetch more info on this representation. - :type info: Optional[FileFullRepresentationsFieldEntriesFieldInfoField], optional + :type info: Optional[FileFullRepresentationsEntriesInfoField], optional :param properties: An object containing the size and type of this presentation. - :type properties: Optional[FileFullRepresentationsFieldEntriesFieldPropertiesField], optional + :type properties: Optional[FileFullRepresentationsEntriesPropertiesField], optional :param representation: Indicates the file type of the returned representation. :type representation: Optional[str], optional :param status: An object containing the status of this representation. - :type status: Optional[FileFullRepresentationsFieldEntriesFieldStatusField], optional + :type status: Optional[FileFullRepresentationsEntriesStatusField], optional """ super().__init__(**kwargs) self.content = content @@ -6090,12 +6082,12 @@ def __init__( class FileFullRepresentationsField(BaseObject): def __init__( self, - entries: Optional[List[FileFullRepresentationsFieldEntriesField]] = None, + entries: Optional[List[FileFullRepresentationsEntriesField]] = None, **kwargs ): """ :param entries: A list of files - :type entries: Optional[List[FileFullRepresentationsFieldEntriesField]], optional + :type entries: Optional[List[FileFullRepresentationsEntriesField]], optional """ super().__init__(**kwargs) self.entries = entries @@ -6347,11 +6339,11 @@ def __init__( self.product_name = product_name -class DevicePinnersOrderFieldByField(str, Enum): +class DevicePinnersOrderByField(str, Enum): ID = 'id' -class DevicePinnersOrderFieldDirectionField(str, Enum): +class DevicePinnersOrderDirectionField(str, Enum): ASC = 'asc' DESC = 'desc' @@ -6359,15 +6351,15 @@ class DevicePinnersOrderFieldDirectionField(str, Enum): class DevicePinnersOrderField(BaseObject): def __init__( self, - by: Optional[DevicePinnersOrderFieldByField] = None, - direction: Optional[DevicePinnersOrderFieldDirectionField] = None, + by: Optional[DevicePinnersOrderByField] = None, + direction: Optional[DevicePinnersOrderDirectionField] = None, **kwargs ): """ :param by: The field that is ordered by - :type by: Optional[DevicePinnersOrderFieldByField], optional + :type by: Optional[DevicePinnersOrderByField], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[DevicePinnersOrderFieldDirectionField], optional + :type direction: Optional[DevicePinnersOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -6500,7 +6492,7 @@ def __init__( self.tagged_message = tagged_message -class CommentsOrderFieldDirectionField(str, Enum): +class CommentsOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -6509,14 +6501,14 @@ class CommentsOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[CommentsOrderFieldDirectionField] = None, + direction: Optional[CommentsOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[CommentsOrderFieldDirectionField], optional + :type direction: Optional[CommentsOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -6568,7 +6560,7 @@ class CollaborationAllowlistExemptTargetTypeField(str, Enum): COLLABORATION_WHITELIST_EXEMPT_TARGET = 'collaboration_whitelist_exempt_target' -class CollaborationAllowlistExemptTargetEnterpriseFieldTypeField(str, Enum): +class CollaborationAllowlistExemptTargetEnterpriseTypeField(str, Enum): ENTERPRISE = 'enterprise' @@ -6576,9 +6568,7 @@ class CollaborationAllowlistExemptTargetEnterpriseField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[ - CollaborationAllowlistExemptTargetEnterpriseFieldTypeField - ] = None, + type: Optional[CollaborationAllowlistExemptTargetEnterpriseTypeField] = None, name: Optional[str] = None, **kwargs ): @@ -6586,7 +6576,7 @@ def __init__( :param id: The unique identifier for this enterprise. :type id: Optional[str], optional :param type: `enterprise` - :type type: Optional[CollaborationAllowlistExemptTargetEnterpriseFieldTypeField], optional + :type type: Optional[CollaborationAllowlistExemptTargetEnterpriseTypeField], optional :param name: The name of the enterprise :type name: Optional[str], optional """ @@ -6753,7 +6743,7 @@ def __init__( self.user = user -class ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentFieldTypeField( +class ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField( str, Enum ): SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment' @@ -6766,7 +6756,7 @@ def __init__( self, id: Optional[str] = None, type: Optional[ - ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentFieldTypeField + ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField ] = None, **kwargs ): @@ -6775,7 +6765,7 @@ def __init__( shield information barrier segment. :type id: Optional[str], optional :param type: The type of the shield information barrier segment - :type type: Optional[ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentFieldTypeField], optional + :type type: Optional[ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField], optional """ super().__init__(**kwargs) self.id = id @@ -7105,7 +7095,7 @@ class WebhookMiniTypeField(str, Enum): WEBHOOK = 'webhook' -class WebhookMiniTargetFieldTypeField(str, Enum): +class WebhookMiniTargetTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' @@ -7114,14 +7104,14 @@ class WebhookMiniTargetField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[WebhookMiniTargetFieldTypeField] = None, + type: Optional[WebhookMiniTargetTypeField] = None, **kwargs ): """ :param id: The ID of the item to trigger a webhook :type id: Optional[str], optional :param type: The type of item to trigger a webhook - :type type: Optional[WebhookMiniTargetFieldTypeField], optional + :type type: Optional[WebhookMiniTargetTypeField], optional """ super().__init__(**kwargs) self.id = id @@ -7322,26 +7312,26 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.entries = entries -class WebLinkSharedLinkFieldAccessField(str, Enum): +class WebLinkSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class WebLinkSharedLinkFieldEffectiveAccessField(str, Enum): +class WebLinkSharedLinkEffectiveAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class WebLinkSharedLinkFieldEffectivePermissionField(str, Enum): +class WebLinkSharedLinkEffectivePermissionField(str, Enum): CAN_EDIT = 'can_edit' CAN_DOWNLOAD = 'can_download' CAN_PREVIEW = 'can_preview' NO_ACCESS = 'no_access' -class WebLinkSharedLinkFieldPermissionsField(BaseObject): +class WebLinkSharedLinkPermissionsField(BaseObject): def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwargs): """ :param can_download: Defines if the shared link allows for the item to be downloaded. For @@ -7368,17 +7358,17 @@ class WebLinkSharedLinkField(BaseObject): def __init__( self, url: str, - effective_access: WebLinkSharedLinkFieldEffectiveAccessField, - effective_permission: WebLinkSharedLinkFieldEffectivePermissionField, + effective_access: WebLinkSharedLinkEffectiveAccessField, + effective_permission: WebLinkSharedLinkEffectivePermissionField, 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, + access: Optional[WebLinkSharedLinkAccessField] = None, unshared_at: Optional[str] = None, - permissions: Optional[WebLinkSharedLinkFieldPermissionsField] = None, + permissions: Optional[WebLinkSharedLinkPermissionsField] = None, **kwargs ): """ @@ -7391,13 +7381,13 @@ def __init__( :param effective_access: The effective access level for the shared link. This can be a more restrictive access level than the value in the `access` field when the enterprise settings restrict the allowed access levels. - :type effective_access: WebLinkSharedLinkFieldEffectiveAccessField + :type effective_access: WebLinkSharedLinkEffectiveAccessField :param effective_permission: The effective permissions for this shared link. These result in the more restrictive combination of the share link permissions and the item permissions set by the administrator, the owner, and any ancestor item such as a folder. - :type effective_permission: WebLinkSharedLinkFieldEffectivePermissionField + :type effective_permission: WebLinkSharedLinkEffectivePermissionField :param is_password_enabled: Defines if the shared link requires a password to access the item. :type is_password_enabled: bool :param download_count: The number of times this item has been downloaded. @@ -7421,14 +7411,14 @@ def __init__( collaborators on this item If this field is omitted when creating the shared link, the access level will be set to the default access level specified by the enterprise admin. - :type access: Optional[WebLinkSharedLinkFieldAccessField], optional + :type access: Optional[WebLinkSharedLinkAccessField], optional :param unshared_at: The date and time when this link will be unshared. This field can only be set by users with paid accounts. :type unshared_at: Optional[str], optional :param permissions: Defines if this link allows a user to preview, edit, and download an item. These permissions refer to the shared link only and do not supersede permissions applied to the item itself. - :type permissions: Optional[WebLinkSharedLinkFieldPermissionsField], optional + :type permissions: Optional[WebLinkSharedLinkPermissionsField], optional """ super().__init__(**kwargs) self.url = url @@ -7526,7 +7516,7 @@ def __init__( self.item_status = item_status -class ItemsOrderFieldDirectionField(str, Enum): +class ItemsOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -7535,14 +7525,14 @@ class ItemsOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[ItemsOrderFieldDirectionField] = None, + direction: Optional[ItemsOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[ItemsOrderFieldDirectionField], optional + :type direction: Optional[ItemsOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -7603,26 +7593,26 @@ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs): self.entries = entries -class FolderSharedLinkFieldAccessField(str, Enum): +class FolderSharedLinkAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class FolderSharedLinkFieldEffectiveAccessField(str, Enum): +class FolderSharedLinkEffectiveAccessField(str, Enum): OPEN = 'open' COMPANY = 'company' COLLABORATORS = 'collaborators' -class FolderSharedLinkFieldEffectivePermissionField(str, Enum): +class FolderSharedLinkEffectivePermissionField(str, Enum): CAN_EDIT = 'can_edit' CAN_DOWNLOAD = 'can_download' CAN_PREVIEW = 'can_preview' NO_ACCESS = 'no_access' -class FolderSharedLinkFieldPermissionsField(BaseObject): +class FolderSharedLinkPermissionsField(BaseObject): def __init__(self, can_download: bool, can_preview: bool, can_edit: bool, **kwargs): """ :param can_download: Defines if the shared link allows for the item to be downloaded. For @@ -7649,17 +7639,17 @@ class FolderSharedLinkField(BaseObject): def __init__( self, url: str, - effective_access: FolderSharedLinkFieldEffectiveAccessField, - effective_permission: FolderSharedLinkFieldEffectivePermissionField, + effective_access: FolderSharedLinkEffectiveAccessField, + effective_permission: FolderSharedLinkEffectivePermissionField, 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, + access: Optional[FolderSharedLinkAccessField] = None, unshared_at: Optional[str] = None, - permissions: Optional[FolderSharedLinkFieldPermissionsField] = None, + permissions: Optional[FolderSharedLinkPermissionsField] = None, **kwargs ): """ @@ -7672,13 +7662,13 @@ def __init__( :param effective_access: The effective access level for the shared link. This can be a more restrictive access level than the value in the `access` field when the enterprise settings restrict the allowed access levels. - :type effective_access: FolderSharedLinkFieldEffectiveAccessField + :type effective_access: FolderSharedLinkEffectiveAccessField :param effective_permission: The effective permissions for this shared link. These result in the more restrictive combination of the share link permissions and the item permissions set by the administrator, the owner, and any ancestor item such as a folder. - :type effective_permission: FolderSharedLinkFieldEffectivePermissionField + :type effective_permission: FolderSharedLinkEffectivePermissionField :param is_password_enabled: Defines if the shared link requires a password to access the item. :type is_password_enabled: bool :param download_count: The number of times this item has been downloaded. @@ -7702,14 +7692,14 @@ def __init__( collaborators on this item If this field is omitted when creating the shared link, the access level will be set to the default access level specified by the enterprise admin. - :type access: Optional[FolderSharedLinkFieldAccessField], optional + :type access: Optional[FolderSharedLinkAccessField], optional :param unshared_at: The date and time when this link will be unshared. This field can only be set by users with paid accounts. :type unshared_at: Optional[str], optional :param permissions: Defines if this link allows a user to preview, edit, and download an item. These permissions refer to the shared link only and do not supersede permissions applied to the item itself. - :type permissions: Optional[FolderSharedLinkFieldPermissionsField], optional + :type permissions: Optional[FolderSharedLinkPermissionsField], optional """ super().__init__(**kwargs) self.url = url @@ -7726,7 +7716,7 @@ def __init__( self.permissions = permissions -class FolderFolderUploadEmailFieldAccessField(str, Enum): +class FolderFolderUploadEmailAccessField(str, Enum): OPEN = 'open' COLLABORATORS = 'collaborators' @@ -7734,7 +7724,7 @@ class FolderFolderUploadEmailFieldAccessField(str, Enum): class FolderFolderUploadEmailField(BaseObject): def __init__( self, - access: Optional[FolderFolderUploadEmailFieldAccessField] = None, + access: Optional[FolderFolderUploadEmailAccessField] = None, email: Optional[str] = None, **kwargs ): @@ -7749,7 +7739,7 @@ def __init__( any email aliases a user might have registered. When set to `open` it will accept emails from any email address. - :type access: Optional[FolderFolderUploadEmailFieldAccessField], optional + :type access: Optional[FolderFolderUploadEmailAccessField], optional :param email: The optional upload email address for this folder. :type email: Optional[str], optional """ @@ -8669,7 +8659,7 @@ class SkillInvocationTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' -class SkillInvocationSkillFieldTypeField(str, Enum): +class SkillInvocationSkillTypeField(str, Enum): SKILL = 'skill' @@ -8677,7 +8667,7 @@ class SkillInvocationSkillField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[SkillInvocationSkillFieldTypeField] = None, + type: Optional[SkillInvocationSkillTypeField] = None, name: Optional[str] = None, api_key: Optional[str] = None, **kwargs @@ -8686,7 +8676,7 @@ def __init__( :param id: The unique identifier for this skill :type id: Optional[str], optional :param type: `skill` - :type type: Optional[SkillInvocationSkillFieldTypeField], optional + :type type: Optional[SkillInvocationSkillTypeField], optional :param name: The name of the skill :type name: Optional[str], optional :param api_key: The client ID of the application @@ -8699,16 +8689,16 @@ def __init__( self.api_key = api_key -class SkillInvocationTokenFieldReadFieldTokenTypeField(str, Enum): +class SkillInvocationTokenReadTokenTypeField(str, Enum): BEARER = 'bearer' -class SkillInvocationTokenFieldReadField(BaseObject): +class SkillInvocationTokenReadField(BaseObject): def __init__( self, access_token: Optional[str] = None, expires_in: Optional[int] = None, - token_type: Optional[SkillInvocationTokenFieldReadFieldTokenTypeField] = None, + token_type: Optional[SkillInvocationTokenReadTokenTypeField] = None, restricted_to: Optional[str] = None, **kwargs ): @@ -8718,7 +8708,7 @@ def __init__( :param expires_in: The time in seconds by which this token will expire. :type expires_in: Optional[int], optional :param token_type: The type of access token returned. - :type token_type: Optional[SkillInvocationTokenFieldReadFieldTokenTypeField], optional + :type token_type: Optional[SkillInvocationTokenReadTokenTypeField], optional :param restricted_to: The permissions that this access token permits, providing a list of resources (files, folders, etc) and the scopes permitted for each of those resources. @@ -8731,16 +8721,16 @@ def __init__( self.restricted_to = restricted_to -class SkillInvocationTokenFieldWriteFieldTokenTypeField(str, Enum): +class SkillInvocationTokenWriteTokenTypeField(str, Enum): BEARER = 'bearer' -class SkillInvocationTokenFieldWriteField(BaseObject): +class SkillInvocationTokenWriteField(BaseObject): def __init__( self, access_token: Optional[str] = None, expires_in: Optional[int] = None, - token_type: Optional[SkillInvocationTokenFieldWriteFieldTokenTypeField] = None, + token_type: Optional[SkillInvocationTokenWriteTokenTypeField] = None, restricted_to: Optional[str] = None, **kwargs ): @@ -8750,7 +8740,7 @@ def __init__( :param expires_in: The time in seconds by which this token will expire. :type expires_in: Optional[int], optional :param token_type: The type of access token returned. - :type token_type: Optional[SkillInvocationTokenFieldWriteFieldTokenTypeField], optional + :type token_type: Optional[SkillInvocationTokenWriteTokenTypeField], optional :param restricted_to: The permissions that this access token permits, providing a list of resources (files, folders, etc) and the scopes permitted for each of those resources. @@ -8766,22 +8756,22 @@ def __init__( class SkillInvocationTokenField(BaseObject): def __init__( self, - read: Optional[SkillInvocationTokenFieldReadField] = None, - write: Optional[SkillInvocationTokenFieldWriteField] = None, + read: Optional[SkillInvocationTokenReadField] = None, + write: Optional[SkillInvocationTokenWriteField] = None, **kwargs ): """ :param read: The basics of an access token - :type read: Optional[SkillInvocationTokenFieldReadField], optional + :type read: Optional[SkillInvocationTokenReadField], optional :param write: The basics of an access token - :type write: Optional[SkillInvocationTokenFieldWriteField], optional + :type write: Optional[SkillInvocationTokenWriteField], optional """ super().__init__(**kwargs) self.read = read self.write = write -class SkillInvocationStatusFieldStateField(str, Enum): +class SkillInvocationStatusStateField(str, Enum): INVOKED = 'invoked' PROCESSING = 'processing' SUCCESS = 'success' @@ -8792,7 +8782,7 @@ class SkillInvocationStatusFieldStateField(str, Enum): class SkillInvocationStatusField(BaseObject): def __init__( self, - state: Optional[SkillInvocationStatusFieldStateField] = None, + state: Optional[SkillInvocationStatusStateField] = None, message: Optional[str] = None, error_code: Optional[str] = None, additional_info: Optional[str] = None, @@ -8808,7 +8798,7 @@ def __init__( retried. * `permanent_failure` - Encountered a permanent issue and retry would not help. - :type state: Optional[SkillInvocationStatusFieldStateField], optional + :type state: Optional[SkillInvocationStatusStateField], optional :param message: Status information :type message: Optional[str], optional :param error_code: Error code information, if error occurred. @@ -8823,7 +8813,7 @@ def __init__( self.additional_info = additional_info -class SkillInvocationEnterpriseFieldTypeField(str, Enum): +class SkillInvocationEnterpriseTypeField(str, Enum): ENTERPRISE = 'enterprise' @@ -8831,7 +8821,7 @@ class SkillInvocationEnterpriseField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[SkillInvocationEnterpriseFieldTypeField] = None, + type: Optional[SkillInvocationEnterpriseTypeField] = None, name: Optional[str] = None, **kwargs ): @@ -8839,7 +8829,7 @@ def __init__( :param id: The unique identifier for this enterprise. :type id: Optional[str], optional :param type: `enterprise` - :type type: Optional[SkillInvocationEnterpriseFieldTypeField], optional + :type type: Optional[SkillInvocationEnterpriseTypeField], optional :param name: The name of the enterprise :type name: Optional[str], optional """ @@ -8912,7 +8902,7 @@ class CollaborationStatusField(str, Enum): REJECTED = 'rejected' -class CollaborationAcceptanceRequirementsStatusFieldTermsOfServiceRequirementField( +class CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField( BaseObject ): def __init__( @@ -8931,7 +8921,7 @@ def __init__( self.terms_of_service = terms_of_service -class CollaborationAcceptanceRequirementsStatusFieldStrongPasswordRequirementField( +class CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField( BaseObject ): def __init__( @@ -8958,7 +8948,7 @@ def __init__( self.user_has_strong_password = user_has_strong_password -class CollaborationAcceptanceRequirementsStatusFieldTwoFactorAuthenticationRequirementField( +class CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField( BaseObject ): def __init__( @@ -8990,13 +8980,13 @@ class CollaborationAcceptanceRequirementsStatusField(BaseObject): def __init__( self, terms_of_service_requirement: Optional[ - CollaborationAcceptanceRequirementsStatusFieldTermsOfServiceRequirementField + CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField ] = None, strong_password_requirement: Optional[ - CollaborationAcceptanceRequirementsStatusFieldStrongPasswordRequirementField + CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField ] = None, two_factor_authentication_requirement: Optional[ - CollaborationAcceptanceRequirementsStatusFieldTwoFactorAuthenticationRequirementField + CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField ] = None, **kwargs ): @@ -9076,7 +9066,7 @@ def __init__( self.acceptance_requirements_status = acceptance_requirements_status -class CollaborationsOrderFieldDirectionField(str, Enum): +class CollaborationsOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -9085,14 +9075,14 @@ class CollaborationsOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[CollaborationsOrderFieldDirectionField] = None, + direction: Optional[CollaborationsOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[CollaborationsOrderFieldDirectionField], optional + :type direction: Optional[CollaborationsOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -9252,38 +9242,36 @@ def __init__( self.is_enabled = is_enabled -class WorkflowFlowsFieldTypeField(str, Enum): +class WorkflowFlowsTypeField(str, Enum): FLOW = 'flow' -class WorkflowFlowsFieldTriggerFieldTypeField(str, Enum): +class WorkflowFlowsTriggerTypeField(str, Enum): TRIGGER = 'trigger' -class WorkflowFlowsFieldTriggerFieldTriggerTypeField(str, Enum): +class WorkflowFlowsTriggerTriggerTypeField(str, Enum): WORKFLOW_MANUAL_START = 'WORKFLOW_MANUAL_START' -class WorkflowFlowsFieldTriggerFieldScopeFieldTypeField(str, Enum): +class WorkflowFlowsTriggerScopeTypeField(str, Enum): TRIGGER_SCOPE = 'trigger_scope' -class WorkflowFlowsFieldTriggerFieldScopeFieldObjectFieldTypeField(str, Enum): +class WorkflowFlowsTriggerScopeObjectTypeField(str, Enum): FOLDER = 'folder' -class WorkflowFlowsFieldTriggerFieldScopeFieldObjectField(BaseObject): +class WorkflowFlowsTriggerScopeObjectField(BaseObject): def __init__( self, - type: Optional[ - WorkflowFlowsFieldTriggerFieldScopeFieldObjectFieldTypeField - ] = None, + type: Optional[WorkflowFlowsTriggerScopeObjectTypeField] = None, id: Optional[str] = None, **kwargs ): """ :param type: The type of the object - :type type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldObjectFieldTypeField], optional + :type type: Optional[WorkflowFlowsTriggerScopeObjectTypeField], optional :param id: The id of the object :type id: Optional[str], optional """ @@ -9292,21 +9280,21 @@ def __init__( self.id = id -class WorkflowFlowsFieldTriggerFieldScopeField(BaseObject): +class WorkflowFlowsTriggerScopeField(BaseObject): def __init__( self, - type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldTypeField] = None, + type: Optional[WorkflowFlowsTriggerScopeTypeField] = None, ref: Optional[str] = None, - object: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldObjectField] = None, + object: Optional[WorkflowFlowsTriggerScopeObjectField] = None, **kwargs ): """ :param type: The trigger scope's resource type - :type type: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldTypeField], optional + :type type: Optional[WorkflowFlowsTriggerScopeTypeField], optional :param ref: Indicates the path of the condition value to check :type ref: Optional[str], optional :param object: The object the `ref` points to - :type object: Optional[WorkflowFlowsFieldTriggerFieldScopeFieldObjectField], optional + :type object: Optional[WorkflowFlowsTriggerScopeObjectField], optional """ super().__init__(**kwargs) self.type = type @@ -9314,21 +9302,21 @@ def __init__( self.object = object -class WorkflowFlowsFieldTriggerField(BaseObject): +class WorkflowFlowsTriggerField(BaseObject): def __init__( self, - type: Optional[WorkflowFlowsFieldTriggerFieldTypeField] = None, - trigger_type: Optional[WorkflowFlowsFieldTriggerFieldTriggerTypeField] = None, - scope: Optional[List[WorkflowFlowsFieldTriggerFieldScopeField]] = None, + type: Optional[WorkflowFlowsTriggerTypeField] = None, + trigger_type: Optional[WorkflowFlowsTriggerTriggerTypeField] = None, + scope: Optional[List[WorkflowFlowsTriggerScopeField]] = None, **kwargs ): """ :param type: The trigger's resource type - :type type: Optional[WorkflowFlowsFieldTriggerFieldTypeField], optional + :type type: Optional[WorkflowFlowsTriggerTypeField], optional :param trigger_type: The type of trigger selected for this flow - :type trigger_type: Optional[WorkflowFlowsFieldTriggerFieldTriggerTypeField], optional + :type trigger_type: Optional[WorkflowFlowsTriggerTriggerTypeField], optional :param scope: List of trigger scopes - :type scope: Optional[List[WorkflowFlowsFieldTriggerFieldScopeField]], optional + :type scope: Optional[List[WorkflowFlowsTriggerScopeField]], optional """ super().__init__(**kwargs) self.type = type @@ -9336,11 +9324,11 @@ def __init__( self.scope = scope -class WorkflowFlowsFieldOutcomesFieldTypeField(str, Enum): +class WorkflowFlowsOutcomesTypeField(str, Enum): OUTCOME = 'outcome' -class WorkflowFlowsFieldOutcomesFieldActionTypeField(str, Enum): +class WorkflowFlowsOutcomesActionTypeField(str, Enum): ADD_METADATA = 'add_metadata' ASSIGN_TASK = 'assign_task' COPY_FILE = 'copy_file' @@ -9366,11 +9354,11 @@ class WorkflowFlowsFieldOutcomesFieldActionTypeField(str, Enum): SEND_NOTIFICATION = 'send_notification' -class WorkflowFlowsFieldOutcomesFieldIfRejectedFieldTypeField(str, Enum): +class WorkflowFlowsOutcomesIfRejectedTypeField(str, Enum): OUTCOME = 'outcome' -class WorkflowFlowsFieldOutcomesFieldIfRejectedFieldActionTypeField(str, Enum): +class WorkflowFlowsOutcomesIfRejectedActionTypeField(str, Enum): ADD_METADATA = 'add_metadata' ASSIGN_TASK = 'assign_task' COPY_FILE = 'copy_file' @@ -9396,22 +9384,20 @@ class WorkflowFlowsFieldOutcomesFieldIfRejectedFieldActionTypeField(str, Enum): SEND_NOTIFICATION = 'send_notification' -class WorkflowFlowsFieldOutcomesFieldIfRejectedField(BaseObject): +class WorkflowFlowsOutcomesIfRejectedField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[WorkflowFlowsFieldOutcomesFieldIfRejectedFieldTypeField] = None, + type: Optional[WorkflowFlowsOutcomesIfRejectedTypeField] = None, name: Optional[str] = None, - action_type: Optional[ - WorkflowFlowsFieldOutcomesFieldIfRejectedFieldActionTypeField - ] = None, + action_type: Optional[WorkflowFlowsOutcomesIfRejectedActionTypeField] = None, **kwargs ): """ :param id: The identifier of the outcome :type id: Optional[str], optional :param type: The outcomes resource type - :type type: Optional[WorkflowFlowsFieldOutcomesFieldIfRejectedFieldTypeField], optional + :type type: Optional[WorkflowFlowsOutcomesIfRejectedTypeField], optional :param name: The name of the outcome :type name: Optional[str], optional """ @@ -9422,28 +9408,26 @@ def __init__( self.action_type = action_type -class WorkflowFlowsFieldOutcomesField(BaseObject): +class WorkflowFlowsOutcomesField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[WorkflowFlowsFieldOutcomesFieldTypeField] = None, + type: Optional[WorkflowFlowsOutcomesTypeField] = None, name: Optional[str] = None, - action_type: Optional[WorkflowFlowsFieldOutcomesFieldActionTypeField] = None, - if_rejected: Optional[ - List[WorkflowFlowsFieldOutcomesFieldIfRejectedField] - ] = None, + action_type: Optional[WorkflowFlowsOutcomesActionTypeField] = None, + if_rejected: Optional[List[WorkflowFlowsOutcomesIfRejectedField]] = None, **kwargs ): """ :param id: The identifier of the outcome :type id: Optional[str], optional :param type: The outcomes resource type - :type type: Optional[WorkflowFlowsFieldOutcomesFieldTypeField], optional + :type type: Optional[WorkflowFlowsOutcomesTypeField], optional :param name: The name of the outcome :type name: Optional[str], optional :param if_rejected: If `action_type` is `assign_task` and the task is rejected, returns a list of outcomes to complete - :type if_rejected: Optional[List[WorkflowFlowsFieldOutcomesFieldIfRejectedField]], optional + :type if_rejected: Optional[List[WorkflowFlowsOutcomesIfRejectedField]], optional """ super().__init__(**kwargs) self.id = id @@ -9457,9 +9441,9 @@ class WorkflowFlowsField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[WorkflowFlowsFieldTypeField] = None, - trigger: Optional[WorkflowFlowsFieldTriggerField] = None, - outcomes: Optional[List[WorkflowFlowsFieldOutcomesField]] = None, + type: Optional[WorkflowFlowsTypeField] = None, + trigger: Optional[WorkflowFlowsTriggerField] = None, + outcomes: Optional[List[WorkflowFlowsOutcomesField]] = None, created_at: Optional[str] = None, created_by: Optional[UserBase] = None, **kwargs @@ -9468,7 +9452,7 @@ def __init__( :param id: The identifier of the flow :type id: Optional[str], optional :param type: The flow's resource type - :type type: Optional[WorkflowFlowsFieldTypeField], optional + :type type: Optional[WorkflowFlowsTypeField], optional :param created_at: When this flow was created :type created_at: Optional[str], optional """ @@ -9593,7 +9577,7 @@ def __init__( self.modified_by = modified_by -class ZipDownloadNameConflictsFieldTypeField(str, Enum): +class ZipDownloadNameConflictsTypeField(str, Enum): FILE = 'file' FOLDER = 'folder' @@ -9602,7 +9586,7 @@ class ZipDownloadNameConflictsField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[ZipDownloadNameConflictsFieldTypeField] = None, + type: Optional[ZipDownloadNameConflictsTypeField] = None, original_name: Optional[str] = None, download_name: Optional[str] = None, **kwargs @@ -9611,7 +9595,7 @@ def __init__( :param id: The identifier of the item :type id: Optional[str], optional :param type: The type of this item - :type type: Optional[ZipDownloadNameConflictsFieldTypeField], optional + :type type: Optional[ZipDownloadNameConflictsTypeField], optional :param original_name: The original name of this item :type original_name: Optional[str], optional :param download_name: The new name of this item as it will appear in the @@ -9739,15 +9723,15 @@ def __init__(self, message: str, code: Optional[str] = None, **kwargs): self.code = code -class KeywordSkillCardSkillFieldTypeField(str, Enum): +class KeywordSkillCardSkillTypeField(str, Enum): SERVICE = 'service' class KeywordSkillCardSkillField(BaseObject): - def __init__(self, type: KeywordSkillCardSkillFieldTypeField, id: str, **kwargs): + def __init__(self, type: KeywordSkillCardSkillTypeField, id: str, **kwargs): """ :param type: `service` - :type type: KeywordSkillCardSkillFieldTypeField + :type type: KeywordSkillCardSkillTypeField :param id: A custom identifier that represent the service that applied this metadata. :type id: str @@ -9757,17 +9741,15 @@ def __init__(self, type: KeywordSkillCardSkillFieldTypeField, id: str, **kwargs) self.id = id -class KeywordSkillCardInvocationFieldTypeField(str, Enum): +class KeywordSkillCardInvocationTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' class KeywordSkillCardInvocationField(BaseObject): - def __init__( - self, type: KeywordSkillCardInvocationFieldTypeField, id: str, **kwargs - ): + def __init__(self, type: KeywordSkillCardInvocationTypeField, id: str, **kwargs): """ :param type: `skill_invocation` - :type type: KeywordSkillCardInvocationFieldTypeField + :type type: KeywordSkillCardInvocationTypeField :param id: A custom identifier that represent the instance of the service that applied this metadata. For example, if your `image-recognition-service` runs on multiple @@ -10017,15 +9999,15 @@ def __init__(self, message: str, code: Optional[str] = None, **kwargs): self.code = code -class TimelineSkillCardSkillFieldTypeField(str, Enum): +class TimelineSkillCardSkillTypeField(str, Enum): SERVICE = 'service' class TimelineSkillCardSkillField(BaseObject): - def __init__(self, type: TimelineSkillCardSkillFieldTypeField, id: str, **kwargs): + def __init__(self, type: TimelineSkillCardSkillTypeField, id: str, **kwargs): """ :param type: `service` - :type type: TimelineSkillCardSkillFieldTypeField + :type type: TimelineSkillCardSkillTypeField :param id: A custom identifier that represent the service that applied this metadata. :type id: str @@ -10035,17 +10017,15 @@ def __init__(self, type: TimelineSkillCardSkillFieldTypeField, id: str, **kwargs self.id = id -class TimelineSkillCardInvocationFieldTypeField(str, Enum): +class TimelineSkillCardInvocationTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' class TimelineSkillCardInvocationField(BaseObject): - def __init__( - self, type: TimelineSkillCardInvocationFieldTypeField, id: str, **kwargs - ): + def __init__(self, type: TimelineSkillCardInvocationTypeField, id: str, **kwargs): """ :param type: `skill_invocation` - :type type: TimelineSkillCardInvocationFieldTypeField + :type type: TimelineSkillCardInvocationTypeField :param id: A custom identifier that represent the instance of the service that applied this metadata. For example, if your `image-recognition-service` runs on multiple @@ -10058,7 +10038,7 @@ def __init__( self.id = id -class TimelineSkillCardEntriesFieldAppearsField(BaseObject): +class TimelineSkillCardEntriesAppearsField(BaseObject): def __init__( self, start: Optional[int] = None, end: Optional[int] = None, **kwargs ): @@ -10079,7 +10059,7 @@ class TimelineSkillCardEntriesField(BaseObject): def __init__( self, text: Optional[str] = None, - appears: Optional[List[TimelineSkillCardEntriesFieldAppearsField]] = None, + appears: Optional[List[TimelineSkillCardEntriesAppearsField]] = None, image_url: Optional[str] = None, **kwargs ): @@ -10090,7 +10070,7 @@ def __init__( :type text: Optional[str], optional :param appears: Defines a list of timestamps for when this item should appear on the timeline. - :type appears: Optional[List[TimelineSkillCardEntriesFieldAppearsField]], optional + :type appears: Optional[List[TimelineSkillCardEntriesAppearsField]], optional :param image_url: The image to show on a for an entry that appears on a timeline. This image URL is required for every entry. The image will be shown in a @@ -10169,15 +10149,15 @@ def __init__(self, message: str, code: Optional[str] = None, **kwargs): self.code = code -class TranscriptSkillCardSkillFieldTypeField(str, Enum): +class TranscriptSkillCardSkillTypeField(str, Enum): SERVICE = 'service' class TranscriptSkillCardSkillField(BaseObject): - def __init__(self, type: TranscriptSkillCardSkillFieldTypeField, id: str, **kwargs): + def __init__(self, type: TranscriptSkillCardSkillTypeField, id: str, **kwargs): """ :param type: `service` - :type type: TranscriptSkillCardSkillFieldTypeField + :type type: TranscriptSkillCardSkillTypeField :param id: A custom identifier that represent the service that applied this metadata. :type id: str @@ -10187,17 +10167,15 @@ def __init__(self, type: TranscriptSkillCardSkillFieldTypeField, id: str, **kwar self.id = id -class TranscriptSkillCardInvocationFieldTypeField(str, Enum): +class TranscriptSkillCardInvocationTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' class TranscriptSkillCardInvocationField(BaseObject): - def __init__( - self, type: TranscriptSkillCardInvocationFieldTypeField, id: str, **kwargs - ): + def __init__(self, type: TranscriptSkillCardInvocationTypeField, id: str, **kwargs): """ :param type: `skill_invocation` - :type type: TranscriptSkillCardInvocationFieldTypeField + :type type: TranscriptSkillCardInvocationTypeField :param id: A custom identifier that represent the instance of the service that applied this metadata. For example, if your `image-recognition-service` runs on multiple @@ -10210,7 +10188,7 @@ def __init__( self.id = id -class TranscriptSkillCardEntriesFieldAppearsField(BaseObject): +class TranscriptSkillCardEntriesAppearsField(BaseObject): def __init__(self, start: Optional[int] = None, **kwargs): """ :param start: The time in seconds when an @@ -10225,7 +10203,7 @@ class TranscriptSkillCardEntriesField(BaseObject): def __init__( self, text: Optional[str] = None, - appears: Optional[List[TranscriptSkillCardEntriesFieldAppearsField]] = None, + appears: Optional[List[TranscriptSkillCardEntriesAppearsField]] = None, **kwargs ): """ @@ -10234,7 +10212,7 @@ def __init__( :type text: Optional[str], optional :param appears: Defines when a transcribed bit of text appears. This only includes a start time and no end time. - :type appears: Optional[List[TranscriptSkillCardEntriesFieldAppearsField]], optional + :type appears: Optional[List[TranscriptSkillCardEntriesAppearsField]], optional """ super().__init__(**kwargs) self.text = text @@ -10308,7 +10286,7 @@ def __init__(self, message: str, code: Optional[str] = None, **kwargs): self.code = code -class StatusSkillCardStatusFieldCodeField(str, Enum): +class StatusSkillCardStatusCodeField(str, Enum): INVOKED = 'invoked' PROCESSING = 'processing' SUCCESS = 'success' @@ -10319,7 +10297,7 @@ class StatusSkillCardStatusFieldCodeField(str, Enum): class StatusSkillCardStatusField(BaseObject): def __init__( self, - code: StatusSkillCardStatusFieldCodeField, + code: StatusSkillCardStatusCodeField, message: Optional[str] = None, **kwargs ): @@ -10328,7 +10306,7 @@ def __init__( default each of these will have their own accompanied messages. These can be adjusted by setting the `message` value on this object. - :type code: StatusSkillCardStatusFieldCodeField + :type code: StatusSkillCardStatusCodeField :param message: A custom message that can be provided with this status. This will be shown in the web app to the end user. :type message: Optional[str], optional @@ -10338,15 +10316,15 @@ def __init__( self.message = message -class StatusSkillCardSkillFieldTypeField(str, Enum): +class StatusSkillCardSkillTypeField(str, Enum): SERVICE = 'service' class StatusSkillCardSkillField(BaseObject): - def __init__(self, type: StatusSkillCardSkillFieldTypeField, id: str, **kwargs): + def __init__(self, type: StatusSkillCardSkillTypeField, id: str, **kwargs): """ :param type: `service` - :type type: StatusSkillCardSkillFieldTypeField + :type type: StatusSkillCardSkillTypeField :param id: A custom identifier that represent the service that applied this metadata. :type id: str @@ -10356,17 +10334,15 @@ def __init__(self, type: StatusSkillCardSkillFieldTypeField, id: str, **kwargs): self.id = id -class StatusSkillCardInvocationFieldTypeField(str, Enum): +class StatusSkillCardInvocationTypeField(str, Enum): SKILL_INVOCATION = 'skill_invocation' class StatusSkillCardInvocationField(BaseObject): - def __init__( - self, type: StatusSkillCardInvocationFieldTypeField, id: str, **kwargs - ): + def __init__(self, type: StatusSkillCardInvocationTypeField, id: str, **kwargs): """ :param type: `skill_invocation` - :type type: StatusSkillCardInvocationFieldTypeField + :type type: StatusSkillCardInvocationTypeField :param id: A custom identifier that represent the instance of the service that applied this metadata. For example, if your `image-recognition-service` runs on multiple @@ -10668,7 +10644,7 @@ def __init__( self.content_type = content_type -class SignRequestSignerSignerDecisionFieldTypeField(str, Enum): +class SignRequestSignerSignerDecisionTypeField(str, Enum): SIGNED = 'signed' DECLINED = 'declined' @@ -10676,14 +10652,14 @@ class SignRequestSignerSignerDecisionFieldTypeField(str, Enum): class SignRequestSignerSignerDecisionField(BaseObject): def __init__( self, - type: Optional[SignRequestSignerSignerDecisionFieldTypeField] = None, + type: Optional[SignRequestSignerSignerDecisionTypeField] = None, finalized_at: Optional[str] = None, additional_info: Optional[str] = None, **kwargs ): """ :param type: Type of decision made by the signer - :type type: Optional[SignRequestSignerSignerDecisionFieldTypeField], optional + :type type: Optional[SignRequestSignerSignerDecisionTypeField], optional :param finalized_at: Date and Time that the decision was made :type finalized_at: Optional[str], optional :param additional_info: Additional info about the decision, such as the decline reason from the signer @@ -11278,7 +11254,7 @@ class SignTemplateTypeField(str, Enum): SIGN_TEMPLATE = 'sign-template' -class SignTemplateAdditionalInfoFieldNonEditableField(str, Enum): +class SignTemplateAdditionalInfoNonEditableField(str, Enum): EMAIL_SUBJECT = 'email_subject' EMAIL_MESSAGE = 'email_message' NAME = 'name' @@ -11287,21 +11263,21 @@ class SignTemplateAdditionalInfoFieldNonEditableField(str, Enum): SOURCE_FILES = 'source_files' -class SignTemplateAdditionalInfoFieldRequiredFieldSignersField(str, Enum): +class SignTemplateAdditionalInfoRequiredSignersField(str, Enum): EMAIL = 'email' -class SignTemplateAdditionalInfoFieldRequiredField(BaseObject): +class SignTemplateAdditionalInfoRequiredField(BaseObject): def __init__( self, signers: Optional[ - List[List[SignTemplateAdditionalInfoFieldRequiredFieldSignersField]] + List[List[SignTemplateAdditionalInfoRequiredSignersField]] ] = None, **kwargs ): """ :param signers: Required signer fields. - :type signers: Optional[List[List[SignTemplateAdditionalInfoFieldRequiredFieldSignersField]]], optional + :type signers: Optional[List[List[SignTemplateAdditionalInfoRequiredSignersField]]], optional """ super().__init__(**kwargs) self.signers = signers @@ -11310,17 +11286,15 @@ def __init__( class SignTemplateAdditionalInfoField(BaseObject): def __init__( self, - non_editable: Optional[ - List[SignTemplateAdditionalInfoFieldNonEditableField] - ] = None, - required: Optional[SignTemplateAdditionalInfoFieldRequiredField] = None, + non_editable: Optional[List[SignTemplateAdditionalInfoNonEditableField]] = None, + required: Optional[SignTemplateAdditionalInfoRequiredField] = None, **kwargs ): """ :param non_editable: Non editable fields. - :type non_editable: Optional[List[SignTemplateAdditionalInfoFieldNonEditableField]], optional + :type non_editable: Optional[List[SignTemplateAdditionalInfoNonEditableField]], optional :param required: Required fields. - :type required: Optional[SignTemplateAdditionalInfoFieldRequiredField], optional + :type required: Optional[SignTemplateAdditionalInfoRequiredField], optional """ super().__init__(**kwargs) self.non_editable = non_editable @@ -11618,7 +11592,7 @@ class UserFullRoleField(str, Enum): USER = 'user' -class UserFullEnterpriseFieldTypeField(str, Enum): +class UserFullEnterpriseTypeField(str, Enum): ENTERPRISE = 'enterprise' @@ -11626,7 +11600,7 @@ class UserFullEnterpriseField(BaseObject): def __init__( self, id: Optional[str] = None, - type: Optional[UserFullEnterpriseFieldTypeField] = None, + type: Optional[UserFullEnterpriseTypeField] = None, name: Optional[str] = None, **kwargs ): @@ -11634,7 +11608,7 @@ def __init__( :param id: The unique identifier for this enterprise. :type id: Optional[str], optional :param type: `enterprise` - :type type: Optional[UserFullEnterpriseFieldTypeField], optional + :type type: Optional[UserFullEnterpriseTypeField], optional :param name: The name of the enterprise :type name: Optional[str], optional """ @@ -11782,7 +11756,7 @@ def __init__( self.external_app_user_id = external_app_user_id -class UsersOrderFieldDirectionField(str, Enum): +class UsersOrderDirectionField(str, Enum): ASC = 'ASC' DESC = 'DESC' @@ -11791,14 +11765,14 @@ class UsersOrderField(BaseObject): def __init__( self, by: Optional[str] = None, - direction: Optional[UsersOrderFieldDirectionField] = None, + direction: Optional[UsersOrderDirectionField] = None, **kwargs ): """ :param by: The field to order by :type by: Optional[str], optional :param direction: The direction to order by, either ascending or descending - :type direction: Optional[UsersOrderFieldDirectionField], optional + :type direction: Optional[UsersOrderDirectionField], optional """ super().__init__(**kwargs) self.by = by @@ -11858,7 +11832,7 @@ class MetadataFieldFilterMultiSelect(BaseObject): pass -class MetadataFieldFilterFloatRangeMapValue(BaseObject): +class MetadataFieldFilterFloatRangeValue(BaseObject): def __init__( self, lt: Optional[float] = None, gt: Optional[float] = None, **kwargs ): @@ -11883,7 +11857,7 @@ class MetadataFieldFilterFloatRange(BaseObject): pass -class MetadataFieldFilterDateRangeMapValue(BaseObject): +class MetadataFieldFilterDateRangeValue(BaseObject): def __init__(self, lt: Optional[str] = None, gt: Optional[str] = None, **kwargs): """ :param lt: Specifies the (inclusive) upper bound for the metadata field diff --git a/docs/authorization.md b/docs/authorization.md index d0759ce..93e59a8 100644 --- a/docs/authorization.md +++ b/docs/authorization.md @@ -1,6 +1,9 @@ # AuthorizationManager - [Authorize user](#authorize-user) +- [Request access token](#request-access-token) +- [Refresh access token](#refresh-access-token) +- [Revoke access token](#revoke-access-token) ## Authorize user @@ -12,16 +15,16 @@ 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. -This operation is performed by calling function `get_authorize`. +This operation is performed by calling function `authorize_user`. 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 `authorize_user` in integration tests_ ### Arguments -- response_type `GetAuthorizeResponseTypeArg` +- response_type `AuthorizeUserResponseType` - The type of response we'd like to receive. - client_id `str` - The Client ID of the application that is requesting to authenticate the user. To get the Client ID for your application, log in to your Box developer console and click the **Edit Application** link for the application you're working with. In the OAuth 2.0 Parameters section of the configuration page, find the item labelled `client_id`. The text of that item is your application's Client ID. @@ -30,7 +33,7 @@ _Currently we don't have an example for calling `get_authorize` in integration t - state `Optional[str]` - A custom string of your choice. Box will pass the same string to the redirect URL when authentication is complete. This parameter can be used to identify a user on redirect, as well as protect against hijacked sessions and other exploits. - scope `Optional[str]` - - A comma-separated list of application scopes you'd like to authenticate the user for. This defaults to all the scopes configured for the application in its configuration page. + - A space-separated list of application scopes you'd like to authenticate the user for. This defaults to all the scopes configured for the application in its configuration page. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -39,3 +42,129 @@ _Currently we don't have an example for calling `get_authorize` in integration t This function returns a value of type `None`. Does not return any data, but rather should be used in the browser. + +## Request access token + +Request an Access Token using either a client-side obtained OAuth 2.0 +authorization code or a server-side JWT assertion. + +An Access Token is a string that enables Box to verify that a +request belongs to an authorized session. In the normal order of +operations you will begin by requesting authentication from the +[authorize](#get-authorize) endpoint and Box will send you an +authorization code. + +You will then send this code to this endpoint to exchange it for +an Access Token. The returned Access Token can then be used to to make +Box API calls. + +This operation is performed by calling function `request_access_token`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/post-oauth-2-token/). + +_Currently we don't have an example for calling `request_access_token` in integration tests_ + +### Arguments + +- grant_type `RequestAccessTokenGrantType` + - The type of request being made, either using a client-side obtained authorization code, a refresh token, a JWT assertion, client credentials grant or another access token for the purpose of downscoping a token. +- client_id `Optional[str]` + - The Client ID of the application requesting an access token. Used in combination with `authorization_code`, `client_credentials`, or `urn:ietf:params:oauth:grant-type:jwt-bearer` as the `grant_type`. +- client_secret `Optional[str]` + - The client secret of the application requesting an access token. Used in combination with `authorization_code`, `client_credentials`, or `urn:ietf:params:oauth:grant-type:jwt-bearer` as the `grant_type`. +- code `Optional[str]` + - The client-side authorization code passed to your application by Box in the browser redirect after the user has successfully granted your application permission to make API calls on their behalf. Used in combination with `authorization_code` as the `grant_type`. +- refresh_token `Optional[str]` + - A refresh token used to get a new access token with. Used in combination with `refresh_token` as the `grant_type`. +- assertion `Optional[str]` + - A JWT assertion for which to request a new access token. Used in combination with `urn:ietf:params:oauth:grant-type:jwt-bearer` as the `grant_type`. +- subject_token `Optional[str]` + - The token to exchange for a downscoped token. This can be a regular access token, a JWT assertion, or an app token. Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` as the `grant_type`. +- subject_token_type `Optional[RequestAccessTokenSubjectTokenType]` + - The type of `subject_token` passed in. Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` as the `grant_type`. +- actor_token `Optional[str]` + - The token used to create an annotator token. This is a JWT assertion. Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` as the `grant_type`. +- actor_token_type `Optional[RequestAccessTokenActorTokenType]` + - The type of `actor_token` passed in. Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` as the `grant_type`. +- scope `Optional[str]` + - The space-delimited list of scopes that you want apply to the new access token. The `subject_token` will need to have all of these scopes or the call will error with **401 Unauthorized**. +- resource `Optional[str]` + - Full URL for the file that the token should be generated for. +- box_subject_type `Optional[RequestAccessTokenBoxSubjectType]` + - Used in combination with `client_credentials` as the `grant_type`. +- box_subject_id `Optional[str]` + - Used in combination with `client_credentials` as the `grant_type`. Value is determined by `box_subject_type`. If `user` use user ID and if `enterprise` use enterprise ID. +- box_shared_link `Optional[str]` + - Full URL of the shared link on the file or folder that the token should be generated for. +- 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 `AccessToken`. + +Returns a new Access Token that can be used to make authenticated +API calls by passing along the token in a authorization header as +follows `Authorization: Bearer `. + +## Refresh access token + +Refresh an Access Token using its client ID, secret, and refresh token. + +This operation is performed by calling function `refresh_access_token`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/post-oauth-2-token-refresh/). + +_Currently we don't have an example for calling `refresh_access_token` in integration tests_ + +### Arguments + +- grant_type `RefreshAccessTokenGrantType` + - The type of request being made, in this case a refresh request. +- client_id `str` + - The client ID of the application requesting to refresh the token. +- client_secret `str` + - The client secret of the application requesting to refresh the token. +- refresh_token `str` + - The refresh token to refresh. +- 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 `AccessToken`. + +Returns a new Access Token that can be used to make authenticated +API calls by passing along the token in a authorization header as +follows `Authorization: Bearer `. + +## Revoke access token + +Revoke an active Access Token, effectively logging a user out +that has been previously authenticated. + +This operation is performed by calling function `revoke_access_token`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/post-oauth-2-revoke/). + +_Currently we don't have an example for calling `revoke_access_token` in integration tests_ + +### Arguments + +- client_id `Optional[str]` + - The Client ID of the application requesting to revoke the access token. +- client_secret `Optional[str]` + - The client secret of the application requesting to revoke an access token. +- token `Optional[str]` + - The access token to revoke. +- 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 token was successfully revoked. diff --git a/docs/chunked_uploads.md b/docs/chunked_uploads.md index f693864..69861a9 100644 --- a/docs/chunked_uploads.md +++ b/docs/chunked_uploads.md @@ -231,6 +231,10 @@ _Currently we don't have an example for calling `reducer` in integration tests_ - chunk `ByteStream` - +### Returns + +This function returns a value of type `PartAccumulator`. + ## This operation is performed by calling function `upload_big_file`. @@ -254,3 +258,7 @@ client.chunked_uploads.upload_big_file(file_byte_stream, file_name, file_size, p - The total size of the file for the chunked upload in bytes. - parent_folder_id `str` - The ID of the folder where the file should be uploaded. + +### Returns + +This function returns a value of type `FileFull`. diff --git a/docs/classifications.md b/docs/classifications.md index 79178c9..bafc08c 100644 --- a/docs/classifications.md +++ b/docs/classifications.md @@ -55,12 +55,12 @@ See the endpoint docs at ```python -client.classifications.add_classification(request_body=[AddClassificationRequestBodyArg(op=AddClassificationRequestBodyArgOpField.ADDENUMOPTION.value, field_key=AddClassificationRequestBodyArgFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, data=AddClassificationRequestBodyArgDataField(key=get_uuid(), static_config=AddClassificationRequestBodyArgDataFieldStaticConfigField(classification=AddClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField(color_id=3, classification_definition='Some description'))))]) +client.classifications.add_classification(request_body=[AddClassificationRequestBody(op=AddClassificationRequestBodyOpField.ADDENUMOPTION.value, field_key=AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, data=AddClassificationRequestBodyDataField(key=get_uuid(), static_config=AddClassificationRequestBodyDataStaticConfigField(classification=AddClassificationRequestBodyDataStaticConfigClassificationField(color_id=4, classification_definition='Other description'))))]) ``` ### Arguments -- request_body `List[AddClassificationRequestBodyArg]` +- request_body `List[AddClassificationRequestBody]` - Request body of addClassification method - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -90,12 +90,12 @@ See the endpoint docs at ```python -client.classifications.update_classification(request_body=[UpdateClassificationRequestBodyArg(op=UpdateClassificationRequestBodyArgOpField.EDITENUMOPTION.value, field_key=UpdateClassificationRequestBodyArgFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, enum_option_key=classification.key, data=UpdateClassificationRequestBodyArgDataField(key=updated_classification_name, static_config=UpdateClassificationRequestBodyArgDataFieldStaticConfigField(classification=UpdateClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField(color_id=2, classification_definition=updated_classification_description))))]) +client.classifications.update_classification(request_body=[UpdateClassificationRequestBody(op=UpdateClassificationRequestBodyOpField.EDITENUMOPTION.value, field_key=UpdateClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, enum_option_key=classification.key, data=UpdateClassificationRequestBodyDataField(key=updated_classification_name, static_config=UpdateClassificationRequestBodyDataStaticConfigField(classification=UpdateClassificationRequestBodyDataStaticConfigClassificationField(color_id=2, classification_definition=updated_classification_description))))]) ``` ### Arguments -- request_body `List[UpdateClassificationRequestBodyArg]` +- request_body `List[UpdateClassificationRequestBody]` - Request body of updateClassification method - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -127,17 +127,17 @@ _Currently we don't have an example for calling `create_classification_template` ### Arguments -- scope `CreateClassificationTemplateScopeArg` +- scope `CreateClassificationTemplateScope` - The scope in which to create the classifications. This should be `enterprise` or `enterprise_{id}` where `id` is the unique ID of the enterprise. -- template_key `CreateClassificationTemplateTemplateKeyArg` +- template_key `CreateClassificationTemplateTemplateKey` - Defines the list of metadata templates. -- display_name `CreateClassificationTemplateDisplayNameArg` +- display_name `CreateClassificationTemplateDisplayName` - The name of the template as shown in web and mobile interfaces. - hidden `Optional[bool]` - Determines if the classification template is hidden or available on web and mobile devices. - copy_instance_on_item_copy `Optional[bool]` - Determines if classifications are copied along when the file or folder is copied. -- fields `List[CreateClassificationTemplateFieldsArg]` +- fields `List[CreateClassificationTemplateFields]` - The classification template requires exactly one field, which holds all the valid classification values. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/client.md b/docs/client.md index 81dad89..6d97686 100644 --- a/docs/client.md +++ b/docs/client.md @@ -61,3 +61,16 @@ Calling the `client.with_extra_headers()` method creates a new client, leaving t ```python new_client = client.with_extra_headers(extra_headers={'customHeader': 'customValue'}) ``` + +## Custom Base URLs + +You can also specify the custom base URLs, which will be used for API calls made by client. +Calling the `client.with_custom_base_urls()` method creates a new client, leaving the original client unmodified. + +```python +new_client = client.with_custom_base_urls(base_urls=BaseUrls( + base_url='https://api.box.com/2.0', + upload_url='https://upload.box.com/api/2.0', + oauth_2_url='https://account.box.com/api/oauth2', +)) +``` diff --git a/docs/collaboration_allowlist_entries.md b/docs/collaboration_allowlist_entries.md index ebc3b27..e42ec1c 100644 --- a/docs/collaboration_allowlist_entries.md +++ b/docs/collaboration_allowlist_entries.md @@ -56,7 +56,7 @@ client.collaboration_allowlist_entries.create_collaboration_whitelist_entry(doma - domain `str` - The domain to add to the list of allowed domains. -- direction `CreateCollaborationWhitelistEntryDirectionArg` +- direction `CreateCollaborationWhitelistEntryDirection` - The direction in which to allow collaborations. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/collaboration_allowlist_exempt_targets.md b/docs/collaboration_allowlist_exempt_targets.md index 9f83c69..ce5c3e0 100644 --- a/docs/collaboration_allowlist_exempt_targets.md +++ b/docs/collaboration_allowlist_exempt_targets.md @@ -49,12 +49,12 @@ See the endpoint docs at ```python -client.collaboration_allowlist_exempt_targets.create_collaboration_whitelist_exempt_target(user=CreateCollaborationWhitelistExemptTargetUserArg(id=user.id)) +client.collaboration_allowlist_exempt_targets.create_collaboration_whitelist_exempt_target(user=CreateCollaborationWhitelistExemptTargetUser(id=user.id)) ``` ### Arguments -- user `CreateCollaborationWhitelistExemptTargetUserArg` +- user `CreateCollaborationWhitelistExemptTargetUser` - The user to exempt. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/comments.md b/docs/comments.md index a7a7552..ea6c914 100644 --- a/docs/comments.md +++ b/docs/comments.md @@ -145,7 +145,7 @@ See the endpoint docs at ```python -client.comments.create_comment(message=message, item=CreateCommentItemArg(id=new_comment.id, type=CreateCommentItemArgTypeField.COMMENT.value)) +client.comments.create_comment(message=message, item=CreateCommentItem(id=new_comment.id, type=CreateCommentItemTypeField.COMMENT.value)) ``` ### Arguments @@ -154,7 +154,7 @@ client.comments.create_comment(message=message, item=CreateCommentItemArg(id=new - 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. -- item `CreateCommentItemArg` +- item `CreateCommentItem` - The item to attach the comment to. - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. diff --git a/docs/device_pinners.md b/docs/device_pinners.md index f16d69b..6192b98 100644 --- a/docs/device_pinners.md +++ b/docs/device_pinners.md @@ -74,7 +74,7 @@ _Currently we don't have an example for calling `get_enterprise_device_pinners` - 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]` +- direction `Optional[GetEnterpriseDevicePinnersDirection]` - The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/events.md b/docs/events.md index df17333..11fb814 100644 --- a/docs/events.md +++ b/docs/events.md @@ -24,13 +24,13 @@ _Currently we don't have an example for calling `get_events` in integration test ### Arguments -- stream_type `Optional[GetEventsStreamTypeArg]` +- stream_type `Optional[GetEventsStreamType]` - 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. - 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. -- event_type `Optional[List[GetEventsEventTypeArg]]` +- event_type `Optional[List[GetEventsEventType]]` - 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]` - The lower bound date and time to return events for. This can only be used when requesting the events with a `stream_type` of `admin_logs`. For any other `stream_type` this value will be ignored. diff --git a/docs/file_classifications.md b/docs/file_classifications.md index 0773566..339925d 100644 --- a/docs/file_classifications.md +++ b/docs/file_classifications.md @@ -14,12 +14,16 @@ This API can also be called by including the enterprise ID in the URL explicitly, for example `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`. -This operation is performed by calling function `get_file_metadata_enterprise_security_classification_6_vm_vochw_u_wo`. +This operation is performed by calling function `get_classification_on_file`. 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_ + + +```python +client.file_classifications.get_classification_on_file(file_id=file.id) +``` ### Arguments @@ -46,12 +50,16 @@ This API can also be called by including the enterprise ID in the URL explicitly, for example `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`. -This operation is performed by calling function `create_file_metadata_enterprise_security_classification`. +This operation is performed by calling function `add_classification_to_file`. 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_ + + +```python +client.file_classifications.add_classification_to_file(file_id=file.id, box_security_classification_key=classification.key) +``` ### Arguments @@ -77,19 +85,23 @@ 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. -This operation is performed by calling function `update_file_metadata_enterprise_security_classification`. +This operation is performed by calling function `update_classification_on_file`. 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_ + + +```python +client.file_classifications.update_classification_on_file(file_id=file.id, request_body=[UpdateClassificationOnFileRequestBody(op=UpdateClassificationOnFileRequestBodyOpField.REPLACE.value, path=UpdateClassificationOnFileRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY.value, value=second_classification.key)]) +``` ### 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" -- request_body `List[UpdateFileMetadataEnterpriseSecurityClassificationRequestBodyArg]` - - Request body of updateFileMetadataEnterpriseSecurityClassification method +- request_body `List[UpdateClassificationOnFileRequestBody]` + - Request body of updateClassificationOnFile method - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -107,12 +119,16 @@ This API can also be called by including the enterprise ID in the URL explicitly, for example `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`. -This operation is performed by calling function `delete_file_metadata_enterprise_security_classification`. +This operation is performed by calling function `delete_classification_from_file`. 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_ + + +```python +client.file_classifications.delete_classification_from_file(file_id=file.id) +``` ### Arguments diff --git a/docs/file_metadata.md b/docs/file_metadata.md index ccea64d..41f676b 100644 --- a/docs/file_metadata.md +++ b/docs/file_metadata.md @@ -50,14 +50,14 @@ See the endpoint docs at ```python -client.file_metadata.get_file_metadata_by_id(file_id=file.id, scope=GetFileMetadataByIdScopeArg.GLOBAL.value, template_key='properties') +client.file_metadata.get_file_metadata_by_id(file_id=file.id, scope=GetFileMetadataByIdScope.GLOBAL.value, template_key='properties') ``` ### 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" -- scope `GetFileMetadataByIdScopeArg` +- scope `GetFileMetadataByIdScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" @@ -88,14 +88,14 @@ See the endpoint docs at ```python -client.file_metadata.create_file_metadata_by_id(file_id=file.id, scope=CreateFileMetadataByIdScopeArg.ENTERPRISE.value, template_key=template_key, request_body={'testName': 1}) +client.file_metadata.create_file_metadata_by_id(file_id=file.id, scope=CreateFileMetadataByIdScope.ENTERPRISE.value, template_key=template_key, request_body={'testName': 1}) ``` ### 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" -- scope `CreateFileMetadataByIdScopeArg` +- scope `CreateFileMetadataByIdScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" @@ -130,18 +130,18 @@ See the endpoint docs at ```python -client.file_metadata.update_file_metadata_by_id(file_id=file.id, scope=UpdateFileMetadataByIdScopeArg.GLOBAL.value, template_key='properties', request_body=[UpdateFileMetadataByIdRequestBodyArg(op=UpdateFileMetadataByIdRequestBodyArgOpField.REPLACE.value, path='/abc', value=new_value)]) +client.file_metadata.update_file_metadata_by_id(file_id=file.id, scope=UpdateFileMetadataByIdScope.GLOBAL.value, template_key='properties', request_body=[UpdateFileMetadataByIdRequestBody(op=UpdateFileMetadataByIdRequestBodyOpField.REPLACE.value, path='/abc', value=new_value)]) ``` ### 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" -- scope `UpdateFileMetadataByIdScopeArg` +- scope `UpdateFileMetadataByIdScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" -- request_body `List[UpdateFileMetadataByIdRequestBodyArg]` +- request_body `List[UpdateFileMetadataByIdRequestBody]` - Request body of updateFileMetadataById method - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -165,14 +165,14 @@ See the endpoint docs at ```python -client.file_metadata.delete_file_metadata_by_id(file_id=file.id, scope=DeleteFileMetadataByIdScopeArg.ENTERPRISE.value, template_key=template_key) +client.file_metadata.delete_file_metadata_by_id(file_id=file.id, scope=DeleteFileMetadataByIdScope.ENTERPRISE.value, template_key=template_key) ``` ### 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" -- scope `DeleteFileMetadataByIdScopeArg` +- scope `DeleteFileMetadataByIdScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" diff --git a/docs/file_requests.md b/docs/file_requests.md index 8b92048..ff59b88 100644 --- a/docs/file_requests.md +++ b/docs/file_requests.md @@ -57,7 +57,7 @@ client.file_requests.update_file_request_by_id(file_request_id=copied_file_reque - 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. -- status `Optional[UpdateFileRequestByIdStatusArg]` +- status `Optional[UpdateFileRequestByIdStatus]` - 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. @@ -118,20 +118,20 @@ See the endpoint docs at ```python -client.file_requests.create_file_request_copy(file_request_id=file_request_id, folder=CreateFileRequestCopyFolderArg(id=file_request.folder.id, type=CreateFileRequestCopyFolderArgTypeField.FOLDER.value)) +client.file_requests.create_file_request_copy(file_request_id=file_request_id, folder=CreateFileRequestCopyFolder(id=file_request.folder.id, type=CreateFileRequestCopyFolderTypeField.FOLDER.value)) ``` ### 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" -- folder `CreateFileRequestCopyFolderArg` +- folder `CreateFileRequestCopyFolder` - 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. - 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. -- status `Optional[CreateFileRequestCopyStatusArg]` +- status `Optional[CreateFileRequestCopyStatus]` - 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. diff --git a/docs/file_version_retentions.md b/docs/file_version_retentions.md index b59cf22..e12c44e 100644 --- a/docs/file_version_retentions.md +++ b/docs/file_version_retentions.md @@ -22,7 +22,7 @@ _Currently we don't have an example for calling `get_file_version_retentions` in - Filters results by file versions with this ID. - policy_id `Optional[str]` - Filters results by the retention policy with this ID. -- disposition_action `Optional[GetFileVersionRetentionsDispositionActionArg]` +- disposition_action `Optional[GetFileVersionRetentionsDispositionAction]` - Filters results by the retention policy with this disposition action. - disposition_before `Optional[str]` - Filters results by files that will have their disposition come into effect before this date. diff --git a/docs/file_versions.md b/docs/file_versions.md index 4834744..b30e2ed 100644 --- a/docs/file_versions.md +++ b/docs/file_versions.md @@ -174,7 +174,7 @@ See the endpoint docs at ```python -client.file_versions.promote_file_version(file_id=file.id, id=file_versions.entries[0].id, type=PromoteFileVersionTypeArg.FILE_VERSION.value) +client.file_versions.promote_file_version(file_id=file.id, id=file_versions.entries[0].id, type=PromoteFileVersionType.FILE_VERSION.value) ``` ### Arguments @@ -183,7 +183,7 @@ client.file_versions.promote_file_version(file_id=file.id, id=file_versions.entr - 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]` +- type `Optional[PromoteFileVersionType]` - The type to promote - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. diff --git a/docs/file_watermarks.md b/docs/file_watermarks.md index 9b79fc6..8436c59 100644 --- a/docs/file_watermarks.md +++ b/docs/file_watermarks.md @@ -45,14 +45,14 @@ See the endpoint docs at ```python -client.file_watermarks.update_file_watermark(file_id=file.id, watermark=UpdateFileWatermarkWatermarkArg(imprint=UpdateFileWatermarkWatermarkArgImprintField.DEFAULT.value)) +client.file_watermarks.update_file_watermark(file_id=file.id, watermark=UpdateFileWatermarkWatermark(imprint=UpdateFileWatermarkWatermarkImprintField.DEFAULT.value)) ``` ### 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" -- watermark `UpdateFileWatermarkWatermarkArg` +- watermark `UpdateFileWatermarkWatermark` - The watermark to imprint on the file - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/folder_classifications.md b/docs/folder_classifications.md index 2417544..c7278a6 100644 --- a/docs/folder_classifications.md +++ b/docs/folder_classifications.md @@ -14,12 +14,16 @@ This API can also be called by including the enterprise ID in the URL explicitly, for example `/folders/:id//enterprise_12345/securityClassification-6VMVochwUWo`. -This operation is performed by calling function `get_folder_metadata_enterprise_security_classification_6_vm_vochw_u_wo`. +This operation is performed by calling function `get_classification_on_folder`. 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_ + + +```python +client.folder_classifications.get_classification_on_folder(folder_id=folder.id) +``` ### Arguments @@ -46,12 +50,16 @@ This API can also be called by including the enterprise ID in the URL explicitly, for example `/folders/:id//enterprise_12345/securityClassification-6VMVochwUWo`. -This operation is performed by calling function `create_folder_metadata_enterprise_security_classification`. +This operation is performed by calling function `add_classification_to_folder`. 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_ + + +```python +client.folder_classifications.add_classification_to_folder(folder_id=folder.id, box_security_classification_key=classification.key) +``` ### Arguments @@ -77,19 +85,23 @@ 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. -This operation is performed by calling function `update_folder_metadata_enterprise_security_classification`. +This operation is performed by calling function `update_classification_on_folder`. 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_ + + +```python +client.folder_classifications.update_classification_on_folder(folder_id=folder.id, request_body=[UpdateClassificationOnFolderRequestBody(op=UpdateClassificationOnFolderRequestBodyOpField.REPLACE.value, path=UpdateClassificationOnFolderRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY.value, value=second_classification.key)]) +``` ### 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" -- request_body `List[UpdateFolderMetadataEnterpriseSecurityClassificationRequestBodyArg]` - - Request body of updateFolderMetadataEnterpriseSecurityClassification method +- request_body `List[UpdateClassificationOnFolderRequestBody]` + - Request body of updateClassificationOnFolder method - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -107,12 +119,16 @@ This API can also be called by including the enterprise ID in the URL explicitly, for example `/folders/:id//enterprise_12345/securityClassification-6VMVochwUWo`. -This operation is performed by calling function `delete_folder_metadata_enterprise_security_classification`. +This operation is performed by calling function `delete_classification_from_folder`. 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_ + + +```python +client.folder_classifications.delete_classification_from_folder(folder_id=folder.id) +``` ### Arguments diff --git a/docs/folder_locks.md b/docs/folder_locks.md index 854c185..c86db4d 100644 --- a/docs/folder_locks.md +++ b/docs/folder_locks.md @@ -52,14 +52,14 @@ See the endpoint docs at ```python -client.folder_locks.create_folder_lock(locked_operations=CreateFolderLockLockedOperationsArg(move=True, delete=True), folder=CreateFolderLockFolderArg(id=folder.id, type='folder')) +client.folder_locks.create_folder_lock(locked_operations=CreateFolderLockLockedOperations(move=True, delete=True), folder=CreateFolderLockFolder(id=folder.id, type='folder')) ``` ### Arguments -- locked_operations `Optional[CreateFolderLockLockedOperationsArg]` +- locked_operations `Optional[CreateFolderLockLockedOperations]` - The operations to lock for the folder. If `locked_operations` is included in the request, both `move` and `delete` must also be included and both set to `true`. -- folder `CreateFolderLockFolderArg` +- folder `CreateFolderLockFolder` - The folder to apply the lock to. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/folder_metadata.md b/docs/folder_metadata.md index 9f51edd..3d542a2 100644 --- a/docs/folder_metadata.md +++ b/docs/folder_metadata.md @@ -51,14 +51,14 @@ See the endpoint docs at ```python -client.folder_metadata.get_folder_metadata_by_id(folder_id=folder.id, scope=GetFolderMetadataByIdScopeArg.GLOBAL.value, template_key='properties') +client.folder_metadata.get_folder_metadata_by_id(folder_id=folder.id, scope=GetFolderMetadataByIdScope.GLOBAL.value, template_key='properties') ``` ### 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" -- scope `GetFolderMetadataByIdScopeArg` +- scope `GetFolderMetadataByIdScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" @@ -93,14 +93,14 @@ See the endpoint docs at ```python -client.folder_metadata.create_folder_metadata_by_id(folder_id=folder.id, scope=CreateFolderMetadataByIdScopeArg.ENTERPRISE.value, template_key=template_key, request_body=data) +client.folder_metadata.create_folder_metadata_by_id(folder_id=folder.id, scope=CreateFolderMetadataByIdScope.ENTERPRISE.value, template_key=template_key, request_body=data) ``` ### 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" -- scope `CreateFolderMetadataByIdScopeArg` +- scope `CreateFolderMetadataByIdScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" @@ -135,18 +135,18 @@ See the endpoint docs at ```python -client.folder_metadata.update_folder_metadata_by_id(folder_id=folder.id, scope=UpdateFolderMetadataByIdScopeArg.GLOBAL.value, template_key='properties', request_body=[UpdateFolderMetadataByIdRequestBodyArg(op=UpdateFolderMetadataByIdRequestBodyArgOpField.REPLACE.value, path='/abc', value=new_value)]) +client.folder_metadata.update_folder_metadata_by_id(folder_id=folder.id, scope=UpdateFolderMetadataByIdScope.GLOBAL.value, template_key='properties', request_body=[UpdateFolderMetadataByIdRequestBody(op=UpdateFolderMetadataByIdRequestBodyOpField.REPLACE.value, path='/abc', value=new_value)]) ``` ### 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" -- scope `UpdateFolderMetadataByIdScopeArg` +- scope `UpdateFolderMetadataByIdScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" -- request_body `List[UpdateFolderMetadataByIdRequestBodyArg]` +- request_body `List[UpdateFolderMetadataByIdRequestBody]` - Request body of updateFolderMetadataById method - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -170,14 +170,14 @@ See the endpoint docs at ```python -client.folder_metadata.delete_folder_metadata_by_id(folder_id=folder.id, scope=DeleteFolderMetadataByIdScopeArg.GLOBAL.value, template_key='properties') +client.folder_metadata.delete_folder_metadata_by_id(folder_id=folder.id, scope=DeleteFolderMetadataByIdScope.GLOBAL.value, template_key='properties') ``` ### 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" -- scope `DeleteFolderMetadataByIdScopeArg` +- scope `DeleteFolderMetadataByIdScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" diff --git a/docs/folder_watermarks.md b/docs/folder_watermarks.md index 9aca6f4..4bcb482 100644 --- a/docs/folder_watermarks.md +++ b/docs/folder_watermarks.md @@ -45,14 +45,14 @@ See the endpoint docs at ```python -client.folder_watermarks.update_folder_watermark(folder_id=folder.id, watermark=UpdateFolderWatermarkWatermarkArg(imprint=UpdateFolderWatermarkWatermarkArgImprintField.DEFAULT.value)) +client.folder_watermarks.update_folder_watermark(folder_id=folder.id, watermark=UpdateFolderWatermarkWatermark(imprint=UpdateFolderWatermarkWatermarkImprintField.DEFAULT.value)) ``` ### 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" -- watermark `UpdateFolderWatermarkWatermarkArg` +- watermark `UpdateFolderWatermarkWatermark` - The watermark to imprint on the folder - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/groups.md b/docs/groups.md index 576332f..0c107f3 100644 --- a/docs/groups.md +++ b/docs/groups.md @@ -68,9 +68,9 @@ client.groups.create_group(name=group_name) - 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]` +- invitability_level `Optional[CreateGroupInvitabilityLevel]` - 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]` +- member_viewability_level `Optional[CreateGroupMemberViewabilityLevel]` - 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[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. @@ -144,9 +144,9 @@ client.groups.update_group_by_id(group_id=group.id, name=updated_group_name) - 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]` +- invitability_level `Optional[UpdateGroupByIdInvitabilityLevel]` - 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]` +- member_viewability_level `Optional[UpdateGroupByIdMemberViewabilityLevel]` - 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[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. diff --git a/docs/integration_mappings.md b/docs/integration_mappings.md index ac97211..d11aa7a 100644 --- a/docs/integration_mappings.md +++ b/docs/integration_mappings.md @@ -12,12 +12,12 @@ Lists [Slack integration mappings](https://support.box.com/hc/en-us/articles/441 You need Admin or Co-Admin role to use this endpoint. -This operation is performed by calling function `get_integration_mapping_slack`. +This operation is performed by calling function `get_slack_integration_mapping`. 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_slack_integration_mapping` in integration tests_ ### Arguments @@ -25,13 +25,13 @@ _Currently we don't have an example for calling `get_integration_mapping_slack` - 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]` +- partner_item_type `Optional[GetSlackIntegrationMappingPartnerItemType]` - Mapped item type, for which the mapping should be returned - partner_item_id `Optional[str]` - ID of the mapped item, for which the mapping should be returned - box_item_id `Optional[str]` - Box item ID, for which the mappings should be returned -- box_item_type `Optional[GetIntegrationMappingSlackBoxItemTypeArg]` +- box_item_type `Optional[GetSlackIntegrationMappingBoxItemType]` - Box item type, for which the mappings should be returned - is_manually_created `Optional[bool]` - Whether the mapping has been manually created @@ -52,12 +52,12 @@ by mapping a Slack channel to a Box item. You need Admin or Co-Admin role to use this endpoint. -This operation is performed by calling function `create_integration_mapping_slack`. +This operation is performed by calling function `create_slack_integration_mapping`. 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_slack_integration_mapping` in integration tests_ ### Arguments @@ -84,12 +84,12 @@ Supports updating the Box folder ID and options. You need Admin or Co-Admin role to use this endpoint. -This operation is performed by calling function `update_integration_mapping_slack_by_id`. +This operation is performed by calling function `update_slack_integration_mapping_by_id`. 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_slack_integration_mapping_by_id` in integration tests_ ### Arguments @@ -115,12 +115,12 @@ Deletes a [Slack integration mapping](https://support.box.com/hc/en-us/articles/ You need Admin or Co-Admin role to use this endpoint. -This operation is performed by calling function `delete_integration_mapping_slack_by_id`. +This operation is performed by calling function `delete_slack_integration_mapping_by_id`. 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_slack_integration_mapping_by_id` in integration tests_ ### Arguments diff --git a/docs/invites.md b/docs/invites.md index 00aefbf..7d40e3d 100644 --- a/docs/invites.md +++ b/docs/invites.md @@ -23,14 +23,14 @@ See the endpoint docs at ```python -client.invites.create_invite(enterprise=CreateInviteEnterpriseArg(id=current_user.enterprise.id), actionable_by=CreateInviteActionableByArg(login=email)) +client.invites.create_invite(enterprise=CreateInviteEnterprise(id=current_user.enterprise.id), actionable_by=CreateInviteActionableBy(login=email)) ``` ### Arguments -- enterprise `CreateInviteEnterpriseArg` +- enterprise `CreateInviteEnterprise` - The enterprise to invite the user to -- actionable_by `CreateInviteActionableByArg` +- actionable_by `CreateInviteActionableBy` - The user to invite - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. diff --git a/docs/legal_hold_policy_assignments.md b/docs/legal_hold_policy_assignments.md index f224ec5..e4c5d86 100644 --- a/docs/legal_hold_policy_assignments.md +++ b/docs/legal_hold_policy_assignments.md @@ -22,7 +22,7 @@ _Currently we don't have an example for calling `get_legal_hold_policy_assignmen - policy_id `str` - The ID of the legal hold policy -- assign_to_type `Optional[GetLegalHoldPolicyAssignmentsAssignToTypeArg]` +- assign_to_type `Optional[GetLegalHoldPolicyAssignmentsAssignToType]` - Filters the results by the type of item the policy was applied to. - assign_to_id `Optional[str]` - Filters the results by the ID of item the policy was applied to. @@ -56,7 +56,7 @@ _Currently we don't have an example for calling `create_legal_hold_policy_assign - policy_id `str` - The ID of the policy to assign. -- assign_to `CreateLegalHoldPolicyAssignmentAssignToArg` +- assign_to `CreateLegalHoldPolicyAssignmentAssignTo` - The item to assign the policy to - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/list_collaborations.md b/docs/list_collaborations.md index c9755c2..0f535ff 100644 --- a/docs/list_collaborations.md +++ b/docs/list_collaborations.md @@ -16,7 +16,11 @@ 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_ + + +```python +client.list_collaborations.get_file_collaborations(file_id=file.id) +``` ### Arguments @@ -53,7 +57,11 @@ 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_ + + +```python +client.list_collaborations.get_folder_collaborations(folder_id=folder.id) +``` ### Arguments @@ -84,11 +92,15 @@ 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_ + + +```python +client.list_collaborations.get_collaborations(status=GetCollaborationsStatus.PENDING.value) +``` ### Arguments -- status `GetCollaborationsStatusArg` +- status `GetCollaborationsStatus` - The status of the collaborations to retrieve - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. @@ -121,7 +133,11 @@ 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_ + + +```python +client.list_collaborations.get_group_collaborations(group_id=group.id) +``` ### Arguments diff --git a/docs/memberships.md b/docs/memberships.md index e05be2b..e1058e1 100644 --- a/docs/memberships.md +++ b/docs/memberships.md @@ -90,16 +90,16 @@ See the endpoint docs at ```python -client.memberships.create_group_membership(user=CreateGroupMembershipUserArg(id=user.id), group=CreateGroupMembershipGroupArg(id=group.id)) +client.memberships.create_group_membership(user=CreateGroupMembershipUser(id=user.id), group=CreateGroupMembershipGroup(id=group.id)) ``` ### Arguments -- user `CreateGroupMembershipUserArg` +- user `CreateGroupMembershipUser` - The user to add to the group. -- group `CreateGroupMembershipGroupArg` +- group `CreateGroupMembershipGroup` - The group to add the user to. -- role `Optional[CreateGroupMembershipRoleArg]` +- role `Optional[CreateGroupMembershipRole]` - 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 disable all configurable permissions. Specifying permissions will set them accordingly, omitted permissions will be enabled by default. @@ -160,14 +160,14 @@ See the endpoint docs at ```python -client.memberships.update_group_membership_by_id(group_membership_id=group_membership.id, role=UpdateGroupMembershipByIdRoleArg.ADMIN.value) +client.memberships.update_group_membership_by_id(group_membership_id=group_membership.id, role=UpdateGroupMembershipByIdRole.ADMIN.value) ``` ### Arguments - group_membership_id `str` - The ID of the group membership. Example: "434534" -- role `Optional[UpdateGroupMembershipByIdRoleArg]` +- role `Optional[UpdateGroupMembershipByIdRole]` - 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 disable all configurable permissions. Specifying permissions will set them accordingly, omitted permissions will be enabled by default. diff --git a/docs/metadata_cascade_policies.md b/docs/metadata_cascade_policies.md index cc42593..feab766 100644 --- a/docs/metadata_cascade_policies.md +++ b/docs/metadata_cascade_policies.md @@ -59,14 +59,14 @@ See the endpoint docs at ```python -client.metadata_cascade_policies.create_metadata_cascade_policy(folder_id=folder.id, scope=CreateMetadataCascadePolicyScopeArg.ENTERPRISE.value, template_key=template_key) +client.metadata_cascade_policies.create_metadata_cascade_policy(folder_id=folder.id, scope=CreateMetadataCascadePolicyScope.ENTERPRISE.value, template_key=template_key) ``` ### Arguments - folder_id `str` - The ID of the folder to apply the policy to. This folder will need to already have an instance of the targeted metadata template applied to it. -- scope `CreateMetadataCascadePolicyScopeArg` +- scope `CreateMetadataCascadePolicyScope` - 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 @@ -143,7 +143,7 @@ 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. -This operation is performed by calling function `create_metadata_cascade_policy_apply`. +This operation is performed by calling function `apply_metadata_cascade_policy`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-cascade-policies-id-apply/). @@ -151,14 +151,14 @@ See the endpoint docs at ```python -client.metadata_cascade_policies.create_metadata_cascade_policy_apply(metadata_cascade_policy_id=cascade_policy_id, conflict_resolution=CreateMetadataCascadePolicyApplyConflictResolutionArg.OVERWRITE.value) +client.metadata_cascade_policies.apply_metadata_cascade_policy(metadata_cascade_policy_id=cascade_policy_id, conflict_resolution=ApplyMetadataCascadePolicyConflictResolution.OVERWRITE.value) ``` ### Arguments - metadata_cascade_policy_id `str` - The ID of the cascade policy to force-apply. Example: "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7" -- conflict_resolution `CreateMetadataCascadePolicyApplyConflictResolutionArg` +- conflict_resolution `ApplyMetadataCascadePolicyConflictResolution` - 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. diff --git a/docs/metadata_templates.md b/docs/metadata_templates.md index 2b9b00f..61a8cc2 100644 --- a/docs/metadata_templates.md +++ b/docs/metadata_templates.md @@ -54,12 +54,12 @@ See the endpoint docs at ```python -client.metadata_templates.get_metadata_template(scope=GetMetadataTemplateScopeArg.ENTERPRISE.value, template_key=template.template_key) +client.metadata_templates.get_metadata_template(scope=GetMetadataTemplateScope.ENTERPRISE.value, template_key=template.template_key) ``` ### Arguments -- scope `GetMetadataTemplateScopeArg` +- scope `GetMetadataTemplateScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" @@ -91,16 +91,16 @@ See the endpoint docs at ```python -client.metadata_templates.update_metadata_template(scope=UpdateMetadataTemplateScopeArg.ENTERPRISE.value, template_key=template_key, request_body=[UpdateMetadataTemplateRequestBodyArg(op=UpdateMetadataTemplateRequestBodyArgOpField.ADDFIELD.value, field_key='newfieldname', data={'type': 'string', 'displayName': 'newFieldName'})]) +client.metadata_templates.update_metadata_template(scope=UpdateMetadataTemplateScope.ENTERPRISE.value, template_key=template_key, request_body=[UpdateMetadataTemplateRequestBody(op=UpdateMetadataTemplateRequestBodyOpField.ADDFIELD.value, field_key='newfieldname', data={'type': 'string', 'displayName': 'newFieldName'})]) ``` ### Arguments -- scope `UpdateMetadataTemplateScopeArg` +- scope `UpdateMetadataTemplateScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" -- request_body `List[UpdateMetadataTemplateRequestBodyArg]` +- request_body `List[UpdateMetadataTemplateRequestBody]` - Request body of updateMetadataTemplate method - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -125,12 +125,12 @@ See the endpoint docs at ```python -client.metadata_templates.delete_metadata_template(scope=DeleteMetadataTemplateScopeArg.ENTERPRISE.value, template_key=template.template_key) +client.metadata_templates.delete_metadata_template(scope=DeleteMetadataTemplateScope.ENTERPRISE.value, template_key=template.template_key) ``` ### Arguments -- scope `DeleteMetadataTemplateScopeArg` +- scope `DeleteMetadataTemplateScope` - The scope of the metadata template Example: "global" - template_key `str` - The name of the metadata template Example: "properties" @@ -249,7 +249,7 @@ See the endpoint docs at ```python -client.metadata_templates.create_metadata_template(scope='enterprise', template_key=template_key, display_name=template_key, fields=[CreateMetadataTemplateFieldsArg(type=CreateMetadataTemplateFieldsArgTypeField.STRING.value, key='testName', display_name='testName')]) +client.metadata_templates.create_metadata_template(scope='enterprise', template_key=template_key, display_name=template_key, fields=[CreateMetadataTemplateFields(type=CreateMetadataTemplateFieldsTypeField.STRING.value, key='testName', display_name='testName')]) ``` ### Arguments @@ -262,7 +262,7 @@ client.metadata_templates.create_metadata_template(scope='enterprise', template_ - The display name of the template. - hidden `Optional[bool]` - Defines if this template is visible in the Box web app UI, or if it is purely intended for usage through the API. -- fields `Optional[List[CreateMetadataTemplateFieldsArg]]` +- fields `Optional[List[CreateMetadataTemplateFields]]` - An ordered list of template fields which are part of the template. Each field can be a regular text field, date field, number field, as well as a single or multi-select list. - copy_instance_on_item_copy `Optional[bool]` - Whether or not to copy any metadata attached to a file or folder when it is copied. By default, metadata is not copied along with a file or folder when it is copied. diff --git a/docs/retention_policies.md b/docs/retention_policies.md index fc71280..598f8a9 100644 --- a/docs/retention_policies.md +++ b/docs/retention_policies.md @@ -25,7 +25,7 @@ client.retention_policies.get_retention_policies() - policy_name `Optional[str]` - Filters results by a case sensitive prefix of the name of retention policies. -- policy_type `Optional[GetRetentionPoliciesPolicyTypeArg]` +- policy_type `Optional[GetRetentionPoliciesPolicyType]` - Filters results by the type of retention policy. - created_by_user_id `Optional[str]` - Filters results by the ID of the user who created policy. @@ -56,7 +56,7 @@ See the endpoint docs at ```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) +client.retention_policies.create_retention_policy(policy_name=retention_policy_name, description=retention_description, policy_type=CreateRetentionPolicyPolicyType.FINITE.value, disposition_action=CreateRetentionPolicyDispositionAction.REMOVE_RETENTION.value, retention_length='1', retention_type=CreateRetentionPolicyRetentionType.MODIFIABLE.value, can_owner_extend_retention=True, are_owners_notified=True) ``` ### Arguments @@ -65,13 +65,13 @@ client.retention_policies.create_retention_policy(policy_name=retention_policy_n - The name for the retention policy - description `Optional[str]` - The additional text description of the retention policy. -- policy_type `CreateRetentionPolicyPolicyTypeArg` +- policy_type `CreateRetentionPolicyPolicyType` - The type of the retention policy. A retention policy type can either be `finite`, where a specific amount of time to retain the content is known upfront, or `indefinite`, where the amount of time to retain the content is still unknown. -- disposition_action `CreateRetentionPolicyDispositionActionArg` +- disposition_action `CreateRetentionPolicyDispositionAction` - 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`. -- retention_type `Optional[CreateRetentionPolicyRetentionTypeArg]` +- retention_type `Optional[CreateRetentionPolicyRetentionType]` - 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. diff --git a/docs/retention_policy_assignments.md b/docs/retention_policy_assignments.md index d092bd2..7b5eea8 100644 --- a/docs/retention_policy_assignments.md +++ b/docs/retention_policy_assignments.md @@ -23,7 +23,7 @@ _Currently we don't have an example for calling `get_retention_policy_assignment - retention_policy_id `str` - The ID of the retention policy. Example: "982312" -- type `Optional[GetRetentionPolicyAssignmentsTypeArg]` +- type `Optional[GetRetentionPolicyAssignmentsType]` - The type of the retention policy assignment to retrieve. - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. @@ -56,9 +56,9 @@ _Currently we don't have an example for calling `create_retention_policy_assignm - policy_id `str` - The ID of the retention policy to assign -- assign_to `CreateRetentionPolicyAssignmentAssignToArg` +- assign_to `CreateRetentionPolicyAssignmentAssignTo` - The item to assign the policy to -- filter_fields `Optional[List[CreateRetentionPolicyAssignmentFilterFieldsArg]]` +- filter_fields `Optional[List[CreateRetentionPolicyAssignmentFilterFields]]` - 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. @@ -127,12 +127,12 @@ is successfully deleted. Returns a list of files under retention for a retention policy assignment. -This operation is performed by calling function `get_retention_policy_assignment_file_under_retention`. +This operation is performed by calling function `get_files_under_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_files_under_retention_policy_assignment` in integration tests_ ### Arguments @@ -157,12 +157,12 @@ specified retention policy assignment. Returns a list of file versions under retention for a retention policy assignment. -This operation is performed by calling function `get_retention_policy_assignment_file_version_under_retention`. +This operation is performed by calling function `get_file_versions_under_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_file_versions_under_retention_policy_assignment` in integration tests_ ### Arguments diff --git a/docs/search.md b/docs/search.md index 1d0a582..cff7c71 100644 --- a/docs/search.md +++ b/docs/search.md @@ -13,7 +13,7 @@ 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. -This operation is performed by calling function `create_metadata_query_execute_read`. +This operation is performed by calling function `search_by_metadata_query`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-queries-execute-read/). @@ -21,7 +21,7 @@ See the endpoint docs at ```python -client.search.create_metadata_query_execute_read(from_=search_from, query='testName >= :value', query_params={'value': '0.0'}, ancestor_folder_id='0') +client.search.search_by_metadata_query(from_=search_from, query='testName >= :value', query_params={'value': '0.0'}, ancestor_folder_id='0') ``` ### Arguments @@ -34,7 +34,7 @@ client.search.create_metadata_query_execute_read(from_=search_from, query='testN - 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]]` +- order_by `Optional[List[SearchByMetadataQueryOrderBy]]` - 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. @@ -63,12 +63,12 @@ See the endpoint docs at ```python -client.search.get_metadata_query_indices(scope=GetMetadataQueryIndicesScopeArg.ENTERPRISE.value, template_key=template_key) +client.search.get_metadata_query_indices(scope=GetMetadataQueryIndicesScope.ENTERPRISE.value, template_key=template_key) ``` ### Arguments -- scope `GetMetadataQueryIndicesScopeArg` +- scope `GetMetadataQueryIndicesScope` - The scope of the metadata template - template_key `str` - The name of the metadata template @@ -86,7 +86,7 @@ Returns a collection of metadata query indices for scope and template key. Searches for files, folders, web links, and shared files across the users content or across the entire enterprise. -This operation is performed by calling function `get_search`. +This operation is performed by calling function `search_for_content`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-search/). @@ -94,14 +94,14 @@ See the endpoint docs at ```python -client.search.get_search(query=keyword, ancestor_folder_ids=['0'], trash_content=GetSearchTrashContentArg.NON_TRASHED_ONLY.value, include_recent_shared_links=True) +client.search.search_for_content(query=keyword, ancestor_folder_ids=['0'], trash_content=SearchForContentTrashContent.NON_TRASHED_ONLY.value, include_recent_shared_links=True) ``` ### 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. -- scope `Optional[GetSearchScopeArg]` +- scope `Optional[SearchForContentScope]` - 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[List[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. @@ -117,17 +117,17 @@ client.search.get_search(query=keyword, ancestor_folder_ids=['0'], trash_content - 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[List[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. -- content_types `Optional[List[GetSearchContentTypesArg]]` +- content_types `Optional[List[SearchForContentContentTypes]]` - 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]` +- type `Optional[SearchForContentType]` - 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]` +- trash_content `Optional[SearchForContentTrashContent]` - Determines if the search should look in the trash for items. By default, this API only returns search results for items not currently in the trash (`non_trashed_only`). _ `trashed_only` - Only searches for items currently in the trash _ `non_trashed_only` - Only searches for items currently not in the trash \* `all_items` - Searches for both trashed and non-trashed items. - mdfilters `Optional[List[MetadataFilter]]` - Limits the search results to any items for which the metadata matches the provided filter. This parameter 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]` +- sort `Optional[SearchForContentSort]` - Defines the order in which search results are returned. This API defaults to returning items by relevance unless this parameter is explicitly specified. _ `relevance` (default) returns the results sorted by relevance to the query search term. The relevance is based on the occurrence of the search term in the items name, description, content, and additional properties. _ `modified_at` returns the results ordered in descending order by date at which the item was last modified. -- direction `Optional[GetSearchDirectionArg]` +- direction `Optional[SearchForContentDirection]` - 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. diff --git a/docs/session_termination.md b/docs/session_termination.md index bfca12b..5a30510 100644 --- a/docs/session_termination.md +++ b/docs/session_termination.md @@ -10,7 +10,7 @@ and creates asynchronous jobs to terminate the user's sessions. Returns the status for the POST request. -This operation is performed by calling function `create_user_terminate_session`. +This operation is performed by calling function `terminate_users_sessions`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-users-terminate-sessions/). @@ -18,7 +18,7 @@ See the endpoint docs at ```python -client.session_termination.create_user_terminate_session(user_ids=[get_env_var('USER_ID')], user_logins=[user.login]) +client.session_termination.terminate_users_sessions(user_ids=[get_env_var('USER_ID')], user_logins=[user.login]) ``` ### Arguments @@ -43,7 +43,7 @@ and creates asynchronous jobs to terminate the group's sessions. Returns the status for the POST request. -This operation is performed by calling function `create_group_terminate_session`. +This operation is performed by calling function `terminate_groups_sessions`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-groups-terminate-sessions/). @@ -51,7 +51,7 @@ See the endpoint docs at ```python -client.session_termination.create_group_terminate_session(group_ids=[group.id]) +client.session_termination.terminate_groups_sessions(group_ids=[group.id]) ``` ### Arguments diff --git a/docs/shared_links_files.md b/docs/shared_links_files.md index 5513039..748f958 100644 --- a/docs/shared_links_files.md +++ b/docs/shared_links_files.md @@ -19,7 +19,7 @@ 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. -This operation is performed by calling function `get_shared_items`. +This operation is performed by calling function `find_file_for_shared_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shared-items/). @@ -27,7 +27,7 @@ See the endpoint docs at ```python -user_client.shared_links_files.get_shared_items(boxapi=''.join(['shared_link=', file_from_api.shared_link.url, '&shared_link_password=incorrectPassword'])) +user_client.shared_links_files.find_file_for_shared_link(boxapi=''.join(['shared_link=', file_from_api.shared_link.url, '&shared_link_password=incorrectPassword'])) ``` ### Arguments @@ -52,7 +52,7 @@ the user has access to it. Gets the information for a shared link on a file. -This operation is performed by calling function `get_file_get_shared_link`. +This operation is performed by calling function `get_shared_link_for_file`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-get-shared-link/). @@ -60,7 +60,7 @@ See the endpoint docs at ```python -client.shared_links_files.get_file_get_shared_link(file_id=file_id, fields='shared_link') +client.shared_links_files.get_shared_link_for_file(file_id=file_id, fields='shared_link') ``` ### Arguments @@ -83,7 +83,7 @@ additional shared link information. Adds a shared link to a file. -This operation is performed by calling function `update_file_add_shared_link`. +This operation is performed by calling function `add_share_link_to_file`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-add-shared-link/). @@ -91,14 +91,14 @@ See the endpoint docs at ```python -client.shared_links_files.update_file_add_shared_link(file_id=file_id, shared_link=UpdateFileAddSharedLinkSharedLinkArg(access=UpdateFileAddSharedLinkSharedLinkArgAccessField.OPEN.value, password='Secret123@'), fields='shared_link') +client.shared_links_files.add_share_link_to_file(file_id=file_id, shared_link=AddShareLinkToFileSharedLink(access=AddShareLinkToFileSharedLinkAccessField.OPEN.value, password='Secret123@'), fields='shared_link') ``` ### 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" -- shared_link `Optional[UpdateFileAddSharedLinkSharedLinkArg]` +- shared_link `Optional[AddShareLinkToFileSharedLink]` - 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` - Explicitly request the `shared_link` fields to be returned for this item. @@ -116,7 +116,7 @@ link attached. Updates a shared link on a file. -This operation is performed by calling function `update_file_update_shared_link`. +This operation is performed by calling function `update_shared_link_on_file`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-update-shared-link/). @@ -124,14 +124,14 @@ See the endpoint docs at ```python -client.shared_links_files.update_file_update_shared_link(file_id=file_id, shared_link=UpdateFileUpdateSharedLinkSharedLinkArg(access=UpdateFileUpdateSharedLinkSharedLinkArgAccessField.COLLABORATORS.value), fields='shared_link') +client.shared_links_files.update_shared_link_on_file(file_id=file_id, shared_link=UpdateSharedLinkOnFileSharedLink(access=UpdateSharedLinkOnFileSharedLinkAccessField.COLLABORATORS.value), fields='shared_link') ``` ### 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" -- shared_link `Optional[UpdateFileUpdateSharedLinkSharedLinkArg]` +- shared_link `Optional[UpdateSharedLinkOnFileSharedLink]` - The settings for the shared link to update. - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. @@ -149,18 +149,18 @@ link attached. Removes a shared link from a file. -This operation is performed by calling function `update_file_remove_shared_link`. +This operation is performed by calling function `remove_shared_link_from_file`. 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 `remove_shared_link_from_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" -- shared_link `Optional[UpdateFileRemoveSharedLinkSharedLinkArg]` +- shared_link `Optional[RemoveSharedLinkFromFileSharedLink]` - By setting this value to `null`, the shared link is removed from the file. - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. diff --git a/docs/shared_links_folders.md b/docs/shared_links_folders.md index 5417d0e..51a48f0 100644 --- a/docs/shared_links_folders.md +++ b/docs/shared_links_folders.md @@ -16,7 +16,7 @@ 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. -This operation is performed by calling function `get_shared_item_folders`. +This operation is performed by calling function `find_folder_for_shared_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shared-items-folders/). @@ -24,7 +24,7 @@ See the endpoint docs at ```python -user_client.shared_links_folders.get_shared_item_folders(boxapi=''.join(['shared_link=', folder_from_api.shared_link.url, '&shared_link_password=incorrectPassword'])) +user_client.shared_links_folders.find_folder_for_shared_link(boxapi=''.join(['shared_link=', folder_from_api.shared_link.url, '&shared_link_password=incorrectPassword'])) ``` ### Arguments @@ -49,7 +49,7 @@ the user has access to it. Gets the information for a shared link on a folder. -This operation is performed by calling function `get_folder_get_shared_link`. +This operation is performed by calling function `get_shared_link_for_folder`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-get-shared-link/). @@ -57,7 +57,7 @@ See the endpoint docs at ```python -client.shared_links_folders.get_folder_get_shared_link(folder_id=folder.id, fields='shared_link') +client.shared_links_folders.get_shared_link_for_folder(folder_id=folder.id, fields='shared_link') ``` ### Arguments @@ -80,7 +80,7 @@ additional shared link information. Adds a shared link to a folder. -This operation is performed by calling function `update_folder_add_shared_link`. +This operation is performed by calling function `add_share_link_to_folder`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-folders-id-add-shared-link/). @@ -88,14 +88,14 @@ See the endpoint docs at ```python -client.shared_links_folders.update_folder_add_shared_link(folder_id=folder.id, shared_link=UpdateFolderAddSharedLinkSharedLinkArg(access=UpdateFolderAddSharedLinkSharedLinkArgAccessField.OPEN.value, password='Secret123@'), fields='shared_link') +client.shared_links_folders.add_share_link_to_folder(folder_id=folder.id, shared_link=AddShareLinkToFolderSharedLink(access=AddShareLinkToFolderSharedLinkAccessField.OPEN.value, password='Secret123@'), fields='shared_link') ``` ### 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" -- shared_link `Optional[UpdateFolderAddSharedLinkSharedLinkArg]` +- shared_link `Optional[AddShareLinkToFolderSharedLink]` - 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. @@ -113,7 +113,7 @@ link attached. Updates a shared link on a folder. -This operation is performed by calling function `update_folder_update_shared_link`. +This operation is performed by calling function `update_shared_link_on_folder`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-folders-id-update-shared-link/). @@ -121,14 +121,14 @@ See the endpoint docs at ```python -client.shared_links_folders.update_folder_update_shared_link(folder_id=folder.id, shared_link=UpdateFolderUpdateSharedLinkSharedLinkArg(access=UpdateFolderUpdateSharedLinkSharedLinkArgAccessField.COLLABORATORS.value), fields='shared_link') +client.shared_links_folders.update_shared_link_on_folder(folder_id=folder.id, shared_link=UpdateSharedLinkOnFolderSharedLink(access=UpdateSharedLinkOnFolderSharedLinkAccessField.COLLABORATORS.value), fields='shared_link') ``` ### 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" -- shared_link `Optional[UpdateFolderUpdateSharedLinkSharedLinkArg]` +- shared_link `Optional[UpdateSharedLinkOnFolderSharedLink]` - The settings for the shared link to update. - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. @@ -146,18 +146,18 @@ link attached. Removes a shared link from a folder. -This operation is performed by calling function `update_folder_remove_shared_link`. +This operation is performed by calling function `remove_shared_link_from_folder`. 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 `remove_shared_link_from_folder` 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" -- shared_link `Optional[UpdateFolderRemoveSharedLinkSharedLinkArg]` +- shared_link `Optional[RemoveSharedLinkFromFolderSharedLink]` - By setting this value to `null`, the shared link is removed from the folder. - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. diff --git a/docs/shared_links_web_links.md b/docs/shared_links_web_links.md index c2f55a0..3b604b6 100644 --- a/docs/shared_links_web_links.md +++ b/docs/shared_links_web_links.md @@ -16,7 +16,7 @@ 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. -This operation is performed by calling function `get_shared_item_web_links`. +This operation is performed by calling function `find_web_link_for_shared_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-shared-items-web-links/). @@ -24,7 +24,7 @@ See the endpoint docs at ```python -user_client.shared_links_web_links.get_shared_item_web_links(boxapi=''.join(['shared_link=', web_link_from_api.shared_link.url, '&shared_link_password=incorrectPassword'])) +user_client.shared_links_web_links.find_web_link_for_shared_link(boxapi=''.join(['shared_link=', web_link_from_api.shared_link.url, '&shared_link_password=incorrectPassword'])) ``` ### Arguments @@ -49,7 +49,7 @@ the user has access to it. Gets the information for a shared link on a web link. -This operation is performed by calling function `get_web_link_get_shared_link`. +This operation is performed by calling function `get_shared_link_for_web_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-web-links-id-get-shared-link/). @@ -57,7 +57,7 @@ See the endpoint docs at ```python -client.shared_links_web_links.get_web_link_get_shared_link(web_link_id=web_link_id, fields='shared_link') +client.shared_links_web_links.get_shared_link_for_web_link(web_link_id=web_link_id, fields='shared_link') ``` ### Arguments @@ -80,7 +80,7 @@ additional shared link information. Adds a shared link to a web link. -This operation is performed by calling function `update_web_link_add_shared_link`. +This operation is performed by calling function `add_share_link_to_web_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-web-links-id-add-shared-link/). @@ -88,14 +88,14 @@ See the endpoint docs at ```python -client.shared_links_web_links.update_web_link_add_shared_link(web_link_id=web_link_id, shared_link=UpdateWebLinkAddSharedLinkSharedLinkArg(access=UpdateWebLinkAddSharedLinkSharedLinkArgAccessField.OPEN.value, password='Secret123@'), fields='shared_link') +client.shared_links_web_links.add_share_link_to_web_link(web_link_id=web_link_id, shared_link=AddShareLinkToWebLinkSharedLink(access=AddShareLinkToWebLinkSharedLinkAccessField.OPEN.value, password='Secret123@'), fields='shared_link') ``` ### Arguments - web_link_id `str` - The ID of the web link. Example: "12345" -- shared_link `Optional[UpdateWebLinkAddSharedLinkSharedLinkArg]` +- shared_link `Optional[AddShareLinkToWebLinkSharedLink]` - 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. @@ -113,7 +113,7 @@ link attached. Updates a shared link on a web link. -This operation is performed by calling function `update_web_link_update_shared_link`. +This operation is performed by calling function `update_shared_link_on_web_link`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-web-links-id-update-shared-link/). @@ -121,14 +121,14 @@ See the endpoint docs at ```python -client.shared_links_web_links.update_web_link_update_shared_link(web_link_id=web_link_id, shared_link=UpdateWebLinkUpdateSharedLinkSharedLinkArg(access=UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField.COLLABORATORS.value), fields='shared_link') +client.shared_links_web_links.update_shared_link_on_web_link(web_link_id=web_link_id, shared_link=UpdateSharedLinkOnWebLinkSharedLink(access=UpdateSharedLinkOnWebLinkSharedLinkAccessField.COLLABORATORS.value), fields='shared_link') ``` ### Arguments - web_link_id `str` - The ID of the web link. Example: "12345" -- shared_link `Optional[UpdateWebLinkUpdateSharedLinkSharedLinkArg]` +- shared_link `Optional[UpdateSharedLinkOnWebLinkSharedLink]` - The settings for the shared link to update. - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. @@ -146,18 +146,18 @@ link attached. Removes a shared link from a web link. -This operation is performed by calling function `update_web_link_remove_shared_link`. +This operation is performed by calling function `remove_shared_link_from_web_link`. 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 `remove_shared_link_from_web_link` in integration tests_ ### Arguments - web_link_id `str` - The ID of the web link. Example: "12345" -- shared_link `Optional[UpdateWebLinkRemoveSharedLinkSharedLinkArg]` +- shared_link `Optional[RemoveSharedLinkFromWebLinkSharedLink]` - By setting this value to `null`, the shared link is removed from the web link. - fields `str` - Explicitly request the `shared_link` fields to be returned for this item. diff --git a/docs/shield_information_barrier_reports.md b/docs/shield_information_barrier_reports.md index 51315b0..904778b 100644 --- a/docs/shield_information_barrier_reports.md +++ b/docs/shield_information_barrier_reports.md @@ -13,7 +13,11 @@ 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_ + + +```python +client.shield_information_barrier_reports.get_shield_information_barrier_reports(shield_information_barrier_id=barrier_id) +``` ### Arguments @@ -41,7 +45,11 @@ 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_ + + +```python +client.shield_information_barrier_reports.create_shield_information_barrier_report(shield_information_barrier=ShieldInformationBarrierBase(id=barrier_id, type=ShieldInformationBarrierBaseTypeField.SHIELD_INFORMATION_BARRIER.value)) +``` ### Arguments @@ -65,7 +73,11 @@ 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_ + + +```python +client.shield_information_barrier_reports.get_shield_information_barrier_report_by_id(shield_information_barrier_report_id=created_report.id) +``` ### Arguments diff --git a/docs/shield_information_barrier_segment_members.md b/docs/shield_information_barrier_segment_members.md index 9014e7a..2a6a21b 100644 --- a/docs/shield_information_barrier_segment_members.md +++ b/docs/shield_information_barrier_segment_members.md @@ -110,16 +110,16 @@ See the endpoint docs at ```python -client.shield_information_barrier_segment_members.create_shield_information_barrier_segment_member(shield_information_barrier_segment=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg(id=segment.id, type=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value), user=UserBase(id=get_env_var('USER_ID'), type=UserBaseTypeField.USER.value)) +client.shield_information_barrier_segment_members.create_shield_information_barrier_segment_member(shield_information_barrier_segment=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment(id=segment.id, type=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value), user=UserBase(id=get_env_var('USER_ID'), type=UserBaseTypeField.USER.value)) ``` ### Arguments -- type `Optional[CreateShieldInformationBarrierSegmentMemberTypeArg]` +- type `Optional[CreateShieldInformationBarrierSegmentMemberType]` - -| A type of the shield barrier segment member. - shield_information_barrier `Optional[ShieldInformationBarrierBase]` - -- shield_information_barrier_segment `CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg` +- shield_information_barrier_segment `CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment` - The `type` and `id` of the requested shield information barrier segment. - user `UserBase` - User to which restriction will be applied. diff --git a/docs/shield_information_barrier_segment_restrictions.md b/docs/shield_information_barrier_segment_restrictions.md index 860395e..cc54553 100644 --- a/docs/shield_information_barrier_segment_restrictions.md +++ b/docs/shield_information_barrier_segment_restrictions.md @@ -111,18 +111,18 @@ See the endpoint docs at ```python -client.shield_information_barrier_segment_restrictions.create_shield_information_barrier_segment_restriction(type=CreateShieldInformationBarrierSegmentRestrictionTypeArg.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION.value, shield_information_barrier_segment=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg(id=segment_id, type=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value), restricted_segment=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg(id=segment_to_restrict_id, type=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value)) +client.shield_information_barrier_segment_restrictions.create_shield_information_barrier_segment_restriction(type=CreateShieldInformationBarrierSegmentRestrictionType.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION.value, shield_information_barrier_segment=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment(id=segment_id, type=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value), restricted_segment=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment(id=segment_to_restrict_id, type=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value)) ``` ### Arguments -- type `CreateShieldInformationBarrierSegmentRestrictionTypeArg` +- type `CreateShieldInformationBarrierSegmentRestrictionType` - The type of the shield barrier segment restriction for this member. - shield_information_barrier `Optional[ShieldInformationBarrierBase]` - -- shield_information_barrier_segment `CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg` +- shield_information_barrier_segment `CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment` - The `type` and `id` of the requested shield information barrier segment. -- restricted_segment `CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg` +- restricted_segment `CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment` - The `type` and `id` of the restricted shield information barrier segment. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/shield_information_barriers.md b/docs/shield_information_barriers.md index eedf07c..265f77a 100644 --- a/docs/shield_information_barriers.md +++ b/docs/shield_information_barriers.md @@ -37,7 +37,7 @@ Returns the shield information barrier object. Change status of shield information barrier with the specified ID. -This operation is performed by calling function `create_shield_information_barrier_change_status`. +This operation is performed by calling function `update_shield_information_barrier_status`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-shield-information-barriers-change-status/). @@ -45,14 +45,14 @@ See the endpoint docs at ```python -client.shield_information_barriers.create_shield_information_barrier_change_status(id=barrier_id, status=CreateShieldInformationBarrierChangeStatusStatusArg.DISABLED.value) +client.shield_information_barriers.update_shield_information_barrier_status(id=barrier_id, status=UpdateShieldInformationBarrierStatusStatus.DISABLED.value) ``` ### Arguments - id `str` - The ID of the shield information barrier. -- status `CreateShieldInformationBarrierChangeStatusStatusArg` +- status `UpdateShieldInformationBarrierStatusStatus` - The desired status for the shield information barrier. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/skills.md b/docs/skills.md index 36851c4..51fa991 100644 --- a/docs/skills.md +++ b/docs/skills.md @@ -10,7 +10,7 @@ List the Box Skills metadata cards that are attached to a file. -This operation is performed by calling function `get_file_metadata_global_box_skills_cards`. +This operation is performed by calling function `get_box_skill_cards_on_file`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-metadata-global-box-skills-cards/). @@ -18,7 +18,7 @@ See the endpoint docs at ```python -client.skills.get_file_metadata_global_box_skills_cards(file_id=file.id) +client.skills.get_box_skill_cards_on_file(file_id=file.id) ``` ### Arguments @@ -41,7 +41,7 @@ all of the metadata associated to the file. Applies one or more Box Skills metadata cards to a file. -This operation is performed by calling function `create_file_metadata_global_box_skills_card`. +This operation is performed by calling function `create_box_skill_cards_on_file`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-files-id-metadata-global-box-skills-cards/). @@ -49,7 +49,7 @@ See the endpoint docs at ```python -client.skills.create_file_metadata_global_box_skills_card(file_id=file.id, cards=[KeywordSkillCard(type=KeywordSkillCardTypeField.SKILL_CARD.value, skill_card_type=KeywordSkillCardSkillCardTypeField.KEYWORD.value, skill_card_title=KeywordSkillCardSkillCardTitleField(code='license-plates', message=title_message), skill=KeywordSkillCardSkillField(id=skill_id, type=KeywordSkillCardSkillFieldTypeField.SERVICE.value), invocation=KeywordSkillCardInvocationField(id=invocation_id, type=KeywordSkillCardInvocationFieldTypeField.SKILL_INVOCATION.value), entries=[KeywordSkillCardEntriesField(text='DN86 BOX')])]) +client.skills.create_box_skill_cards_on_file(file_id=file.id, cards=[KeywordSkillCard(type=KeywordSkillCardTypeField.SKILL_CARD.value, skill_card_type=KeywordSkillCardSkillCardTypeField.KEYWORD.value, skill_card_title=KeywordSkillCardSkillCardTitleField(code='license-plates', message=title_message), skill=KeywordSkillCardSkillField(id=skill_id, type=KeywordSkillCardSkillTypeField.SERVICE.value), invocation=KeywordSkillCardInvocationField(id=invocation_id, type=KeywordSkillCardInvocationTypeField.SKILL_INVOCATION.value), entries=[KeywordSkillCardEntriesField(text='DN86 BOX')])]) ``` ### Arguments @@ -72,7 +72,7 @@ including the data that was applied to the template. Updates one or more Box Skills metadata cards to a file. -This operation is performed by calling function `update_file_metadata_global_box_skills_card`. +This operation is performed by calling function `update_box_skill_cards_on_file`. See the endpoint docs at [API Reference](https://developer.box.com/reference/put-files-id-metadata-global-box-skills-cards/). @@ -80,15 +80,15 @@ See the endpoint docs at ```python -client.skills.update_file_metadata_global_box_skills_card(file_id=file.id, request_body=[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg(op=UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField.REPLACE.value, path='/cards/0', value=KeywordSkillCard(type=KeywordSkillCardTypeField.SKILL_CARD.value, skill_card_type=KeywordSkillCardSkillCardTypeField.KEYWORD.value, skill_card_title=KeywordSkillCardSkillCardTitleField(code='license-plates', message=updated_title_message), skill=KeywordSkillCardSkillField(id=skill_id, type=KeywordSkillCardSkillFieldTypeField.SERVICE.value), invocation=KeywordSkillCardInvocationField(id=invocation_id, type=KeywordSkillCardInvocationFieldTypeField.SKILL_INVOCATION.value), entries=[KeywordSkillCardEntriesField(text='DN86 BOX')]))]) +client.skills.update_box_skill_cards_on_file(file_id=file.id, request_body=[UpdateBoxSkillCardsOnFileRequestBody(op=UpdateBoxSkillCardsOnFileRequestBodyOpField.REPLACE.value, path='/cards/0', value=KeywordSkillCard(type=KeywordSkillCardTypeField.SKILL_CARD.value, skill_card_type=KeywordSkillCardSkillCardTypeField.KEYWORD.value, skill_card_title=KeywordSkillCardSkillCardTitleField(code='license-plates', message=updated_title_message), skill=KeywordSkillCardSkillField(id=skill_id, type=KeywordSkillCardSkillTypeField.SERVICE.value), invocation=KeywordSkillCardInvocationField(id=invocation_id, type=KeywordSkillCardInvocationTypeField.SKILL_INVOCATION.value), entries=[KeywordSkillCardEntriesField(text='DN86 BOX')]))]) ``` ### 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" -- request_body `List[UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg]` - - Request body of updateFileMetadataGlobalBoxSkillsCard method +- request_body `List[UpdateBoxSkillCardsOnFileRequestBody]` + - Request body of updateBoxSkillCardsOnFile method - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -103,7 +103,7 @@ custom template data included. Removes any Box Skills cards metadata from a file. -This operation is performed by calling function `delete_file_metadata_global_box_skills_card`. +This operation is performed by calling function `delete_box_skill_cards_from_file`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-id-metadata-global-box-skills-cards/). @@ -111,7 +111,7 @@ See the endpoint docs at ```python -client.skills.delete_file_metadata_global_box_skills_card(file_id=file.id) +client.skills.delete_box_skill_cards_from_file(file_id=file.id) ``` ### Arguments @@ -133,26 +133,26 @@ successfully deleted. An alternative method that can be used to overwrite and update all Box Skill metadata cards on a file. -This operation is performed by calling function `update_skill_invocation_by_id`. +This operation is performed by calling function `update_all_skill_cards_on_file`. 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_all_skill_cards_on_file` in integration tests_ ### Arguments - skill_id `str` - The ID of the skill to apply this metadata for. Example: "33243242" -- status `UpdateSkillInvocationByIdStatusArg` +- status `UpdateAllSkillCardsOnFileStatus` - Defines the status of this invocation. Set this to `success` when setting Skill cards. -- metadata `UpdateSkillInvocationByIdMetadataArg` +- metadata `UpdateAllSkillCardsOnFileMetadata` - The metadata to set for this skill. This is a list of Box Skills cards. These cards will overwrite any existing Box skill cards on the file. -- file `UpdateSkillInvocationByIdFileArg` +- file `UpdateAllSkillCardsOnFileFile` - The file to assign the cards to. -- file_version `Optional[UpdateSkillInvocationByIdFileVersionArg]` +- file_version `Optional[UpdateAllSkillCardsOnFileFileVersion]` - The optional file version to assign the cards to. -- usage `Optional[UpdateSkillInvocationByIdUsageArg]` +- usage `Optional[UpdateAllSkillCardsOnFileUsage]` - 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. diff --git a/docs/storage_policy_assignments.md b/docs/storage_policy_assignments.md index 6648aad..923ee43 100644 --- a/docs/storage_policy_assignments.md +++ b/docs/storage_policy_assignments.md @@ -21,7 +21,7 @@ _Currently we don't have an example for calling `get_storage_policy_assignments` - 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`. -- resolved_for_type `GetStoragePolicyAssignmentsResolvedForTypeArg` +- resolved_for_type `GetStoragePolicyAssignmentsResolvedForType` - The target type to return assignments for - resolved_for_id `str` - The ID of the user or enterprise to return assignments for @@ -48,9 +48,9 @@ _Currently we don't have an example for calling `create_storage_policy_assignmen ### Arguments -- storage_policy `CreateStoragePolicyAssignmentStoragePolicyArg` +- storage_policy `CreateStoragePolicyAssignmentStoragePolicy` - The storage policy to assign to the user or enterprise -- assigned_to `CreateStoragePolicyAssignmentAssignedToArg` +- assigned_to `CreateStoragePolicyAssignmentAssignedTo` - The user or enterprise to assign the storage policy to. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -100,7 +100,7 @@ _Currently we don't have an example for calling `update_storage_policy_assignmen - storage_policy_assignment_id `str` - The ID of the storage policy assignment. Example: "932483" -- storage_policy `UpdateStoragePolicyAssignmentByIdStoragePolicyArg` +- storage_policy `UpdateStoragePolicyAssignmentByIdStoragePolicy` - The storage policy to assign to the user or enterprise - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/task_assignments.md b/docs/task_assignments.md index 90fe9d8..a051bf1 100644 --- a/docs/task_assignments.md +++ b/docs/task_assignments.md @@ -47,9 +47,9 @@ _Currently we don't have an example for calling `create_task_assignment` in inte ### Arguments -- task `CreateTaskAssignmentTaskArg` +- task `CreateTaskAssignmentTask` - The task to assign to a user. -- assign_to `CreateTaskAssignmentAssignToArg` +- assign_to `CreateTaskAssignmentAssignTo` - The user to assign the task to. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -103,7 +103,7 @@ _Currently we don't have an example for calling `update_task_assignment_by_id` i - The ID of the task assignment. Example: "12345" - message `Optional[str]` - An optional message by the assignee that can be added to the task. -- resolution_state `Optional[UpdateTaskAssignmentByIdResolutionStateArg]` +- resolution_state `Optional[UpdateTaskAssignmentByIdResolutionState]` - 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. diff --git a/docs/tasks.md b/docs/tasks.md index 5631cbd..e0fe9ab 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -51,20 +51,20 @@ See the endpoint docs at ```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) +client.tasks.create_task(item=CreateTaskItem(type=CreateTaskItemTypeField.FILE.value, id=file.id), action=CreateTaskAction.REVIEW.value, message='test message', due_at='2035-01-01T00:00:00Z', completion_rule=CreateTaskCompletionRule.ALL_ASSIGNEES.value) ``` ### Arguments -- item `CreateTaskItemArg` +- item `CreateTaskItem` - The file to attach the task to. -- action `Optional[CreateTaskActionArg]` +- action `Optional[CreateTaskAction]` - 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]` +- completion_rule `Optional[CreateTaskCompletionRule]` - 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. @@ -123,13 +123,13 @@ 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]` +- action `Optional[UpdateTaskByIdAction]` - 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]` +- completion_rule `Optional[UpdateTaskByIdCompletionRule]` - 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. diff --git a/docs/terms_of_service_user_statuses.md b/docs/terms_of_service_user_statuses.md index f4cb6d9..8274ece 100644 --- a/docs/terms_of_service_user_statuses.md +++ b/docs/terms_of_service_user_statuses.md @@ -10,12 +10,12 @@ Retrieves an overview of users and their status for a terms of service, including Whether they have accepted the terms and when. -This operation is performed by calling function `get_term_of_service_user_statuses`. +This operation is performed by calling function `get_terms_of_service_user_statuses`. 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_terms_of_service_user_statuses` in integration tests_ ### Arguments @@ -36,18 +36,18 @@ Returns a list of terms of service statuses. Sets the status for a terms of service for a user. -This operation is performed by calling function `create_term_of_service_user_status`. +This operation is performed by calling function `create_terms_of_service_status_for_user`. 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_terms_of_service_status_for_user` in integration tests_ ### Arguments -- tos `CreateTermOfServiceUserStatusTosArg` +- tos `CreateTermsOfServiceStatusForUserTos` - The terms of service to set the status for. -- user `CreateTermOfServiceUserStatusUserArg` +- user `CreateTermsOfServiceStatusForUserUser` - The user to set the status for. - is_accepted `bool` - Whether the user has accepted the terms. @@ -64,12 +64,12 @@ Returns a terms of service status object. Updates the status for a terms of service for a user. -This operation is performed by calling function `update_term_of_service_user_status_by_id`. +This operation is performed by calling function `update_terms_of_service_status_for_user_by_id`. 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_terms_of_service_status_for_user_by_id` in integration tests_ ### Arguments diff --git a/docs/terms_of_services.md b/docs/terms_of_services.md index 56d3524..d2c84de 100644 --- a/docs/terms_of_services.md +++ b/docs/terms_of_services.md @@ -10,16 +10,16 @@ Returns the current terms of service text and settings for the enterprise. -This operation is performed by calling function `get_term_of_services`. +This operation is performed by calling function `get_terms_of_service`. 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_terms_of_service` in integration tests_ ### Arguments -- tos_type `Optional[GetTermOfServicesTosTypeArg]` +- tos_type `Optional[GetTermsOfServiceTosType]` - Limits the results to the terms of service of the given type. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -36,18 +36,18 @@ enterprise. Creates a terms of service for a given enterprise and type of user. -This operation is performed by calling function `create_term_of_service`. +This operation is performed by calling function `create_terms_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_terms_of_service` in integration tests_ ### Arguments -- status `CreateTermOfServiceStatusArg` +- status `CreateTermsOfServiceStatus` - Whether this terms of service is active. -- tos_type `Optional[CreateTermOfServiceTosTypeArg]` +- tos_type `Optional[CreateTermsOfServiceTosType]` - 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`. @@ -64,12 +64,12 @@ Returns a new task object Fetches a specific terms of service. -This operation is performed by calling function `get_term_of_service_by_id`. +This operation is performed by calling function `get_terms_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_terms_of_service_by_id` in integration tests_ ### Arguments @@ -88,18 +88,18 @@ Returns a terms of service object. Updates a specific terms of service. -This operation is performed by calling function `update_term_of_service_by_id`. +This operation is performed by calling function `update_terms_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_terms_of_service_by_id` in integration tests_ ### Arguments - terms_of_service_id `str` - The ID of the terms of service. Example: "324234" -- status `UpdateTermOfServiceByIdStatusArg` +- status `UpdateTermsOfServiceByIdStatus` - 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`. diff --git a/docs/transfer.md b/docs/transfer.md index 3474f38..b6c96b4 100644 --- a/docs/transfer.md +++ b/docs/transfer.md @@ -46,14 +46,14 @@ See the endpoint docs at ```python -client.transfer.transfer_owned_folder(user_id=new_user.id, owned_by=TransferOwnedFolderOwnedByArg(id=current_user.id), notify=False) +client.transfer.transfer_owned_folder(user_id=new_user.id, owned_by=TransferOwnedFolderOwnedBy(id=current_user.id), notify=False) ``` ### Arguments - user_id `str` - The ID of the user. Example: "12345" -- owned_by `TransferOwnedFolderOwnedByArg` +- owned_by `TransferOwnedFolderOwnedBy` - The user who the folder will be transferred to - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. diff --git a/docs/trashed_files.md b/docs/trashed_files.md index 7a1ecc2..98d5d8d 100644 --- a/docs/trashed_files.md +++ b/docs/trashed_files.md @@ -28,7 +28,7 @@ client.trashed_files.restore_file_from_trash(file_id=file.id) - 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]` +- parent `Optional[RestoreFileFromTrashParent]` - - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. @@ -55,7 +55,7 @@ To list all items that have been moved to the trash, please use the [`GET /folders/trash/items`](e://get-folders-trash-items/) API. -This operation is performed by calling function `get_file_trash`. +This operation is performed by calling function `get_trashed_file_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-files-id-trash/). @@ -63,7 +63,7 @@ See the endpoint docs at ```python -client.trashed_files.get_file_trash(file_id=file.id) +client.trashed_files.get_trashed_file_by_id(file_id=file.id) ``` ### Arguments @@ -88,7 +88,7 @@ was moved to the trash. Permanently deletes a file that is in the trash. This action cannot be undone. -This operation is performed by calling function `delete_file_trash`. +This operation is performed by calling function `delete_trashed_file_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-files-id-trash/). @@ -96,7 +96,7 @@ See the endpoint docs at ```python -client.trashed_files.delete_file_trash(file_id=file.id) +client.trashed_files.delete_trashed_file_by_id(file_id=file.id) ``` ### Arguments diff --git a/docs/trashed_folders.md b/docs/trashed_folders.md index 3ef6b84..6de958d 100644 --- a/docs/trashed_folders.md +++ b/docs/trashed_folders.md @@ -37,7 +37,7 @@ client.trashed_folders.restore_folder_from_trash(folder_id=folder.id) - 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]` +- parent `Optional[RestoreFolderFromTrashParent]` - - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. @@ -64,7 +64,7 @@ To list all items that have been moved to the trash, please use the [`GET /folders/trash/items`](e://get-folders-trash-items/) API. -This operation is performed by calling function `get_folder_trash`. +This operation is performed by calling function `get_trashed_folder_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-id-trash/). @@ -72,7 +72,7 @@ See the endpoint docs at ```python -client.trashed_folders.get_folder_trash(folder_id=folder.id) +client.trashed_folders.get_trashed_folder_by_id(folder_id=folder.id) ``` ### Arguments @@ -97,7 +97,7 @@ was moved to the trash. Permanently deletes a folder that is in the trash. This action cannot be undone. -This operation is performed by calling function `delete_folder_trash`. +This operation is performed by calling function `delete_trashed_folder_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-folders-id-trash/). @@ -105,7 +105,7 @@ See the endpoint docs at ```python -client.trashed_folders.delete_folder_trash(folder_id=folder.id) +client.trashed_folders.delete_trashed_folder_by_id(folder_id=folder.id) ``` ### Arguments diff --git a/docs/trashed_items.md b/docs/trashed_items.md index 474a95d..8140233 100644 --- a/docs/trashed_items.md +++ b/docs/trashed_items.md @@ -14,7 +14,7 @@ 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. -This operation is performed by calling function `get_folder_trash_items`. +This operation is performed by calling function `get_trashed_items`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-folders-trash-items/). @@ -22,7 +22,7 @@ See the endpoint docs at ```python -client.trashed_items.get_folder_trash_items() +client.trashed_items.get_trashed_items() ``` ### Arguments @@ -37,9 +37,9 @@ client.trashed_items.get_folder_trash_items() - 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`. -- direction `Optional[GetFolderTrashItemsDirectionArg]` +- direction `Optional[GetTrashedItemsDirection]` - The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order. -- sort `Optional[GetFolderTrashItemsSortArg]` +- sort `Optional[GetTrashedItemsSort]` - 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. diff --git a/docs/trashed_web_links.md b/docs/trashed_web_links.md index 92acfb8..e441322 100644 --- a/docs/trashed_web_links.md +++ b/docs/trashed_web_links.md @@ -28,7 +28,7 @@ client.trashed_web_links.restore_weblink_from_trash(web_link_id=weblink.id) - The ID of the web link. Example: "12345" - name `Optional[str]` - An optional new name for the web link. -- parent `Optional[RestoreWeblinkFromTrashParentArg]` +- parent `Optional[RestoreWeblinkFromTrashParent]` - - fields `Optional[List[str]]` - A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested. @@ -45,7 +45,7 @@ Returns a web link object when it has been restored. Retrieves a web link that has been moved to the trash. -This operation is performed by calling function `get_web_link_trash`. +This operation is performed by calling function `get_trashed_web_link_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-web-links-id-trash/). @@ -53,7 +53,7 @@ See the endpoint docs at ```python -client.trashed_web_links.get_web_link_trash(web_link_id=weblink.id) +client.trashed_web_links.get_trashed_web_link_by_id(web_link_id=weblink.id) ``` ### Arguments @@ -78,7 +78,7 @@ was moved to the trash. Permanently deletes a web link that is in the trash. This action cannot be undone. -This operation is performed by calling function `delete_web_link_trash`. +This operation is performed by calling function `delete_trashed_web_link_by_id`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-web-links-id-trash/). @@ -86,7 +86,7 @@ See the endpoint docs at ```python -client.trashed_web_links.delete_web_link_trash(web_link_id=weblink.id) +client.trashed_web_links.delete_trashed_web_link_by_id(web_link_id=weblink.id) ``` ### Arguments diff --git a/docs/user_collaborations.md b/docs/user_collaborations.md index 690545d..026a23e 100644 --- a/docs/user_collaborations.md +++ b/docs/user_collaborations.md @@ -49,16 +49,16 @@ See the endpoint docs at ```python -client.user_collaborations.update_collaboration_by_id(collaboration_id=collaboration_id, role=UpdateCollaborationByIdRoleArg.VIEWER.value) +client.user_collaborations.update_collaboration_by_id(collaboration_id=collaboration_id, role=UpdateCollaborationByIdRole.VIEWER.value) ``` ### Arguments - collaboration_id `str` - The ID of the collaboration Example: "1234" -- role `UpdateCollaborationByIdRoleArg` +- role `UpdateCollaborationByIdRole` - The level of access granted. -- status `Optional[UpdateCollaborationByIdStatusArg]` +- status `Optional[UpdateCollaborationByIdStatus]` - 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. @@ -130,16 +130,16 @@ See the endpoint docs at ```python -client.user_collaborations.create_collaboration(item=CreateCollaborationItemArg(type=CreateCollaborationItemArgTypeField.FOLDER.value, id=folder.id), accessible_by=CreateCollaborationAccessibleByArg(type=CreateCollaborationAccessibleByArgTypeField.USER.value, login=user_login), role=CreateCollaborationRoleArg.EDITOR.value) +client.user_collaborations.create_collaboration(item=CreateCollaborationItem(type=CreateCollaborationItemTypeField.FOLDER.value, id=folder.id), accessible_by=CreateCollaborationAccessibleBy(type=CreateCollaborationAccessibleByTypeField.USER.value, login=user_login), role=CreateCollaborationRole.EDITOR.value) ``` ### Arguments -- item `CreateCollaborationItemArg` +- item `CreateCollaborationItem` - The item to attach the comment to. -- accessible_by `CreateCollaborationAccessibleByArg` +- accessible_by `CreateCollaborationAccessibleBy` - The user or group to give access to the item. -- role `CreateCollaborationRoleArg` +- role `CreateCollaborationRole` - The level of access granted. - is_access_only `Optional[bool]` - If set to `true`, collaborators have access to shared items, but such items won't be visible in the All Files list. Additionally, collaborators won't see the the path to the root folder for the shared item. diff --git a/docs/users.md b/docs/users.md index 5aec1e9..b1748d7 100644 --- a/docs/users.md +++ b/docs/users.md @@ -31,7 +31,7 @@ client.users.get_users() - 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. -- user_type `Optional[GetUsersUserTypeArg]` +- user_type `Optional[GetUsersUserType]` - 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. @@ -79,7 +79,7 @@ client.users.create_user(name=user_name, login=user_login, is_platform_access_on - 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]` +- role `Optional[CreateUserRole]` - The user’s enterprise role - language `Optional[str]` - The language of the user, formatted in modified version of the [ISO 639-1](/guides/api-calls/language-codes) format. @@ -105,7 +105,7 @@ client.users.create_user(name=user_name, login=user_login, is_platform_access_on - Whether to exempt the user from enterprise device limits - is_exempt_from_login_verification `Optional[bool]` - Whether the user must use two-factor authentication -- status `Optional[CreateUserStatusArg]` +- status `Optional[CreateUserStatus]` - The user's account status - 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. @@ -231,7 +231,7 @@ client.users.update_user_by_id(user_id=user.id, name=updated_user_name) - 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. -- role `Optional[UpdateUserByIdRoleArg]` +- role `Optional[UpdateUserByIdRole]` - The user’s enterprise role - language `Optional[str]` - The language of the user, formatted in modified version of the [ISO 639-1](/guides/api-calls/language-codes) format. @@ -257,11 +257,11 @@ client.users.update_user_by_id(user_id=user.id, name=updated_user_name) - Whether the user must use two-factor authentication - is_password_reset_required `Optional[bool]` - Whether the user is required to reset their password -- status `Optional[UpdateUserByIdStatusArg]` +- status `Optional[UpdateUserByIdStatus]` - The user's account status - space_amount `Optional[int]` - The user’s total available space in bytes. Set this to `-1` to indicate unlimited storage. -- notification_email `Optional[UpdateUserByIdNotificationEmailArg]` +- notification_email `Optional[UpdateUserByIdNotificationEmail]` - 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. diff --git a/docs/web_links.md b/docs/web_links.md index 11ca754..1ba79b0 100644 --- a/docs/web_links.md +++ b/docs/web_links.md @@ -17,14 +17,14 @@ See the endpoint docs at ```python -client.web_links.create_web_link(url=url, parent=CreateWebLinkParentArg(id=parent.id), name=name, description=description) +client.web_links.create_web_link(url=url, parent=CreateWebLinkParent(id=parent.id), name=name, description=description) ``` ### Arguments - url `str` - The URL that this web link links to. Must start with `"http://"` or `"https://"`. -- parent `CreateWebLinkParentArg` +- parent `CreateWebLinkParent` - The parent folder to create the web link within. - name `Optional[str]` - Name of the web link. Defaults to the URL if not set. @@ -81,7 +81,7 @@ See the endpoint docs at ```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)) +client.web_links.update_web_link_by_id(web_link_id=weblink.id, name=updated_name, shared_link=UpdateWebLinkByIdSharedLink(access=shared_access, password=password)) ``` ### Arguments @@ -90,13 +90,13 @@ client.web_links.update_web_link_by_id(web_link_id=weblink.id, name=updated_name - The ID of the web link. Example: "12345" - url `Optional[str]` - The new URL that the web link links to. Must start with `"http://"` or `"https://"`. -- parent `Optional[UpdateWebLinkByIdParentArg]` +- parent `Optional[UpdateWebLinkByIdParent]` - - name `Optional[str]` - A new name for the web link. Defaults to the URL if not set. - description `Optional[str]` - A new description of the web link. -- shared_link `Optional[UpdateWebLinkByIdSharedLinkArg]` +- shared_link `Optional[UpdateWebLinkByIdSharedLink]` - The settings for the shared link to update. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/webhooks.md b/docs/webhooks.md index c89338e..8d71b55 100644 --- a/docs/webhooks.md +++ b/docs/webhooks.md @@ -53,16 +53,16 @@ See the endpoint docs at ```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]) +client.webhooks.create_webhook(target=CreateWebhookTarget(id=folder.id, type=CreateWebhookTargetTypeField.FOLDER.value), address='https://example.com/new-webhook', triggers=[CreateWebhookTriggers.FILE_UPLOADED.value]) ``` ### Arguments -- target `CreateWebhookTargetArg` +- target `CreateWebhookTarget` - The item that will trigger the webhook - address `str` - The URL that is notified by this webhook -- triggers `List[CreateWebhookTriggersArg]` +- triggers `List[CreateWebhookTriggers]` - An array of event names that this webhook is to be triggered for - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. @@ -120,11 +120,11 @@ client.webhooks.update_webhook_by_id(webhook_id=webhook.id, address='https://exa - webhook_id `str` - The ID of the webhook. Example: "3321123" -- target `Optional[UpdateWebhookByIdTargetArg]` +- target `Optional[UpdateWebhookByIdTarget]` - The item that will trigger the webhook - address `Optional[str]` - The URL that is notified by this webhook -- triggers `Optional[List[UpdateWebhookByIdTriggersArg]]` +- triggers `Optional[List[UpdateWebhookByIdTriggers]]` - An array of event names that this webhook is to be triggered for - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/workflows.md b/docs/workflows.md index ffc7ab3..3d7843b 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -44,26 +44,26 @@ 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. -This operation is performed by calling function `create_workflow_start`. +This operation is performed by calling function `start_workflow`. 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 `start_workflow` in integration tests_ ### Arguments - workflow_id `str` - The ID of the workflow. Example: "12345" -- type `Optional[CreateWorkflowStartTypeArg]` +- type `Optional[StartWorkflowType]` - The type of the parameters object -- flow `CreateWorkflowStartFlowArg` +- flow `StartWorkflowFlow` - The flow that will be triggered -- files `List[CreateWorkflowStartFilesArg]` +- files `List[StartWorkflowFiles]` - The array of files for which the workflow should start. All files must be in the workflow's configured folder. -- folder `CreateWorkflowStartFolderArg` +- folder `StartWorkflowFolder` - The folder object for which the workflow is configured. -- outcomes `Optional[List[CreateWorkflowStartOutcomesArg]]` +- outcomes `Optional[List[StartWorkflowOutcomes]]` - A list of outcomes required to be configured at start time. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request. diff --git a/docs/zip_downloads.md b/docs/zip_downloads.md index d109bba..2bf2d61 100644 --- a/docs/zip_downloads.md +++ b/docs/zip_downloads.md @@ -32,12 +32,12 @@ See the endpoint docs at ```python -client.zip_downloads.create_zip_download(items=[CreateZipDownloadItemsArg(id=file_1.id, type=DownloadZipItemsArgTypeField.FILE.value), CreateZipDownloadItemsArg(id=file_2.id, type=DownloadZipItemsArgTypeField.FILE.value), CreateZipDownloadItemsArg(id=folder_1.id, type=DownloadZipItemsArgTypeField.FOLDER.value)], download_file_name='zip') +client.zip_downloads.create_zip_download(items=[CreateZipDownloadItems(id=file_1.id, type=DownloadZipItemsTypeField.FILE.value), CreateZipDownloadItems(id=file_2.id, type=DownloadZipItemsTypeField.FILE.value), CreateZipDownloadItems(id=folder_1.id, type=DownloadZipItemsTypeField.FOLDER.value)], download_file_name='zip') ``` ### Arguments -- items `List[CreateZipDownloadItemsArg]` +- items `List[CreateZipDownloadItems]` - A list of items to add to the `zip` archive. These can be folders or files. - download_file_name `Optional[str]` - The optional name of the `zip` archive. This name will be appended by the `.zip` file extension, for example `January Financials.zip`. @@ -142,12 +142,12 @@ See the endpoint docs at ```python -client.zip_downloads.download_zip(items=[DownloadZipItemsArg(id=file_1.id, type=DownloadZipItemsArgTypeField.FILE.value), DownloadZipItemsArg(id=file_2.id, type=DownloadZipItemsArgTypeField.FILE.value), DownloadZipItemsArg(id=folder_1.id, type=DownloadZipItemsArgTypeField.FOLDER.value)], download_file_name='zip') +client.zip_downloads.download_zip(items=[DownloadZipItems(id=file_1.id, type=DownloadZipItemsTypeField.FILE.value), DownloadZipItems(id=file_2.id, type=DownloadZipItemsTypeField.FILE.value), DownloadZipItems(id=folder_1.id, type=DownloadZipItemsTypeField.FOLDER.value)], download_file_name='zip') ``` ### Arguments -- items `List[DownloadZipItemsArg]` +- items `List[DownloadZipItems]` - A list of items to add to the `zip` archive. These can be folders or files. - download_file_name `Optional[str]` - The optional name of the `zip` archive. This name will be appended by the `.zip` file extension, for example `January Financials.zip`. diff --git a/pytest.ini b/pytest.ini index 04a7b1e..a336b62 100644 --- a/pytest.ini +++ b/pytest.ini @@ -4,6 +4,6 @@ xfail_strict = True junit_suite_name = box_sdk_gen testpaths = test/ python_files=*.py -timeout=60 +timeout=90 diff --git a/test/auth.py b/test/auth.py index 6b32e67..c2a55f5 100644 --- a/test/auth.py +++ b/test/auth.py @@ -12,6 +12,8 @@ from box_sdk_gen.utils import generate_byte_buffer +from box_sdk_gen.utils import generate_byte_stream + from box_sdk_gen.utils import decode_base_64_byte_stream from box_sdk_gen.client import BoxClient @@ -51,16 +53,18 @@ def test_jwt_auth(): assert not new_user.id == user_id -def test_oauth_auth(): +def test_oauth_auth_authorizeUrl(): config: OAuthConfig = OAuthConfig( client_id='OAUTH_CLIENT_ID', client_secret='OAUTH_CLIENT_SECRET' ) auth: BoxOAuth = BoxOAuth(config=config) auth_url: str = auth.get_authorize_url() - expected_auth_url: str = ( - 'https://account.box.com/api/oauth2/authorize?client_id=OAUTH_CLIENT_ID&response_type=code' + assert ( + auth_url + == 'https://account.box.com/api/oauth2/authorize?client_id=OAUTH_CLIENT_ID&response_type=code' + or auth_url + == 'https://account.box.com/api/oauth2/authorize?response_type=code&client_id=OAUTH_CLIENT_ID' ) - assert auth_url == expected_auth_url def test_ccg_auth(): @@ -84,7 +88,7 @@ def test_ccg_auth(): assert not new_user.id == user_id -def test_developer_token_auth(): +def get_access_token() -> AccessToken: user_id: str = get_env_var('USER_ID') enterprise_id: str = get_env_var('ENTERPRISE_ID') ccg_config: CCGConfig = CCGConfig( @@ -96,6 +100,12 @@ def test_developer_token_auth(): auth: BoxCCGAuth = BoxCCGAuth(config=ccg_config) auth.as_user(user_id) token: AccessToken = auth.retrieve_token() + return token + + +def test_developer_token_auth(): + user_id: str = get_env_var('USER_ID') + token: AccessToken = get_access_token() dev_auth: BoxDeveloperTokenAuth = BoxDeveloperTokenAuth(token=token.access_token) client: BoxClient = BoxClient(auth=dev_auth) current_user: UserFull = client.users.get_user_me() diff --git a/test/classifications.py b/test/classifications.py index 3abaf15..29e98c2 100644 --- a/test/classifications.py +++ b/test/classifications.py @@ -2,140 +2,46 @@ from box_sdk_gen.client import BoxClient -from box_sdk_gen.managers.classifications import CreateClassificationTemplateScopeArg +from box_sdk_gen.schemas import ClassificationTemplateFieldsOptionsField -from box_sdk_gen.managers.classifications import ( - CreateClassificationTemplateTemplateKeyArg, -) - -from box_sdk_gen.managers.classifications import ( - CreateClassificationTemplateDisplayNameArg, -) - -from box_sdk_gen.managers.classifications import CreateClassificationTemplateFieldsArg - -from box_sdk_gen.managers.classifications import ( - CreateClassificationTemplateFieldsArgTypeField, -) - -from box_sdk_gen.managers.classifications import ( - CreateClassificationTemplateFieldsArgKeyField, -) - -from box_sdk_gen.managers.classifications import ( - CreateClassificationTemplateFieldsArgDisplayNameField, -) - -from box_sdk_gen.schemas import ClassificationTemplateFieldsFieldOptionsField - -from box_sdk_gen.managers.classifications import AddClassificationRequestBodyArg +from box_sdk_gen.managers.classifications import UpdateClassificationRequestBody -from box_sdk_gen.managers.classifications import AddClassificationRequestBodyArgOpField +from box_sdk_gen.managers.classifications import UpdateClassificationRequestBodyOpField from box_sdk_gen.managers.classifications import ( - AddClassificationRequestBodyArgFieldKeyField, + UpdateClassificationRequestBodyFieldKeyField, ) from box_sdk_gen.managers.classifications import ( - AddClassificationRequestBodyArgDataField, + UpdateClassificationRequestBodyDataField, ) from box_sdk_gen.managers.classifications import ( - AddClassificationRequestBodyArgDataFieldStaticConfigField, + UpdateClassificationRequestBodyDataStaticConfigField, ) from box_sdk_gen.managers.classifications import ( - AddClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField, -) - -from box_sdk_gen.managers.classifications import UpdateClassificationRequestBodyArg - -from box_sdk_gen.managers.classifications import ( - UpdateClassificationRequestBodyArgOpField, -) - -from box_sdk_gen.managers.classifications import ( - UpdateClassificationRequestBodyArgFieldKeyField, -) - -from box_sdk_gen.managers.classifications import ( - UpdateClassificationRequestBodyArgDataField, -) - -from box_sdk_gen.managers.classifications import ( - UpdateClassificationRequestBodyArgDataFieldStaticConfigField, -) - -from box_sdk_gen.managers.classifications import ( - UpdateClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField, + UpdateClassificationRequestBodyDataStaticConfigClassificationField, ) from box_sdk_gen.utils import get_uuid from test.commons import get_default_client -from test.commons import upload_new_file +from test.commons import get_or_create_classification_template + +from test.commons import get_or_create_classification from box_sdk_gen.schemas import ClassificationTemplate client: BoxClient = get_default_client() -def get_or_create_classification_template() -> ClassificationTemplate: - try: - return client.classifications.get_classification_template() - except Exception: - return client.classifications.create_classification_template( - scope=CreateClassificationTemplateScopeArg.ENTERPRISE.value, - template_key=CreateClassificationTemplateTemplateKeyArg.SECURITYCLASSIFICATION_6VMVOCHWUWO.value, - display_name=CreateClassificationTemplateDisplayNameArg.CLASSIFICATION.value, - fields=[ - CreateClassificationTemplateFieldsArg( - type=CreateClassificationTemplateFieldsArgTypeField.ENUM.value, - key=CreateClassificationTemplateFieldsArgKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, - display_name=CreateClassificationTemplateFieldsArgDisplayNameField.CLASSIFICATION.value, - options=[], - ) - ], - ) - - -def get_or_create_classification( - classification_template: ClassificationTemplate, -) -> ClassificationTemplateFieldsFieldOptionsField: - classifications: List[ClassificationTemplateFieldsFieldOptionsField] = ( - classification_template.fields[0].options - ) - current_number_of_classifications: int = len(classifications) - if current_number_of_classifications == 0: - classification_template_with_new_classification: ClassificationTemplate = ( - client.classifications.add_classification( - request_body=[ - AddClassificationRequestBodyArg( - op=AddClassificationRequestBodyArgOpField.ADDENUMOPTION.value, - field_key=AddClassificationRequestBodyArgFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, - data=AddClassificationRequestBodyArgDataField( - key=get_uuid(), - static_config=AddClassificationRequestBodyArgDataFieldStaticConfigField( - classification=AddClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField( - color_id=3, - classification_definition='Some description', - ) - ), - ), - ) - ] - ) - ) - return classification_template_with_new_classification.fields[0].options[0] - return classifications[current_number_of_classifications - 1] - - def testClassifications(): classification_template: ClassificationTemplate = ( get_or_create_classification_template() ) - classification: ClassificationTemplateFieldsFieldOptionsField = ( + classification: ClassificationTemplateFieldsOptionsField = ( get_or_create_classification(classification_template) ) assert not classification.key == '' @@ -148,14 +54,14 @@ def testClassifications(): classification_template_with_updated_classification: ClassificationTemplate = ( client.classifications.update_classification( request_body=[ - UpdateClassificationRequestBodyArg( - op=UpdateClassificationRequestBodyArgOpField.EDITENUMOPTION.value, - field_key=UpdateClassificationRequestBodyArgFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, + UpdateClassificationRequestBody( + op=UpdateClassificationRequestBodyOpField.EDITENUMOPTION.value, + field_key=UpdateClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, enum_option_key=classification.key, - data=UpdateClassificationRequestBodyArgDataField( + data=UpdateClassificationRequestBodyDataField( key=updated_classification_name, - static_config=UpdateClassificationRequestBodyArgDataFieldStaticConfigField( - classification=UpdateClassificationRequestBodyArgDataFieldStaticConfigFieldClassificationField( + static_config=UpdateClassificationRequestBodyDataStaticConfigField( + classification=UpdateClassificationRequestBodyDataStaticConfigClassificationField( color_id=2, classification_definition=updated_classification_description, ) @@ -165,12 +71,11 @@ def testClassifications(): ] ) ) - updated_classifications: List[ClassificationTemplateFieldsFieldOptionsField] = ( + updated_classifications: List[ClassificationTemplateFieldsOptionsField] = ( classification_template_with_updated_classification.fields[0].options ) - number_of_classifications_after_update: int = len(updated_classifications) - updated_classification: ClassificationTemplateFieldsFieldOptionsField = ( - updated_classifications[number_of_classifications_after_update - 1] + updated_classification: ClassificationTemplateFieldsOptionsField = ( + updated_classifications[0] ) assert updated_classification.key == updated_classification_name assert updated_classification.static_config.classification.color_id == 2 diff --git a/test/collaboration_allowlist_exempt_targets.py b/test/collaboration_allowlist_exempt_targets.py index 706e878..4d892f1 100644 --- a/test/collaboration_allowlist_exempt_targets.py +++ b/test/collaboration_allowlist_exempt_targets.py @@ -11,7 +11,7 @@ from box_sdk_gen.schemas import CollaborationAllowlistExemptTarget from box_sdk_gen.managers.collaboration_allowlist_exempt_targets import ( - CreateCollaborationWhitelistExemptTargetUserArg, + CreateCollaborationWhitelistExemptTargetUser, ) from box_sdk_gen.utils import get_uuid @@ -33,7 +33,7 @@ def collaborationAllowlistExemptTargets(): ) new_exempt_target: CollaborationAllowlistExemptTarget = ( client.collaboration_allowlist_exempt_targets.create_collaboration_whitelist_exempt_target( - user=CreateCollaborationWhitelistExemptTargetUserArg(id=user.id) + user=CreateCollaborationWhitelistExemptTargetUser(id=user.id) ) ) assert to_string(new_exempt_target.type) == 'collaboration_whitelist_exempt_target' diff --git a/test/collections.py b/test/collections.py index ebfb091..7c58b2c 100644 --- a/test/collections.py +++ b/test/collections.py @@ -8,9 +8,9 @@ from box_sdk_gen.schemas import FolderFull -from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.managers.folders import CreateFolderParent -from box_sdk_gen.managers.folders import UpdateFolderByIdCollectionsArg +from box_sdk_gen.managers.folders import UpdateFolderByIdCollections from box_sdk_gen.utils import get_uuid @@ -26,11 +26,11 @@ def testCollections(): collection_id=favourite_collection.id ) folder: FolderFull = client.folders.create_folder( - name=get_uuid(), parent=CreateFolderParentArg(id='0') + name=get_uuid(), parent=CreateFolderParent(id='0') ) client.folders.update_folder_by_id( folder_id=folder.id, - collections=[UpdateFolderByIdCollectionsArg(id=favourite_collection.id)], + collections=[UpdateFolderByIdCollections(id=favourite_collection.id)], ) collection_items_after_update: Items = client.collections.get_collection_items( collection_id=favourite_collection.id diff --git a/test/comments.py b/test/comments.py index 9774cd8..4618ba1 100644 --- a/test/comments.py +++ b/test/comments.py @@ -6,17 +6,17 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField from box_sdk_gen.schemas import Comments from box_sdk_gen.schemas import CommentFull -from box_sdk_gen.managers.comments import CreateCommentItemArg +from box_sdk_gen.managers.comments import CreateCommentItem -from box_sdk_gen.managers.comments import CreateCommentItemArgTypeField +from box_sdk_gen.managers.comments import CreateCommentItemTypeField from box_sdk_gen.utils import generate_byte_stream @@ -33,8 +33,8 @@ def comments(): 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) + attributes=UploadFileAttributes( + name=file_name, parent=UploadFileAttributesParentField(id=parent_id) ), file=file_byte_stream, ) @@ -44,17 +44,15 @@ def comments(): message: str = 'Hello there!' new_comment: CommentFull = client.comments.create_comment( message=message, - item=CreateCommentItemArg( - id=file_id, type=CreateCommentItemArgTypeField.FILE.value - ), + item=CreateCommentItem(id=file_id, type=CreateCommentItemTypeField.FILE.value), ) assert new_comment.message == message assert new_comment.is_reply_comment == False assert new_comment.item.id == file_id new_reply_comment: CommentFull = client.comments.create_comment( message=message, - item=CreateCommentItemArg( - id=new_comment.id, type=CreateCommentItemArgTypeField.COMMENT.value + item=CreateCommentItem( + id=new_comment.id, type=CreateCommentItemTypeField.COMMENT.value ), ) assert new_reply_comment.message == message diff --git a/test/commons.py b/test/commons.py index f6bce8d..cd7c654 100644 --- a/test/commons.py +++ b/test/commons.py @@ -1,6 +1,8 @@ +from typing import List + from box_sdk_gen.schemas import FolderFull -from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.managers.folders import CreateFolderParent from box_sdk_gen.schemas import FileFull @@ -8,9 +10,49 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes + +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField + +from box_sdk_gen.schemas import ClassificationTemplateFieldsOptionsField + +from box_sdk_gen.managers.classifications import AddClassificationRequestBody + +from box_sdk_gen.managers.classifications import AddClassificationRequestBodyOpField + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyFieldKeyField, +) + +from box_sdk_gen.managers.classifications import AddClassificationRequestBodyDataField + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyDataStaticConfigField, +) + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyDataStaticConfigClassificationField, +) + +from box_sdk_gen.managers.classifications import CreateClassificationTemplateScope + +from box_sdk_gen.managers.classifications import CreateClassificationTemplateTemplateKey + +from box_sdk_gen.managers.classifications import CreateClassificationTemplateDisplayName + +from box_sdk_gen.managers.classifications import CreateClassificationTemplateFields -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.classifications import ( + CreateClassificationTemplateFieldsTypeField, +) + +from box_sdk_gen.managers.classifications import ( + CreateClassificationTemplateFieldsKeyField, +) + +from box_sdk_gen.managers.classifications import ( + CreateClassificationTemplateFieldsDisplayNameField, +) from box_sdk_gen.schemas import ShieldInformationBarrier @@ -30,6 +72,8 @@ from box_sdk_gen.client import BoxClient +from box_sdk_gen.schemas import ClassificationTemplate + from box_sdk_gen.jwt_auth import BoxJWTAuth from box_sdk_gen.jwt_auth import JWTConfig @@ -58,7 +102,7 @@ def create_new_folder() -> FolderFull: client: BoxClient = get_default_client() new_folder_name: str = get_uuid() return client.folders.create_folder( - name=new_folder_name, parent=CreateFolderParentArg(id='0') + name=new_folder_name, parent=CreateFolderParent(id='0') ) @@ -67,14 +111,66 @@ def upload_new_file() -> FileFull: new_file_name: str = ''.join([get_uuid(), '.pdf']) file_content_stream: ByteStream = generate_byte_stream(1024 * 1024) uploaded_files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=new_file_name, parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=new_file_name, parent=UploadFileAttributesParentField(id='0') ), file=file_content_stream, ) return uploaded_files.entries[0] +def get_or_create_classification( + classification_template: ClassificationTemplate, +) -> ClassificationTemplateFieldsOptionsField: + client: BoxClient = get_default_client() + classifications: List[ClassificationTemplateFieldsOptionsField] = ( + classification_template.fields[0].options + ) + current_number_of_classifications: int = len(classifications) + if current_number_of_classifications == 0: + classification_template_with_new_classification: ClassificationTemplate = ( + client.classifications.add_classification( + request_body=[ + AddClassificationRequestBody( + op=AddClassificationRequestBodyOpField.ADDENUMOPTION.value, + field_key=AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, + data=AddClassificationRequestBodyDataField( + key=get_uuid(), + static_config=AddClassificationRequestBodyDataStaticConfigField( + classification=AddClassificationRequestBodyDataStaticConfigClassificationField( + color_id=3, + classification_definition='Some description', + ) + ), + ), + ) + ] + ) + ) + return classification_template_with_new_classification.fields[0].options[0] + return classifications[0] + + +def get_or_create_classification_template() -> ClassificationTemplate: + client: BoxClient = get_default_client() + try: + return client.classifications.get_classification_template() + except Exception: + return client.classifications.create_classification_template( + scope=CreateClassificationTemplateScope.ENTERPRISE.value, + template_key=CreateClassificationTemplateTemplateKey.SECURITYCLASSIFICATION_6VMVOCHWUWO.value, + display_name=CreateClassificationTemplateDisplayName.CLASSIFICATION.value, + fields=[ + CreateClassificationTemplateFields( + type=CreateClassificationTemplateFieldsTypeField.ENUM.value, + key=CreateClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, + display_name=CreateClassificationTemplateFieldsDisplayNameField.CLASSIFICATION.value, + options=[], + ) + ], + ) + + def get_or_create_shield_information_barrier( client: BoxClient, enterprise_id: str ) -> ShieldInformationBarrier: diff --git a/test/downloads.py b/test/downloads.py index 4f33515..1d302b0 100644 --- a/test/downloads.py +++ b/test/downloads.py @@ -6,9 +6,9 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField from box_sdk_gen.schemas import FileFull @@ -32,8 +32,8 @@ def test_download_file(): file_buffer: Buffer = generate_byte_buffer(1024 * 1024) file_content_stream: ByteStream = generate_byte_stream_from_buffer(file_buffer) uploaded_files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=new_file_name, parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=new_file_name, parent=UploadFileAttributesParentField(id='0') ), file=file_content_stream, ) diff --git a/test/file_classifications.py b/test/file_classifications.py new file mode 100644 index 0000000..93cf854 --- /dev/null +++ b/test/file_classifications.py @@ -0,0 +1,134 @@ +from typing import List + +import pytest + +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas import ClassificationTemplateFieldsOptionsField + +from box_sdk_gen.managers.classifications import AddClassificationRequestBody + +from box_sdk_gen.managers.classifications import AddClassificationRequestBodyOpField + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyFieldKeyField, +) + +from box_sdk_gen.managers.classifications import AddClassificationRequestBodyDataField + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyDataStaticConfigField, +) + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyDataStaticConfigClassificationField, +) + +from box_sdk_gen.schemas import FileFull + +from box_sdk_gen.schemas import Classification + +from box_sdk_gen.managers.file_classifications import ( + UpdateClassificationOnFileRequestBody, +) + +from box_sdk_gen.managers.file_classifications import ( + UpdateClassificationOnFileRequestBodyOpField, +) + +from box_sdk_gen.managers.file_classifications import ( + UpdateClassificationOnFileRequestBodyPathField, +) + +from box_sdk_gen.utils import get_uuid + +from test.commons import get_default_client + +from test.commons import upload_new_file + +from test.commons import get_or_create_classification_template + +from test.commons import get_or_create_classification + +from box_sdk_gen.schemas import ClassificationTemplate + +client: BoxClient = get_default_client() + + +def get_or_create_second_classification( + classification_template: ClassificationTemplate, +) -> ClassificationTemplateFieldsOptionsField: + classifications: List[ClassificationTemplateFieldsOptionsField] = ( + classification_template.fields[0].options + ) + current_number_of_classifications: int = len(classifications) + if current_number_of_classifications == 1: + classification_template_with_new_classification: ClassificationTemplate = ( + client.classifications.add_classification( + request_body=[ + AddClassificationRequestBody( + op=AddClassificationRequestBodyOpField.ADDENUMOPTION.value, + field_key=AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, + data=AddClassificationRequestBodyDataField( + key=get_uuid(), + static_config=AddClassificationRequestBodyDataStaticConfigField( + classification=AddClassificationRequestBodyDataStaticConfigClassificationField( + color_id=4, + classification_definition='Other description', + ) + ), + ), + ) + ] + ) + ) + return classification_template_with_new_classification.fields[0].options[1] + return classifications[1] + + +def testFileClassifications(): + classification_template: ClassificationTemplate = ( + get_or_create_classification_template() + ) + classification: ClassificationTemplateFieldsOptionsField = ( + get_or_create_classification(classification_template) + ) + file: FileFull = upload_new_file() + with pytest.raises(Exception): + client.file_classifications.get_classification_on_file(file_id=file.id) + created_file_classification: Classification = ( + client.file_classifications.add_classification_to_file( + file_id=file.id, box_security_classification_key=classification.key + ) + ) + assert ( + created_file_classification.box_security_classification_key + == classification.key + ) + file_classification: Classification = ( + client.file_classifications.get_classification_on_file(file_id=file.id) + ) + assert file_classification.box_security_classification_key == classification.key + second_classification: ClassificationTemplateFieldsOptionsField = ( + get_or_create_second_classification(classification_template) + ) + updated_file_classification: Classification = ( + client.file_classifications.update_classification_on_file( + file_id=file.id, + request_body=[ + UpdateClassificationOnFileRequestBody( + op=UpdateClassificationOnFileRequestBodyOpField.REPLACE.value, + path=UpdateClassificationOnFileRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY.value, + value=second_classification.key, + ) + ], + ) + ) + assert ( + updated_file_classification.box_security_classification_key + == second_classification.key + ) + client.file_classifications.delete_classification_from_file(file_id=file.id) + with pytest.raises(Exception): + client.file_classifications.get_classification_on_file(file_id=file.id) + client.files.delete_file_by_id(file_id=file.id) diff --git a/test/file_metadata.py b/test/file_metadata.py index 521fc1e..f906c0f 100644 --- a/test/file_metadata.py +++ b/test/file_metadata.py @@ -10,19 +10,17 @@ from box_sdk_gen.schemas import MetadataFull -from box_sdk_gen.managers.file_metadata import CreateFileMetadataByIdScopeArg +from box_sdk_gen.managers.file_metadata import CreateFileMetadataByIdScope -from box_sdk_gen.managers.file_metadata import GetFileMetadataByIdScopeArg +from box_sdk_gen.managers.file_metadata import GetFileMetadataByIdScope -from box_sdk_gen.managers.file_metadata import UpdateFileMetadataByIdScopeArg +from box_sdk_gen.managers.file_metadata import UpdateFileMetadataByIdScope -from box_sdk_gen.managers.file_metadata import UpdateFileMetadataByIdRequestBodyArg +from box_sdk_gen.managers.file_metadata import UpdateFileMetadataByIdRequestBody -from box_sdk_gen.managers.file_metadata import ( - UpdateFileMetadataByIdRequestBodyArgOpField, -) +from box_sdk_gen.managers.file_metadata import UpdateFileMetadataByIdRequestBodyOpField -from box_sdk_gen.managers.file_metadata import DeleteFileMetadataByIdScopeArg +from box_sdk_gen.managers.file_metadata import DeleteFileMetadataByIdScope from box_sdk_gen.utils import generate_byte_stream @@ -41,7 +39,7 @@ def testFileMetadata(): assert len(file_metadata.entries) == 0 created_metadata: MetadataFull = client.file_metadata.create_file_metadata_by_id( file_id=file.id, - scope=CreateFileMetadataByIdScopeArg.GLOBAL.value, + scope=CreateFileMetadataByIdScope.GLOBAL.value, template_key='properties', request_body={'abc': 'xyz'}, ) @@ -50,18 +48,18 @@ def testFileMetadata(): assert created_metadata.version == 0 received_metadata: MetadataFull = client.file_metadata.get_file_metadata_by_id( file_id=file.id, - scope=GetFileMetadataByIdScopeArg.GLOBAL.value, + scope=GetFileMetadataByIdScope.GLOBAL.value, template_key='properties', ) assert received_metadata.extra_data['abc'] == 'xyz' new_value: str = 'bar' updated_metadata: MetadataFull = client.file_metadata.update_file_metadata_by_id( file_id=file.id, - scope=UpdateFileMetadataByIdScopeArg.GLOBAL.value, + scope=UpdateFileMetadataByIdScope.GLOBAL.value, template_key='properties', request_body=[ - UpdateFileMetadataByIdRequestBodyArg( - op=UpdateFileMetadataByIdRequestBodyArgOpField.REPLACE.value, + UpdateFileMetadataByIdRequestBody( + op=UpdateFileMetadataByIdRequestBodyOpField.REPLACE.value, path='/abc', value=new_value, ) @@ -70,20 +68,20 @@ def testFileMetadata(): received_updated_metadata: MetadataFull = ( client.file_metadata.get_file_metadata_by_id( file_id=file.id, - scope=GetFileMetadataByIdScopeArg.GLOBAL.value, + scope=GetFileMetadataByIdScope.GLOBAL.value, template_key='properties', ) ) assert received_updated_metadata.extra_data['abc'] == new_value client.file_metadata.delete_file_metadata_by_id( file_id=file.id, - scope=DeleteFileMetadataByIdScopeArg.GLOBAL.value, + scope=DeleteFileMetadataByIdScope.GLOBAL.value, template_key='properties', ) with pytest.raises(Exception): client.file_metadata.get_file_metadata_by_id( file_id=file.id, - scope=GetFileMetadataByIdScopeArg.GLOBAL.value, + scope=GetFileMetadataByIdScope.GLOBAL.value, template_key='properties', ) client.files.delete_file_by_id(file_id=file.id) diff --git a/test/file_requests.py b/test/file_requests.py index 9e3603e..1d94b6b 100644 --- a/test/file_requests.py +++ b/test/file_requests.py @@ -6,9 +6,9 @@ from box_sdk_gen.schemas import FileRequest -from box_sdk_gen.managers.file_requests import CreateFileRequestCopyFolderArg +from box_sdk_gen.managers.file_requests import CreateFileRequestCopyFolder -from box_sdk_gen.managers.file_requests import CreateFileRequestCopyFolderArgTypeField +from box_sdk_gen.managers.file_requests import CreateFileRequestCopyFolderTypeField from box_sdk_gen.utils import get_env_var @@ -26,9 +26,9 @@ def testGetCopyUpdateDeleteFileRequest(): assert to_string(file_request.type) == 'file_request' copied_file_request: FileRequest = client.file_requests.create_file_request_copy( file_request_id=file_request_id, - folder=CreateFileRequestCopyFolderArg( + folder=CreateFileRequestCopyFolder( id=file_request.folder.id, - type=CreateFileRequestCopyFolderArgTypeField.FOLDER.value, + type=CreateFileRequestCopyFolderTypeField.FOLDER.value, ), ) assert not copied_file_request.id == file_request_id diff --git a/test/file_versions.py b/test/file_versions.py index 342cc7f..29d427d 100644 --- a/test/file_versions.py +++ b/test/file_versions.py @@ -2,19 +2,19 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField from box_sdk_gen.schemas import FileFull -from box_sdk_gen.managers.uploads import UploadFileVersionAttributesArg +from box_sdk_gen.managers.uploads import UploadFileVersionAttributes from box_sdk_gen.schemas import FileVersions from box_sdk_gen.schemas import FileVersionFull -from box_sdk_gen.managers.file_versions import PromoteFileVersionTypeArg +from box_sdk_gen.managers.file_versions import PromoteFileVersionType from box_sdk_gen.utils import get_uuid @@ -29,8 +29,8 @@ def testCreateListGetRestoreDeleteFileVersion(): old_name: str = get_uuid() new_name: str = get_uuid() files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=old_name, parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=old_name, parent=UploadFileAttributesParentField(id='0') ), file=generate_byte_stream(10), ) @@ -39,7 +39,7 @@ def testCreateListGetRestoreDeleteFileVersion(): assert file.size == 10 new_files: Files = client.uploads.upload_file_version( file_id=file.id, - attributes=UploadFileVersionAttributesArg(name=new_name), + attributes=UploadFileVersionAttributes(name=new_name), file=generate_byte_stream(20), ) new_file: FileFull = new_files.entries[0] @@ -56,7 +56,7 @@ def testCreateListGetRestoreDeleteFileVersion(): client.file_versions.promote_file_version( file_id=file.id, id=file_versions.entries[0].id, - type=PromoteFileVersionTypeArg.FILE_VERSION.value, + type=PromoteFileVersionType.FILE_VERSION.value, ) file_restored: FileFull = client.files.get_file_by_id(file_id=file.id) assert file_restored.name == old_name diff --git a/test/file_watermarks.py b/test/file_watermarks.py index 9d71d9a..163d240 100644 --- a/test/file_watermarks.py +++ b/test/file_watermarks.py @@ -4,18 +4,18 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField from box_sdk_gen.schemas import FileFull from box_sdk_gen.schemas import Watermark -from box_sdk_gen.managers.file_watermarks import UpdateFileWatermarkWatermarkArg +from box_sdk_gen.managers.file_watermarks import UpdateFileWatermarkWatermark from box_sdk_gen.managers.file_watermarks import ( - UpdateFileWatermarkWatermarkArgImprintField, + UpdateFileWatermarkWatermarkImprintField, ) from box_sdk_gen.utils import get_uuid @@ -30,16 +30,16 @@ def testCreateGetDeleteFileWatermark(): file_name: str = ''.join([get_uuid(), '.txt']) uploaded_files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=file_name, parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=file_name, parent=UploadFileAttributesParentField(id='0') ), file=generate_byte_stream(10), ) file: FileFull = uploaded_files.entries[0] created_watermark: Watermark = client.file_watermarks.update_file_watermark( file_id=file.id, - watermark=UpdateFileWatermarkWatermarkArg( - imprint=UpdateFileWatermarkWatermarkArgImprintField.DEFAULT.value + watermark=UpdateFileWatermarkWatermark( + imprint=UpdateFileWatermarkWatermarkImprintField.DEFAULT.value ), ) watermark: Watermark = client.file_watermarks.get_file_watermark(file_id=file.id) diff --git a/test/files.py b/test/files.py index 9c833d5..8126473 100644 --- a/test/files.py +++ b/test/files.py @@ -6,15 +6,15 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField -from box_sdk_gen.managers.files import GetFileThumbnailByIdExtensionArg +from box_sdk_gen.managers.files import GetFileThumbnailByIdExtension from box_sdk_gen.schemas import TrashFile -from box_sdk_gen.managers.files import CopyFileParentArg +from box_sdk_gen.managers.files import CopyFileParent from box_sdk_gen.utils import get_uuid @@ -35,8 +35,8 @@ def upload_file(file_name: str, file_stream: ByteStream) -> FileFull: uploaded_files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=file_name, parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=file_name, parent=UploadFileAttributesParentField(id='0') ), file=file_stream, ) @@ -54,7 +54,7 @@ def testGetFileThumbnail(): read_byte_stream( client.files.get_file_thumbnail_by_id( file_id=thumbnail_file.id, - extension=GetFileThumbnailByIdExtensionArg.PNG.value, + extension=GetFileThumbnailByIdExtension.PNG.value, ) ), read_byte_stream(thumbnail_content_stream), @@ -89,7 +89,7 @@ def testCreateGetAndDeleteFile(): ) 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( + trashed_file: TrashFile = client.trashed_files.get_trashed_file_by_id( file_id=uploaded_file.id ) assert file.id == trashed_file.id @@ -110,7 +110,7 @@ def testCopyFile(): file_origin: FileFull = 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') + file_id=file_origin.id, name=copied_file_name, parent=CopyFileParent(id='0') ) assert copied_file.parent.id == '0' assert copied_file.name == copied_file_name diff --git a/test/folder_classifications.py b/test/folder_classifications.py new file mode 100644 index 0000000..17fdb8f --- /dev/null +++ b/test/folder_classifications.py @@ -0,0 +1,134 @@ +from typing import List + +import pytest + +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas import ClassificationTemplateFieldsOptionsField + +from box_sdk_gen.managers.classifications import AddClassificationRequestBody + +from box_sdk_gen.managers.classifications import AddClassificationRequestBodyOpField + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyFieldKeyField, +) + +from box_sdk_gen.managers.classifications import AddClassificationRequestBodyDataField + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyDataStaticConfigField, +) + +from box_sdk_gen.managers.classifications import ( + AddClassificationRequestBodyDataStaticConfigClassificationField, +) + +from box_sdk_gen.schemas import FolderFull + +from box_sdk_gen.schemas import Classification + +from box_sdk_gen.managers.folder_classifications import ( + UpdateClassificationOnFolderRequestBody, +) + +from box_sdk_gen.managers.folder_classifications import ( + UpdateClassificationOnFolderRequestBodyOpField, +) + +from box_sdk_gen.managers.folder_classifications import ( + UpdateClassificationOnFolderRequestBodyPathField, +) + +from box_sdk_gen.utils import get_uuid + +from test.commons import get_default_client + +from test.commons import create_new_folder + +from test.commons import get_or_create_classification_template + +from test.commons import get_or_create_classification + +from box_sdk_gen.schemas import ClassificationTemplate + +client: BoxClient = get_default_client() + + +def get_or_create_second_classification( + classification_template: ClassificationTemplate, +) -> ClassificationTemplateFieldsOptionsField: + classifications: List[ClassificationTemplateFieldsOptionsField] = ( + classification_template.fields[0].options + ) + current_number_of_classifications: int = len(classifications) + if current_number_of_classifications == 1: + classification_template_with_new_classification: ClassificationTemplate = ( + client.classifications.add_classification( + request_body=[ + AddClassificationRequestBody( + op=AddClassificationRequestBodyOpField.ADDENUMOPTION.value, + field_key=AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY.value, + data=AddClassificationRequestBodyDataField( + key=get_uuid(), + static_config=AddClassificationRequestBodyDataStaticConfigField( + classification=AddClassificationRequestBodyDataStaticConfigClassificationField( + color_id=4, + classification_definition='Other description', + ) + ), + ), + ) + ] + ) + ) + return classification_template_with_new_classification.fields[0].options[1] + return classifications[1] + + +def testFolderClassifications(): + classification_template: ClassificationTemplate = ( + get_or_create_classification_template() + ) + classification: ClassificationTemplateFieldsOptionsField = ( + get_or_create_classification(classification_template) + ) + folder: FolderFull = create_new_folder() + with pytest.raises(Exception): + client.folder_classifications.get_classification_on_folder(folder_id=folder.id) + created_folder_classification: Classification = ( + client.folder_classifications.add_classification_to_folder( + folder_id=folder.id, box_security_classification_key=classification.key + ) + ) + assert ( + created_folder_classification.box_security_classification_key + == classification.key + ) + folder_classification: Classification = ( + client.folder_classifications.get_classification_on_folder(folder_id=folder.id) + ) + assert folder_classification.box_security_classification_key == classification.key + second_classification: ClassificationTemplateFieldsOptionsField = ( + get_or_create_second_classification(classification_template) + ) + updated_folder_classification: Classification = ( + client.folder_classifications.update_classification_on_folder( + folder_id=folder.id, + request_body=[ + UpdateClassificationOnFolderRequestBody( + op=UpdateClassificationOnFolderRequestBodyOpField.REPLACE.value, + path=UpdateClassificationOnFolderRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY.value, + value=second_classification.key, + ) + ], + ) + ) + assert ( + updated_folder_classification.box_security_classification_key + == second_classification.key + ) + client.folder_classifications.delete_classification_from_folder(folder_id=folder.id) + with pytest.raises(Exception): + client.folder_classifications.get_classification_on_folder(folder_id=folder.id) + client.folders.delete_folder_by_id(folder_id=folder.id) diff --git a/test/folder_locks.py b/test/folder_locks.py index 70f7314..68b167a 100644 --- a/test/folder_locks.py +++ b/test/folder_locks.py @@ -8,9 +8,9 @@ from box_sdk_gen.schemas import FolderLock -from box_sdk_gen.managers.folder_locks import CreateFolderLockLockedOperationsArg +from box_sdk_gen.managers.folder_locks import CreateFolderLockLockedOperations -from box_sdk_gen.managers.folder_locks import CreateFolderLockFolderArg +from box_sdk_gen.managers.folder_locks import CreateFolderLockFolder from box_sdk_gen.utils import get_uuid @@ -28,8 +28,8 @@ def testFolderLocks(): ) 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'), + locked_operations=CreateFolderLockLockedOperations(move=True, delete=True), + folder=CreateFolderLockFolder(id=folder.id, type='folder'), ) assert folder_lock.folder.id == folder.id assert folder_lock.locked_operations.move == True diff --git a/test/folder_metadata.py b/test/folder_metadata.py index bee7c9b..28d7ffa 100644 --- a/test/folder_metadata.py +++ b/test/folder_metadata.py @@ -10,19 +10,19 @@ from box_sdk_gen.schemas import MetadataFull -from box_sdk_gen.managers.folder_metadata import CreateFolderMetadataByIdScopeArg +from box_sdk_gen.managers.folder_metadata import CreateFolderMetadataByIdScope -from box_sdk_gen.managers.folder_metadata import GetFolderMetadataByIdScopeArg +from box_sdk_gen.managers.folder_metadata import GetFolderMetadataByIdScope -from box_sdk_gen.managers.folder_metadata import UpdateFolderMetadataByIdScopeArg +from box_sdk_gen.managers.folder_metadata import UpdateFolderMetadataByIdScope -from box_sdk_gen.managers.folder_metadata import UpdateFolderMetadataByIdRequestBodyArg +from box_sdk_gen.managers.folder_metadata import UpdateFolderMetadataByIdRequestBody from box_sdk_gen.managers.folder_metadata import ( - UpdateFolderMetadataByIdRequestBodyArgOpField, + UpdateFolderMetadataByIdRequestBodyOpField, ) -from box_sdk_gen.managers.folder_metadata import DeleteFolderMetadataByIdScopeArg +from box_sdk_gen.managers.folder_metadata import DeleteFolderMetadataByIdScope from box_sdk_gen.utils import get_uuid @@ -42,7 +42,7 @@ def testFolderMetadata(): created_metadata: MetadataFull = ( client.folder_metadata.create_folder_metadata_by_id( folder_id=folder.id, - scope=CreateFolderMetadataByIdScopeArg.GLOBAL.value, + scope=CreateFolderMetadataByIdScope.GLOBAL.value, template_key='properties', request_body={'abc': 'xyz'}, ) @@ -52,7 +52,7 @@ def testFolderMetadata(): assert created_metadata.version == 0 received_metadata: MetadataFull = client.folder_metadata.get_folder_metadata_by_id( folder_id=folder.id, - scope=GetFolderMetadataByIdScopeArg.GLOBAL.value, + scope=GetFolderMetadataByIdScope.GLOBAL.value, template_key='properties', ) assert received_metadata.extra_data['abc'] == 'xyz' @@ -60,11 +60,11 @@ def testFolderMetadata(): updated_metadata: MetadataFull = ( client.folder_metadata.update_folder_metadata_by_id( folder_id=folder.id, - scope=UpdateFolderMetadataByIdScopeArg.GLOBAL.value, + scope=UpdateFolderMetadataByIdScope.GLOBAL.value, template_key='properties', request_body=[ - UpdateFolderMetadataByIdRequestBodyArg( - op=UpdateFolderMetadataByIdRequestBodyArgOpField.REPLACE.value, + UpdateFolderMetadataByIdRequestBody( + op=UpdateFolderMetadataByIdRequestBodyOpField.REPLACE.value, path='/abc', value=new_value, ) @@ -74,20 +74,20 @@ def testFolderMetadata(): received_updated_metadata: MetadataFull = ( client.folder_metadata.get_folder_metadata_by_id( folder_id=folder.id, - scope=GetFolderMetadataByIdScopeArg.GLOBAL.value, + scope=GetFolderMetadataByIdScope.GLOBAL.value, template_key='properties', ) ) assert received_updated_metadata.extra_data['abc'] == new_value client.folder_metadata.delete_folder_metadata_by_id( folder_id=folder.id, - scope=DeleteFolderMetadataByIdScopeArg.GLOBAL.value, + scope=DeleteFolderMetadataByIdScope.GLOBAL.value, template_key='properties', ) with pytest.raises(Exception): client.folder_metadata.get_folder_metadata_by_id( folder_id=folder.id, - scope=GetFolderMetadataByIdScopeArg.GLOBAL.value, + scope=GetFolderMetadataByIdScope.GLOBAL.value, template_key='properties', ) client.folders.delete_folder_by_id(folder_id=folder.id) diff --git a/test/folder_watermarks.py b/test/folder_watermarks.py index 7195fde..932a840 100644 --- a/test/folder_watermarks.py +++ b/test/folder_watermarks.py @@ -4,14 +4,14 @@ from box_sdk_gen.schemas import FolderFull -from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.managers.folders import CreateFolderParent from box_sdk_gen.schemas import Watermark -from box_sdk_gen.managers.folder_watermarks import UpdateFolderWatermarkWatermarkArg +from box_sdk_gen.managers.folder_watermarks import UpdateFolderWatermarkWatermark from box_sdk_gen.managers.folder_watermarks import ( - UpdateFolderWatermarkWatermarkArgImprintField, + UpdateFolderWatermarkWatermarkImprintField, ) from box_sdk_gen.utils import get_uuid @@ -24,12 +24,12 @@ def testCreateGetDeleteFolderWatermark(): folder_name: str = get_uuid() folder: FolderFull = client.folders.create_folder( - name=folder_name, parent=CreateFolderParentArg(id='0') + name=folder_name, parent=CreateFolderParent(id='0') ) created_watermark: Watermark = client.folder_watermarks.update_folder_watermark( folder_id=folder.id, - watermark=UpdateFolderWatermarkWatermarkArg( - imprint=UpdateFolderWatermarkWatermarkArgImprintField.DEFAULT.value + watermark=UpdateFolderWatermarkWatermark( + imprint=UpdateFolderWatermarkWatermarkImprintField.DEFAULT.value ), ) watermark: Watermark = client.folder_watermarks.get_folder_watermark( diff --git a/test/folders.py b/test/folders.py index 363cfc5..151472b 100644 --- a/test/folders.py +++ b/test/folders.py @@ -4,11 +4,11 @@ from box_sdk_gen.schemas import FolderFull -from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.managers.folders import CreateFolderParent -from box_sdk_gen.managers.folders import CopyFolderParentArg +from box_sdk_gen.managers.folders import CopyFolderParent -from box_sdk_gen.managers.folders import UpdateFolderByIdParentArg +from box_sdk_gen.managers.folders import UpdateFolderByIdParent from box_sdk_gen.schemas import Items @@ -38,7 +38,7 @@ def test_get_folder_full_info_with_extra_fields(): 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') + name=new_folder_name, parent=CreateFolderParent(id='0') ) created_folder: FolderFull = client.folders.get_folder_by_id( folder_id=new_folder.id @@ -52,7 +52,7 @@ def test_create_and_delete_folder(): 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') + name=folder_to_update_name, parent=CreateFolderParent(id='0') ) updated_name: str = get_uuid() updated_folder: FolderFull = client.folders.update_folder_by_id( @@ -68,20 +68,20 @@ def test_update_folder(): 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') + name=folder_origin_name, parent=CreateFolderParent(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'), + parent=CopyFolderParent(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), + parent=UpdateFolderByIdParent(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) diff --git a/test/invites.py b/test/invites.py index 52edc00..996735d 100644 --- a/test/invites.py +++ b/test/invites.py @@ -6,9 +6,9 @@ from box_sdk_gen.schemas import Invite -from box_sdk_gen.managers.invites import CreateInviteEnterpriseArg +from box_sdk_gen.managers.invites import CreateInviteEnterprise -from box_sdk_gen.managers.invites import CreateInviteActionableByArg +from box_sdk_gen.managers.invites import CreateInviteActionableBy from box_sdk_gen.utils import get_uuid @@ -23,8 +23,8 @@ def testInvites(): current_user: UserFull = client.users.get_user_me(fields=['enterprise']) email: str = get_env_var('BOX_EXTERNAL_USER_EMAIL') invitation: Invite = client.invites.create_invite( - enterprise=CreateInviteEnterpriseArg(id=current_user.enterprise.id), - actionable_by=CreateInviteActionableByArg(login=email), + enterprise=CreateInviteEnterprise(id=current_user.enterprise.id), + actionable_by=CreateInviteActionableBy(login=email), ) assert to_string(invitation.type) == 'invite' assert invitation.invited_to.id == current_user.enterprise.id diff --git a/test/list_collaborations.py b/test/list_collaborations.py new file mode 100644 index 0000000..b35feb9 --- /dev/null +++ b/test/list_collaborations.py @@ -0,0 +1,91 @@ +from box_sdk_gen.utils import to_string + +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas import FolderFull + +from box_sdk_gen.schemas import FileFull + +from box_sdk_gen.schemas import GroupFull + +from box_sdk_gen.schemas import Collaboration + +from box_sdk_gen.managers.user_collaborations import CreateCollaborationItem + +from box_sdk_gen.managers.user_collaborations import CreateCollaborationItemTypeField + +from box_sdk_gen.managers.user_collaborations import CreateCollaborationAccessibleBy + +from box_sdk_gen.managers.user_collaborations import ( + CreateCollaborationAccessibleByTypeField, +) + +from box_sdk_gen.managers.user_collaborations import CreateCollaborationRole + +from box_sdk_gen.schemas import Collaborations + +from box_sdk_gen.managers.list_collaborations import GetCollaborationsStatus + +from box_sdk_gen.utils import get_uuid + +from box_sdk_gen.utils import get_env_var + +from test.commons import get_default_client + +from test.commons import create_new_folder + +from test.commons import upload_new_file + + +def testListCollaborations(): + client: BoxClient = get_default_client() + folder: FolderFull = create_new_folder() + file: FileFull = upload_new_file() + group: GroupFull = client.groups.create_group(name=get_uuid()) + group_collaboration: Collaboration = ( + client.user_collaborations.create_collaboration( + item=CreateCollaborationItem( + type=CreateCollaborationItemTypeField.FOLDER.value, id=folder.id + ), + accessible_by=CreateCollaborationAccessibleBy( + type=CreateCollaborationAccessibleByTypeField.GROUP.value, id=group.id + ), + role=CreateCollaborationRole.EDITOR.value, + ) + ) + file_collaboration: Collaboration = client.user_collaborations.create_collaboration( + item=CreateCollaborationItem( + type=CreateCollaborationItemTypeField.FILE.value, id=file.id + ), + accessible_by=CreateCollaborationAccessibleBy( + type=CreateCollaborationAccessibleByTypeField.USER.value, + id=get_env_var('USER_ID'), + ), + role=CreateCollaborationRole.EDITOR.value, + ) + assert to_string(group_collaboration.role) == 'editor' + assert to_string(group_collaboration.type) == 'collaboration' + file_collaborations: Collaborations = ( + client.list_collaborations.get_file_collaborations(file_id=file.id) + ) + assert len(file_collaborations.entries) > 0 + folder_collaborations: Collaborations = ( + client.list_collaborations.get_folder_collaborations(folder_id=folder.id) + ) + assert len(folder_collaborations.entries) > 0 + pending_collaborations: Collaborations = ( + client.list_collaborations.get_collaborations( + status=GetCollaborationsStatus.PENDING.value + ) + ) + assert len(pending_collaborations.entries) >= 0 + group_collaborations: Collaborations = ( + client.list_collaborations.get_group_collaborations(group_id=group.id) + ) + assert len(group_collaborations.entries) > 0 + client.user_collaborations.delete_collaboration_by_id( + collaboration_id=group_collaboration.id + ) + client.files.delete_file_by_id(file_id=file.id) + client.folders.delete_folder_by_id(folder_id=folder.id) + client.groups.delete_group_by_id(group_id=group.id) diff --git a/test/memberships.py b/test/memberships.py index 0dac1fb..cf4cfa1 100644 --- a/test/memberships.py +++ b/test/memberships.py @@ -12,11 +12,11 @@ from box_sdk_gen.schemas import GroupMembership -from box_sdk_gen.managers.memberships import CreateGroupMembershipUserArg +from box_sdk_gen.managers.memberships import CreateGroupMembershipUser -from box_sdk_gen.managers.memberships import CreateGroupMembershipGroupArg +from box_sdk_gen.managers.memberships import CreateGroupMembershipGroup -from box_sdk_gen.managers.memberships import UpdateGroupMembershipByIdRoleArg +from box_sdk_gen.managers.memberships import UpdateGroupMembershipByIdRole from box_sdk_gen.utils import get_uuid @@ -39,8 +39,8 @@ def testMemberships(): ) assert group_memberships.total_count == 0 group_membership: GroupMembership = client.memberships.create_group_membership( - user=CreateGroupMembershipUserArg(id=user.id), - group=CreateGroupMembershipGroupArg(id=group.id), + user=CreateGroupMembershipUser(id=user.id), + group=CreateGroupMembershipGroup(id=group.id), ) assert group_membership.user.id == user.id assert group_membership.group.id == group.id @@ -54,7 +54,7 @@ def testMemberships(): updated_group_membership: GroupMembership = ( client.memberships.update_group_membership_by_id( group_membership_id=group_membership.id, - role=UpdateGroupMembershipByIdRoleArg.ADMIN.value, + role=UpdateGroupMembershipByIdRole.ADMIN.value, ) ) assert updated_group_membership.id == group_membership.id diff --git a/test/metadata_cascade_policies.py b/test/metadata_cascade_policies.py index 6d64896..c219998 100644 --- a/test/metadata_cascade_policies.py +++ b/test/metadata_cascade_policies.py @@ -6,10 +6,10 @@ from box_sdk_gen.client import BoxClient -from box_sdk_gen.managers.metadata_templates import CreateMetadataTemplateFieldsArg +from box_sdk_gen.managers.metadata_templates import CreateMetadataTemplateFields from box_sdk_gen.managers.metadata_templates import ( - CreateMetadataTemplateFieldsArgTypeField, + CreateMetadataTemplateFieldsTypeField, ) from box_sdk_gen.schemas import FolderFull @@ -17,16 +17,16 @@ from box_sdk_gen.schemas import MetadataCascadePolicy from box_sdk_gen.managers.metadata_cascade_policies import ( - CreateMetadataCascadePolicyScopeArg, + CreateMetadataCascadePolicyScope, ) from box_sdk_gen.schemas import MetadataCascadePolicies from box_sdk_gen.managers.metadata_cascade_policies import ( - CreateMetadataCascadePolicyApplyConflictResolutionArg, + ApplyMetadataCascadePolicyConflictResolution, ) -from box_sdk_gen.managers.folder_metadata import CreateFolderMetadataByIdScopeArg +from box_sdk_gen.managers.folder_metadata import CreateFolderMetadataByIdScope from box_sdk_gen.utils import get_uuid @@ -50,8 +50,8 @@ def testMetadataCascadePolicies(): template_key=template_key, display_name=template_key, fields=[ - CreateMetadataTemplateFieldsArg( - type=CreateMetadataTemplateFieldsArgTypeField.STRING.value, + CreateMetadataTemplateFields( + type=CreateMetadataTemplateFieldsTypeField.STRING.value, key='testName', display_name='testName', ) @@ -62,7 +62,7 @@ def testMetadataCascadePolicies(): cascade_policy: MetadataCascadePolicy = ( client.metadata_cascade_policies.create_metadata_cascade_policy( folder_id=folder.id, - scope=CreateMetadataCascadePolicyScopeArg.ENTERPRISE.value, + scope=CreateMetadataCascadePolicyScope.ENTERPRISE.value, template_key=template_key, ) ) @@ -87,20 +87,20 @@ def testMetadataCascadePolicies(): ) assert len(policies.entries) == 1 with pytest.raises(Exception): - client.metadata_cascade_policies.create_metadata_cascade_policy_apply( + client.metadata_cascade_policies.apply_metadata_cascade_policy( metadata_cascade_policy_id=cascade_policy_id, - conflict_resolution=CreateMetadataCascadePolicyApplyConflictResolutionArg.OVERWRITE.value, + conflict_resolution=ApplyMetadataCascadePolicyConflictResolution.OVERWRITE.value, ) data: Dict[str, str] = {'testName': 'xyz'} client.folder_metadata.create_folder_metadata_by_id( folder_id=folder.id, - scope=CreateFolderMetadataByIdScopeArg.ENTERPRISE.value, + scope=CreateFolderMetadataByIdScope.ENTERPRISE.value, template_key=template_key, request_body=data, ) - client.metadata_cascade_policies.create_metadata_cascade_policy_apply( + client.metadata_cascade_policies.apply_metadata_cascade_policy( metadata_cascade_policy_id=cascade_policy_id, - conflict_resolution=CreateMetadataCascadePolicyApplyConflictResolutionArg.OVERWRITE.value, + conflict_resolution=ApplyMetadataCascadePolicyConflictResolution.OVERWRITE.value, ) client.metadata_cascade_policies.delete_metadata_cascade_policy_by_id( metadata_cascade_policy_id=cascade_policy_id diff --git a/test/metadata_templates.py b/test/metadata_templates.py index 9c09e85..f34fcf5 100644 --- a/test/metadata_templates.py +++ b/test/metadata_templates.py @@ -4,33 +4,33 @@ from box_sdk_gen.schemas import MetadataTemplate -from box_sdk_gen.managers.metadata_templates import CreateMetadataTemplateFieldsArg +from box_sdk_gen.managers.metadata_templates import CreateMetadataTemplateFields from box_sdk_gen.managers.metadata_templates import ( - CreateMetadataTemplateFieldsArgTypeField, + CreateMetadataTemplateFieldsTypeField, ) -from box_sdk_gen.managers.metadata_templates import UpdateMetadataTemplateScopeArg +from box_sdk_gen.managers.metadata_templates import UpdateMetadataTemplateScope -from box_sdk_gen.managers.metadata_templates import UpdateMetadataTemplateRequestBodyArg +from box_sdk_gen.managers.metadata_templates import UpdateMetadataTemplateRequestBody from box_sdk_gen.managers.metadata_templates import ( - UpdateMetadataTemplateRequestBodyArgOpField, + UpdateMetadataTemplateRequestBodyOpField, ) -from box_sdk_gen.managers.metadata_templates import GetMetadataTemplateScopeArg +from box_sdk_gen.managers.metadata_templates import GetMetadataTemplateScope from box_sdk_gen.schemas import MetadataTemplates -from box_sdk_gen.managers.metadata_templates import DeleteMetadataTemplateScopeArg +from box_sdk_gen.managers.metadata_templates import DeleteMetadataTemplateScope from box_sdk_gen.schemas import FileFull from box_sdk_gen.schemas import MetadataFull -from box_sdk_gen.managers.file_metadata import CreateFileMetadataByIdScopeArg +from box_sdk_gen.managers.file_metadata import CreateFileMetadataByIdScope -from box_sdk_gen.managers.file_metadata import DeleteFileMetadataByIdScopeArg +from box_sdk_gen.managers.file_metadata import DeleteFileMetadataByIdScope from box_sdk_gen.utils import get_uuid @@ -48,8 +48,8 @@ def testMetadataTemplates(): template_key=template_key, display_name=template_key, fields=[ - CreateMetadataTemplateFieldsArg( - type=CreateMetadataTemplateFieldsArgTypeField.STRING.value, + CreateMetadataTemplateFields( + type=CreateMetadataTemplateFieldsTypeField.STRING.value, key='testName', display_name='testName', ) @@ -62,11 +62,11 @@ def testMetadataTemplates(): assert template.fields[0].display_name == 'testName' updated_template: MetadataTemplate = ( client.metadata_templates.update_metadata_template( - scope=UpdateMetadataTemplateScopeArg.ENTERPRISE.value, + scope=UpdateMetadataTemplateScope.ENTERPRISE.value, template_key=template_key, request_body=[ - UpdateMetadataTemplateRequestBodyArg( - op=UpdateMetadataTemplateRequestBodyArgOpField.ADDFIELD.value, + UpdateMetadataTemplateRequestBody( + op=UpdateMetadataTemplateRequestBodyOpField.ADDFIELD.value, field_key='newfieldname', data={'type': 'string', 'displayName': 'newFieldName'}, ) @@ -82,7 +82,7 @@ def testMetadataTemplates(): assert get_metadata_template.id == template.id get_metadata_template_schema: MetadataTemplate = ( client.metadata_templates.get_metadata_template( - scope=GetMetadataTemplateScopeArg.ENTERPRISE.value, + scope=GetMetadataTemplateScope.ENTERPRISE.value, template_key=template.template_key, ) ) @@ -96,12 +96,12 @@ def testMetadataTemplates(): ) assert len(global_metadata_templates.entries) > 0 client.metadata_templates.delete_metadata_template( - scope=DeleteMetadataTemplateScopeArg.ENTERPRISE.value, + scope=DeleteMetadataTemplateScope.ENTERPRISE.value, template_key=template.template_key, ) with pytest.raises(Exception): client.metadata_templates.delete_metadata_template( - scope=DeleteMetadataTemplateScopeArg.ENTERPRISE.value, + scope=DeleteMetadataTemplateScope.ENTERPRISE.value, template_key=template.template_key, ) @@ -114,8 +114,8 @@ def testGetMetadataTemplateByInstance(): template_key=template_key, display_name=template_key, fields=[ - CreateMetadataTemplateFieldsArg( - type=CreateMetadataTemplateFieldsArgTypeField.STRING.value, + CreateMetadataTemplateFields( + type=CreateMetadataTemplateFieldsTypeField.STRING.value, key='testName', display_name='testName', ) @@ -124,7 +124,7 @@ def testGetMetadataTemplateByInstance(): created_metadata_instance: MetadataFull = ( client.file_metadata.create_file_metadata_by_id( file_id=file.id, - scope=CreateFileMetadataByIdScopeArg.ENTERPRISE.value, + scope=CreateFileMetadataByIdScope.ENTERPRISE.value, template_key=template_key, request_body={'testName': 'xyz'}, ) @@ -139,11 +139,11 @@ def testGetMetadataTemplateByInstance(): assert metadata_templates.entries[0].template_key == template_key client.file_metadata.delete_file_metadata_by_id( file_id=file.id, - scope=DeleteFileMetadataByIdScopeArg.ENTERPRISE.value, + scope=DeleteFileMetadataByIdScope.ENTERPRISE.value, template_key=template_key, ) client.metadata_templates.delete_metadata_template( - scope=DeleteMetadataTemplateScopeArg.ENTERPRISE.value, + scope=DeleteMetadataTemplateScope.ENTERPRISE.value, template_key=template.template_key, ) client.files.delete_file_by_id(file_id=file.id) diff --git a/test/retention_policies.py b/test/retention_policies.py index 78af05f..6b6e00b 100644 --- a/test/retention_policies.py +++ b/test/retention_policies.py @@ -1,14 +1,12 @@ from box_sdk_gen.schemas import RetentionPolicy -from box_sdk_gen.managers.retention_policies import CreateRetentionPolicyPolicyTypeArg +from box_sdk_gen.managers.retention_policies import CreateRetentionPolicyPolicyType from box_sdk_gen.managers.retention_policies import ( - CreateRetentionPolicyDispositionActionArg, + CreateRetentionPolicyDispositionAction, ) -from box_sdk_gen.managers.retention_policies import ( - CreateRetentionPolicyRetentionTypeArg, -) +from box_sdk_gen.managers.retention_policies import CreateRetentionPolicyRetentionType from box_sdk_gen.schemas import RetentionPolicies @@ -28,10 +26,10 @@ def testCreateUpdateGetDeleteRetentionPolicy(): 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, + policy_type=CreateRetentionPolicyPolicyType.FINITE.value, + disposition_action=CreateRetentionPolicyDispositionAction.REMOVE_RETENTION.value, retention_length='1', - retention_type=CreateRetentionPolicyRetentionTypeArg.MODIFIABLE.value, + retention_type=CreateRetentionPolicyRetentionType.MODIFIABLE.value, can_owner_extend_retention=True, are_owners_notified=True, ) diff --git a/test/search.py b/test/search.py index b4837df..3b201ae 100644 --- a/test/search.py +++ b/test/search.py @@ -6,33 +6,37 @@ from box_sdk_gen.schemas import MetadataTemplate -from box_sdk_gen.managers.metadata_templates import CreateMetadataTemplateFieldsArg +from box_sdk_gen.managers.metadata_templates import CreateMetadataTemplateFields from box_sdk_gen.managers.metadata_templates import ( - CreateMetadataTemplateFieldsArgTypeField, + CreateMetadataTemplateFieldsTypeField, ) from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField from box_sdk_gen.schemas import FileFull from box_sdk_gen.schemas import MetadataFull -from box_sdk_gen.managers.file_metadata import CreateFileMetadataByIdScopeArg +from box_sdk_gen.managers.file_metadata import CreateFileMetadataByIdScope from box_sdk_gen.schemas import MetadataQueryResults -from box_sdk_gen.managers.metadata_templates import DeleteMetadataTemplateScopeArg +from box_sdk_gen.managers.metadata_templates import DeleteMetadataTemplateScope from box_sdk_gen.schemas import MetadataQueryIndices -from box_sdk_gen.managers.search import GetMetadataQueryIndicesScopeArg +from box_sdk_gen.managers.search import GetMetadataQueryIndicesScope -from box_sdk_gen.managers.search import GetSearchTrashContentArg +from box_sdk_gen.schemas import SearchResults + +from box_sdk_gen.schemas import SearchResultsWithSharedLinks + +from box_sdk_gen.managers.search import SearchForContentTrashContent from box_sdk_gen.utils import get_uuid @@ -50,8 +54,8 @@ def testCreateMetaDataQueryExecuteRead(): template_key=template_key, display_name=template_key, fields=[ - CreateMetadataTemplateFieldsArg( - type=CreateMetadataTemplateFieldsArgTypeField.FLOAT.value, + CreateMetadataTemplateFields( + type=CreateMetadataTemplateFieldsTypeField.FLOAT.value, key='testName', display_name='testName', ) @@ -59,22 +63,22 @@ def testCreateMetaDataQueryExecuteRead(): ) assert template.template_key == template_key files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=get_uuid(), parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=get_uuid(), parent=UploadFileAttributesParentField(id='0') ), file=generate_byte_stream(10), ) file: FileFull = files.entries[0] metadata: MetadataFull = client.file_metadata.create_file_metadata_by_id( file_id=file.id, - scope=CreateFileMetadataByIdScopeArg.ENTERPRISE.value, + scope=CreateFileMetadataByIdScope.ENTERPRISE.value, template_key=template_key, request_body={'testName': 1}, ) assert metadata.template == template_key assert metadata.scope == template.scope search_from: str = ''.join([template.scope, '.', template.template_key]) - query: MetadataQueryResults = client.search.create_metadata_query_execute_read( + query: MetadataQueryResults = client.search.search_by_metadata_query( from_=search_from, query='testName >= :value', query_params={'value': '0.0'}, @@ -82,7 +86,7 @@ def testCreateMetaDataQueryExecuteRead(): ) assert len(query.entries) >= 0 client.metadata_templates.delete_metadata_template( - scope=DeleteMetadataTemplateScopeArg.ENTERPRISE.value, + scope=DeleteMetadataTemplateScope.ENTERPRISE.value, template_key=template.template_key, ) client.files.delete_file_by_id(file_id=file.id) @@ -95,8 +99,8 @@ def testGetMetadataQueryIndices(): template_key=template_key, display_name=template_key, fields=[ - CreateMetadataTemplateFieldsArg( - type=CreateMetadataTemplateFieldsArgTypeField.STRING.value, + CreateMetadataTemplateFields( + type=CreateMetadataTemplateFieldsTypeField.STRING.value, key='testName', display_name='testName', ) @@ -104,12 +108,11 @@ def testGetMetadataQueryIndices(): ) assert template.template_key == template_key indices: MetadataQueryIndices = client.search.get_metadata_query_indices( - scope=GetMetadataQueryIndicesScopeArg.ENTERPRISE.value, - template_key=template_key, + scope=GetMetadataQueryIndicesScope.ENTERPRISE.value, template_key=template_key ) assert len(indices.entries) >= 0 client.metadata_templates.delete_metadata_template( - scope=DeleteMetadataTemplateScopeArg.ENTERPRISE.value, + scope=DeleteMetadataTemplateScope.ENTERPRISE.value, template_key=template.template_key, ) @@ -117,19 +120,19 @@ def testGetMetadataQueryIndices(): def testGetSearch(): keyword: str = 'test' search: Union[SearchResults, SearchResultsWithSharedLinks] = ( - client.search.get_search( + client.search.search_for_content( query=keyword, ancestor_folder_ids=['0'], - trash_content=GetSearchTrashContentArg.NON_TRASHED_ONLY.value, + trash_content=SearchForContentTrashContent.NON_TRASHED_ONLY.value, ) ) assert len(search.entries) >= 0 assert to_string(search.type) == 'search_results_items' search_with_shared_link: Union[SearchResults, SearchResultsWithSharedLinks] = ( - client.search.get_search( + client.search.search_for_content( query=keyword, ancestor_folder_ids=['0'], - trash_content=GetSearchTrashContentArg.NON_TRASHED_ONLY.value, + trash_content=SearchForContentTrashContent.NON_TRASHED_ONLY.value, include_recent_shared_links=True, ) ) diff --git a/test/session_termination.py b/test/session_termination.py index 3f51770..4d2260f 100644 --- a/test/session_termination.py +++ b/test/session_termination.py @@ -21,7 +21,7 @@ def testSessionTerminationUser(): admin_client: BoxClient = get_default_client_as_user(get_env_var('USER_ID')) user: UserFull = admin_client.users.get_user_me() result: SessionTerminationMessage = ( - client.session_termination.create_user_terminate_session( + client.session_termination.terminate_users_sessions( user_ids=[get_env_var('USER_ID')], user_logins=[user.login] ) ) @@ -36,7 +36,7 @@ def testSessionTerminationGroup(): group_name: str = get_uuid() group: GroupFull = client.groups.create_group(name=group_name) result: SessionTerminationMessage = ( - client.session_termination.create_group_terminate_session(group_ids=[group.id]) + client.session_termination.terminate_groups_sessions(group_ids=[group.id]) ) assert ( result.message diff --git a/test/shared_links_files.py b/test/shared_links_files.py index 117733e..6c15ace 100644 --- a/test/shared_links_files.py +++ b/test/shared_links_files.py @@ -6,24 +6,22 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField -from box_sdk_gen.managers.shared_links_files import UpdateFileAddSharedLinkSharedLinkArg +from box_sdk_gen.managers.shared_links_files import AddShareLinkToFileSharedLink from box_sdk_gen.managers.shared_links_files import ( - UpdateFileAddSharedLinkSharedLinkArgAccessField, + AddShareLinkToFileSharedLinkAccessField, ) from box_sdk_gen.schemas import FileFull -from box_sdk_gen.managers.shared_links_files import ( - UpdateFileUpdateSharedLinkSharedLinkArg, -) +from box_sdk_gen.managers.shared_links_files import UpdateSharedLinkOnFileSharedLink from box_sdk_gen.managers.shared_links_files import ( - UpdateFileUpdateSharedLinkSharedLinkArgAccessField, + UpdateSharedLinkOnFileSharedLinkAccessField, ) from box_sdk_gen.utils import get_uuid @@ -41,28 +39,28 @@ def testSharedLinksFiles(): uploaded_files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=get_uuid(), parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=get_uuid(), parent=UploadFileAttributesParentField(id='0') ), file=generate_byte_stream(10), ) file_id: str = uploaded_files.entries[0].id - client.shared_links_files.update_file_add_shared_link( + client.shared_links_files.add_share_link_to_file( file_id=file_id, - shared_link=UpdateFileAddSharedLinkSharedLinkArg( - access=UpdateFileAddSharedLinkSharedLinkArgAccessField.OPEN.value, + shared_link=AddShareLinkToFileSharedLink( + access=AddShareLinkToFileSharedLinkAccessField.OPEN.value, password='Secret123@', ), fields='shared_link', ) - file_from_api: FileFull = client.shared_links_files.get_file_get_shared_link( + file_from_api: FileFull = client.shared_links_files.get_shared_link_for_file( file_id=file_id, fields='shared_link' ) assert to_string(file_from_api.shared_link.access) == 'open' user_id: str = get_env_var('USER_ID') user_client: BoxClient = get_default_client_as_user(user_id) file_from_shared_link_password: FileFull = ( - user_client.shared_links_files.get_shared_items( + user_client.shared_links_files.find_file_for_shared_link( boxapi=''.join([ 'shared_link=', file_from_api.shared_link.url, @@ -72,17 +70,17 @@ def testSharedLinksFiles(): ) assert file_id == file_from_shared_link_password.id with pytest.raises(Exception): - user_client.shared_links_files.get_shared_items( + user_client.shared_links_files.find_file_for_shared_link( boxapi=''.join([ 'shared_link=', file_from_api.shared_link.url, '&shared_link_password=incorrectPassword', ]) ) - updated_file: FileFull = client.shared_links_files.update_file_update_shared_link( + updated_file: FileFull = client.shared_links_files.update_shared_link_on_file( file_id=file_id, - shared_link=UpdateFileUpdateSharedLinkSharedLinkArg( - access=UpdateFileUpdateSharedLinkSharedLinkArgAccessField.COLLABORATORS.value + shared_link=UpdateSharedLinkOnFileSharedLink( + access=UpdateSharedLinkOnFileSharedLinkAccessField.COLLABORATORS.value ), fields='shared_link', ) diff --git a/test/shared_links_folders.py b/test/shared_links_folders.py index 5e8d209..fb1ed5c 100644 --- a/test/shared_links_folders.py +++ b/test/shared_links_folders.py @@ -6,22 +6,18 @@ from box_sdk_gen.schemas import FolderFull -from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.managers.folders import CreateFolderParent -from box_sdk_gen.managers.shared_links_folders import ( - UpdateFolderAddSharedLinkSharedLinkArg, -) +from box_sdk_gen.managers.shared_links_folders import AddShareLinkToFolderSharedLink from box_sdk_gen.managers.shared_links_folders import ( - UpdateFolderAddSharedLinkSharedLinkArgAccessField, + AddShareLinkToFolderSharedLinkAccessField, ) -from box_sdk_gen.managers.shared_links_folders import ( - UpdateFolderUpdateSharedLinkSharedLinkArg, -) +from box_sdk_gen.managers.shared_links_folders import UpdateSharedLinkOnFolderSharedLink from box_sdk_gen.managers.shared_links_folders import ( - UpdateFolderUpdateSharedLinkSharedLinkArgAccessField, + UpdateSharedLinkOnFolderSharedLinkAccessField, ) from box_sdk_gen.utils import get_uuid @@ -39,18 +35,18 @@ def testSharedLinksFolders(): folder: FolderFull = client.folders.create_folder( - name=get_uuid(), parent=CreateFolderParentArg(id='0') + name=get_uuid(), parent=CreateFolderParent(id='0') ) - client.shared_links_folders.update_folder_add_shared_link( + client.shared_links_folders.add_share_link_to_folder( folder_id=folder.id, - shared_link=UpdateFolderAddSharedLinkSharedLinkArg( - access=UpdateFolderAddSharedLinkSharedLinkArgAccessField.OPEN.value, + shared_link=AddShareLinkToFolderSharedLink( + access=AddShareLinkToFolderSharedLinkAccessField.OPEN.value, password='Secret123@', ), fields='shared_link', ) folder_from_api: FolderFull = ( - client.shared_links_folders.get_folder_get_shared_link( + client.shared_links_folders.get_shared_link_for_folder( folder_id=folder.id, fields='shared_link' ) ) @@ -58,7 +54,7 @@ def testSharedLinksFolders(): user_id: str = get_env_var('USER_ID') user_client: BoxClient = get_default_client_as_user(user_id) folder_from_shared_link_password: FolderFull = ( - user_client.shared_links_folders.get_shared_item_folders( + user_client.shared_links_folders.find_folder_for_shared_link( boxapi=''.join([ 'shared_link=', folder_from_api.shared_link.url, @@ -68,7 +64,7 @@ def testSharedLinksFolders(): ) assert folder.id == folder_from_shared_link_password.id with pytest.raises(Exception): - user_client.shared_links_folders.get_shared_item_folders( + user_client.shared_links_folders.find_folder_for_shared_link( boxapi=''.join([ 'shared_link=', folder_from_api.shared_link.url, @@ -76,10 +72,10 @@ def testSharedLinksFolders(): ]) ) updated_folder: FolderFull = ( - client.shared_links_folders.update_folder_update_shared_link( + client.shared_links_folders.update_shared_link_on_folder( folder_id=folder.id, - shared_link=UpdateFolderUpdateSharedLinkSharedLinkArg( - access=UpdateFolderUpdateSharedLinkSharedLinkArgAccessField.COLLABORATORS.value + shared_link=UpdateSharedLinkOnFolderSharedLink( + access=UpdateSharedLinkOnFolderSharedLinkAccessField.COLLABORATORS.value ), fields='shared_link', ) diff --git a/test/shared_links_web_links.py b/test/shared_links_web_links.py index b1d0578..c8f6b59 100644 --- a/test/shared_links_web_links.py +++ b/test/shared_links_web_links.py @@ -8,22 +8,20 @@ from box_sdk_gen.schemas import WebLink -from box_sdk_gen.managers.web_links import CreateWebLinkParentArg +from box_sdk_gen.managers.web_links import CreateWebLinkParent -from box_sdk_gen.managers.shared_links_web_links import ( - UpdateWebLinkAddSharedLinkSharedLinkArg, -) +from box_sdk_gen.managers.shared_links_web_links import AddShareLinkToWebLinkSharedLink from box_sdk_gen.managers.shared_links_web_links import ( - UpdateWebLinkAddSharedLinkSharedLinkArgAccessField, + AddShareLinkToWebLinkSharedLinkAccessField, ) from box_sdk_gen.managers.shared_links_web_links import ( - UpdateWebLinkUpdateSharedLinkSharedLinkArg, + UpdateSharedLinkOnWebLinkSharedLink, ) from box_sdk_gen.managers.shared_links_web_links import ( - UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField, + UpdateSharedLinkOnWebLinkSharedLinkAccessField, ) from box_sdk_gen.utils import get_uuid @@ -43,21 +41,21 @@ def testSharedLinksWebLinks(): parent: FolderFull = client.folders.get_folder_by_id(folder_id='0') web_link: WebLink = client.web_links.create_web_link( url='https://www.box.com', - parent=CreateWebLinkParentArg(id=parent.id), + parent=CreateWebLinkParent(id=parent.id), name=get_uuid(), description='Weblink description', ) web_link_id: str = web_link.id - client.shared_links_web_links.update_web_link_add_shared_link( + client.shared_links_web_links.add_share_link_to_web_link( web_link_id=web_link_id, - shared_link=UpdateWebLinkAddSharedLinkSharedLinkArg( - access=UpdateWebLinkAddSharedLinkSharedLinkArgAccessField.OPEN.value, + shared_link=AddShareLinkToWebLinkSharedLink( + access=AddShareLinkToWebLinkSharedLinkAccessField.OPEN.value, password='Secret123@', ), fields='shared_link', ) web_link_from_api: WebLink = ( - client.shared_links_web_links.get_web_link_get_shared_link( + client.shared_links_web_links.get_shared_link_for_web_link( web_link_id=web_link_id, fields='shared_link' ) ) @@ -65,7 +63,7 @@ def testSharedLinksWebLinks(): user_id: str = get_env_var('USER_ID') user_client: BoxClient = get_default_client_as_user(user_id) web_link_from_shared_link_password: WebLink = ( - user_client.shared_links_web_links.get_shared_item_web_links( + user_client.shared_links_web_links.find_web_link_for_shared_link( boxapi=''.join([ 'shared_link=', web_link_from_api.shared_link.url, @@ -75,7 +73,7 @@ def testSharedLinksWebLinks(): ) assert web_link_id == web_link_from_shared_link_password.id with pytest.raises(Exception): - user_client.shared_links_web_links.get_shared_item_web_links( + user_client.shared_links_web_links.find_web_link_for_shared_link( boxapi=''.join([ 'shared_link=', web_link_from_api.shared_link.url, @@ -83,10 +81,10 @@ def testSharedLinksWebLinks(): ]) ) updated_web_link: WebLink = ( - client.shared_links_web_links.update_web_link_update_shared_link( + client.shared_links_web_links.update_shared_link_on_web_link( web_link_id=web_link_id, - shared_link=UpdateWebLinkUpdateSharedLinkSharedLinkArg( - access=UpdateWebLinkUpdateSharedLinkSharedLinkArgAccessField.COLLABORATORS.value + shared_link=UpdateSharedLinkOnWebLinkSharedLink( + access=UpdateSharedLinkOnWebLinkSharedLinkAccessField.COLLABORATORS.value ), fields='shared_link', ) diff --git a/test/shield_information_barrier_reports.py b/test/shield_information_barrier_reports.py new file mode 100644 index 0000000..5c62c30 --- /dev/null +++ b/test/shield_information_barrier_reports.py @@ -0,0 +1,63 @@ +from box_sdk_gen.utils import to_string + +from box_sdk_gen.schemas import ShieldInformationBarrierReports + +from box_sdk_gen.schemas import ShieldInformationBarrierReport + +from box_sdk_gen.schemas import ShieldInformationBarrierBase + +from box_sdk_gen.schemas import ShieldInformationBarrierBaseTypeField + +from box_sdk_gen.utils import get_env_var + +from test.commons import get_default_client_as_user + +from test.commons import get_or_create_shield_information_barrier + +from box_sdk_gen.schemas import ShieldInformationBarrier + +from box_sdk_gen.client import BoxClient + + +def shieldInformationBarrierReports(): + client: BoxClient = get_default_client_as_user(get_env_var('USER_ID')) + enterprise_id: str = get_env_var('ENTERPRISE_ID') + barrier: ShieldInformationBarrier = get_or_create_shield_information_barrier( + client, enterprise_id + ) + assert to_string(barrier.status) == 'draft' + assert to_string(barrier.type) == 'shield_information_barrier' + assert barrier.enterprise.id == enterprise_id + assert to_string(barrier.enterprise.type) == 'enterprise' + barrier_id: str = barrier.id + existing_reports: ShieldInformationBarrierReports = ( + client.shield_information_barrier_reports.get_shield_information_barrier_reports( + shield_information_barrier_id=barrier_id + ) + ) + if len(existing_reports.entries) > 0: + return None + created_report: ShieldInformationBarrierReport = ( + client.shield_information_barrier_reports.create_shield_information_barrier_report( + shield_information_barrier=ShieldInformationBarrierBase( + id=barrier_id, + type=ShieldInformationBarrierBaseTypeField.SHIELD_INFORMATION_BARRIER.value, + ) + ) + ) + assert ( + created_report.shield_information_barrier.shield_information_barrier.id + == barrier_id + ) + retrieved_report: ShieldInformationBarrierReport = ( + client.shield_information_barrier_reports.get_shield_information_barrier_report_by_id( + shield_information_barrier_report_id=created_report.id + ) + ) + assert retrieved_report.id == created_report.id + retrieved_reports: ShieldInformationBarrierReports = ( + client.shield_information_barrier_reports.get_shield_information_barrier_reports( + shield_information_barrier_id=barrier_id + ) + ) + assert len(retrieved_reports.entries) > 0 diff --git a/test/shield_information_barrier_segment_members.py b/test/shield_information_barrier_segment_members.py index 862ca7a..b63e61b 100644 --- a/test/shield_information_barrier_segment_members.py +++ b/test/shield_information_barrier_segment_members.py @@ -13,11 +13,11 @@ from box_sdk_gen.schemas import ShieldInformationBarrierSegmentMember from box_sdk_gen.managers.shield_information_barrier_segment_members import ( - CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg, + CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment, ) from box_sdk_gen.managers.shield_information_barrier_segment_members import ( - CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField, + CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField, ) from box_sdk_gen.schemas import UserBase @@ -55,9 +55,9 @@ def testShieldInformationBarrierSegmentMembers(): assert segment.name == segment_name segment_member: ShieldInformationBarrierSegmentMember = ( client.shield_information_barrier_segment_members.create_shield_information_barrier_segment_member( - shield_information_barrier_segment=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArg( + shield_information_barrier_segment=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment( id=segment.id, - type=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentArgTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value, + type=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value, ), user=UserBase(id=get_env_var('USER_ID'), type=UserBaseTypeField.USER.value), ) diff --git a/test/shield_information_barrier_segment_restrictions.py b/test/shield_information_barrier_segment_restrictions.py index 551e979..100c2b3 100644 --- a/test/shield_information_barrier_segment_restrictions.py +++ b/test/shield_information_barrier_segment_restrictions.py @@ -13,23 +13,23 @@ from box_sdk_gen.schemas import ShieldInformationBarrierSegmentRestriction from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import ( - CreateShieldInformationBarrierSegmentRestrictionTypeArg, + CreateShieldInformationBarrierSegmentRestrictionType, ) from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import ( - CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg, + CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment, ) from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import ( - CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField, + CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField, ) from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import ( - CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg, + CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment, ) from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import ( - CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField, + CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField, ) from box_sdk_gen.schemas import ShieldInformationBarrierSegmentRestrictions @@ -74,14 +74,14 @@ def testShieldInformationBarrierSegmentRestrictions(): segment_to_restrict_id: str = segment_to_restrict.id segment_restriction: ShieldInformationBarrierSegmentRestriction = ( client.shield_information_barrier_segment_restrictions.create_shield_information_barrier_segment_restriction( - type=CreateShieldInformationBarrierSegmentRestrictionTypeArg.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION.value, - shield_information_barrier_segment=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArg( + type=CreateShieldInformationBarrierSegmentRestrictionType.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION.value, + shield_information_barrier_segment=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment( id=segment_id, - type=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentArgTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value, + type=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value, ), - restricted_segment=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArg( + restricted_segment=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment( id=segment_to_restrict_id, - type=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentArgTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value, + type=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT.value, ), ) ) diff --git a/test/shield_information_barriers.py b/test/shield_information_barriers.py index 62f8a7b..67951e1 100644 --- a/test/shield_information_barriers.py +++ b/test/shield_information_barriers.py @@ -9,7 +9,7 @@ from box_sdk_gen.schemas import ShieldInformationBarriers from box_sdk_gen.managers.shield_information_barriers import ( - CreateShieldInformationBarrierChangeStatusStatusArg, + UpdateShieldInformationBarrierStatusStatus, ) from box_sdk_gen.utils import get_env_var @@ -41,7 +41,7 @@ def testShieldInformationBarriers(): ) assert len(barriers.entries) == 1 with pytest.raises(Exception): - client.shield_information_barriers.create_shield_information_barrier_change_status( + client.shield_information_barriers.update_shield_information_barrier_status( id=barrier_id, - status=CreateShieldInformationBarrierChangeStatusStatusArg.DISABLED.value, + status=UpdateShieldInformationBarrierStatusStatus.DISABLED.value, ) diff --git a/test/skills.py b/test/skills.py index 611a0e0..e967422 100644 --- a/test/skills.py +++ b/test/skills.py @@ -12,21 +12,17 @@ from box_sdk_gen.schemas import KeywordSkillCardSkillField -from box_sdk_gen.schemas import KeywordSkillCardSkillFieldTypeField +from box_sdk_gen.schemas import KeywordSkillCardSkillTypeField from box_sdk_gen.schemas import KeywordSkillCardInvocationField -from box_sdk_gen.schemas import KeywordSkillCardInvocationFieldTypeField +from box_sdk_gen.schemas import KeywordSkillCardInvocationTypeField from box_sdk_gen.schemas import KeywordSkillCardEntriesField -from box_sdk_gen.managers.skills import ( - UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg, -) +from box_sdk_gen.managers.skills import UpdateBoxSkillCardsOnFileRequestBody -from box_sdk_gen.managers.skills import ( - UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField, -) +from box_sdk_gen.managers.skills import UpdateBoxSkillCardsOnFileRequestBodyOpField from box_sdk_gen.utils import get_uuid @@ -45,7 +41,7 @@ def test_skills_cards_CRUD(): invocation_id: str = get_uuid() title_message: str = 'License Plates' skill_cards_metadata: SkillCardsMetadata = ( - client.skills.create_file_metadata_global_box_skills_card( + client.skills.create_box_skill_cards_on_file( file_id=file.id, cards=[ KeywordSkillCard( @@ -55,12 +51,11 @@ def test_skills_cards_CRUD(): code='license-plates', message=title_message ), skill=KeywordSkillCardSkillField( - id=skill_id, - type=KeywordSkillCardSkillFieldTypeField.SERVICE.value, + id=skill_id, type=KeywordSkillCardSkillTypeField.SERVICE.value ), invocation=KeywordSkillCardInvocationField( id=invocation_id, - type=KeywordSkillCardInvocationFieldTypeField.SKILL_INVOCATION.value, + type=KeywordSkillCardInvocationTypeField.SKILL_INVOCATION.value, ), entries=[KeywordSkillCardEntriesField(text='DN86 BOX')], ) @@ -72,11 +67,11 @@ def test_skills_cards_CRUD(): assert skill_cards_metadata.cards[0].skill_card_title.message == title_message updated_title_message: str = 'Updated License Plates' updated_skill_cards_metadata: SkillCardsMetadata = ( - client.skills.update_file_metadata_global_box_skills_card( + client.skills.update_box_skill_cards_on_file( file_id=file.id, request_body=[ - UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArg( - op=UpdateFileMetadataGlobalBoxSkillsCardRequestBodyArgOpField.REPLACE.value, + UpdateBoxSkillCardsOnFileRequestBody( + op=UpdateBoxSkillCardsOnFileRequestBodyOpField.REPLACE.value, path='/cards/0', value=KeywordSkillCard( type=KeywordSkillCardTypeField.SKILL_CARD.value, @@ -86,11 +81,11 @@ def test_skills_cards_CRUD(): ), skill=KeywordSkillCardSkillField( id=skill_id, - type=KeywordSkillCardSkillFieldTypeField.SERVICE.value, + type=KeywordSkillCardSkillTypeField.SERVICE.value, ), invocation=KeywordSkillCardInvocationField( id=invocation_id, - type=KeywordSkillCardInvocationFieldTypeField.SKILL_INVOCATION.value, + type=KeywordSkillCardInvocationTypeField.SKILL_INVOCATION.value, ), entries=[KeywordSkillCardEntriesField(text='DN86 BOX')], ), @@ -104,8 +99,8 @@ def test_skills_cards_CRUD(): == updated_title_message ) received_skill_cards_metadata: SkillCardsMetadata = ( - client.skills.get_file_metadata_global_box_skills_cards(file_id=file.id) + client.skills.get_box_skill_cards_on_file(file_id=file.id) ) assert updated_skill_cards_metadata.cards[0].skill.id == skill_id - client.skills.delete_file_metadata_global_box_skills_card(file_id=file.id) + client.skills.delete_box_skill_cards_from_file(file_id=file.id) client.files.delete_file_by_id(file_id=file.id) diff --git a/test/tasks.py b/test/tasks.py index 3788c8c..c39f117 100644 --- a/test/tasks.py +++ b/test/tasks.py @@ -2,21 +2,21 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField from box_sdk_gen.schemas import FileFull from box_sdk_gen.schemas import Task -from box_sdk_gen.managers.tasks import CreateTaskItemArg +from box_sdk_gen.managers.tasks import CreateTaskItem -from box_sdk_gen.managers.tasks import CreateTaskItemArgTypeField +from box_sdk_gen.managers.tasks import CreateTaskItemTypeField -from box_sdk_gen.managers.tasks import CreateTaskActionArg +from box_sdk_gen.managers.tasks import CreateTaskAction -from box_sdk_gen.managers.tasks import CreateTaskCompletionRuleArg +from box_sdk_gen.managers.tasks import CreateTaskCompletionRule from box_sdk_gen.schemas import Tasks @@ -31,18 +31,18 @@ def testCreateUpdateGetDeleteTask(): files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=get_uuid(), parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=get_uuid(), parent=UploadFileAttributesParentField(id='0') ), file=generate_byte_stream(10), ) file: FileFull = files.entries[0] task: Task = client.tasks.create_task( - item=CreateTaskItemArg(type=CreateTaskItemArgTypeField.FILE.value, id=file.id), - action=CreateTaskActionArg.REVIEW.value, + item=CreateTaskItem(type=CreateTaskItemTypeField.FILE.value, id=file.id), + action=CreateTaskAction.REVIEW.value, message='test message', due_at='2035-01-01T00:00:00Z', - completion_rule=CreateTaskCompletionRuleArg.ALL_ASSIGNEES.value, + completion_rule=CreateTaskCompletionRule.ALL_ASSIGNEES.value, ) assert task.message == 'test message' assert task.item.id == file.id diff --git a/test/transfer.py b/test/transfer.py index b0010e7..d0e91b2 100644 --- a/test/transfer.py +++ b/test/transfer.py @@ -4,7 +4,7 @@ from box_sdk_gen.schemas import FolderFull -from box_sdk_gen.managers.transfer import TransferOwnedFolderOwnedByArg +from box_sdk_gen.managers.transfer import TransferOwnedFolderOwnedBy from box_sdk_gen.utils import get_uuid @@ -21,7 +21,7 @@ def testTransferUserContent(): current_user: UserFull = client.users.get_user_me() transfered_folder: FolderFull = client.transfer.transfer_owned_folder( user_id=new_user.id, - owned_by=TransferOwnedFolderOwnedByArg(id=current_user.id), + owned_by=TransferOwnedFolderOwnedBy(id=current_user.id), notify=False, ) assert transfered_folder.owned_by.id == current_user.id diff --git a/test/trashed_files.py b/test/trashed_files.py index 2e83f8b..72ee662 100644 --- a/test/trashed_files.py +++ b/test/trashed_files.py @@ -8,9 +8,9 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField from box_sdk_gen.schemas import FileFull @@ -32,14 +32,14 @@ def testTrashedFiles(): 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') + attributes=UploadFileAttributes( + name=file_name, parent=UploadFileAttributesParentField(id='0') ), file=file_byte_stream, ) file: FileFull = 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) + from_trash: TrashFile = client.trashed_files.get_trashed_file_by_id(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) @@ -52,6 +52,6 @@ def testTrashedFiles(): assert restored_file.name == from_api_after_restore.name assert to_string(from_api_after_restore.item_status) == 'active' client.files.delete_file_by_id(file_id=file.id) - client.trashed_files.delete_file_trash(file_id=file.id) + client.trashed_files.delete_trashed_file_by_id(file_id=file.id) with pytest.raises(Exception): - client.trashed_files.get_file_trash(file_id=file.id) + client.trashed_files.get_trashed_file_by_id(file_id=file.id) diff --git a/test/trashed_folders.py b/test/trashed_folders.py index 76a9d2d..27fbc11 100644 --- a/test/trashed_folders.py +++ b/test/trashed_folders.py @@ -4,7 +4,7 @@ from box_sdk_gen.schemas import FolderFull -from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.managers.folders import CreateFolderParent from box_sdk_gen.schemas import TrashFolder @@ -19,10 +19,10 @@ def testTrashedFolders(): folder: FolderFull = client.folders.create_folder( - name=get_uuid(), parent=CreateFolderParentArg(id='0') + name=get_uuid(), parent=CreateFolderParent(id='0') ) client.folders.delete_folder_by_id(folder_id=folder.id) - from_trash: TrashFolder = client.trashed_folders.get_folder_trash( + from_trash: TrashFolder = client.trashed_folders.get_trashed_folder_by_id( folder_id=folder.id ) assert from_trash.id == folder.id @@ -36,6 +36,6 @@ def testTrashedFolders(): 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) + client.trashed_folders.delete_trashed_folder_by_id(folder_id=folder.id) with pytest.raises(Exception): - client.trashed_folders.get_folder_trash(folder_id=folder.id) + client.trashed_folders.get_trashed_folder_by_id(folder_id=folder.id) diff --git a/test/trashed_items.py b/test/trashed_items.py index 3467ace..5a61790 100644 --- a/test/trashed_items.py +++ b/test/trashed_items.py @@ -14,5 +14,5 @@ def testListTrashedItems(): file: FileFull = upload_new_file() client.files.delete_file_by_id(file_id=file.id) - trashed_items: Items = client.trashed_items.get_folder_trash_items() + trashed_items: Items = client.trashed_items.get_trashed_items() assert len(trashed_items.entries) > 0 diff --git a/test/trashed_web_links.py b/test/trashed_web_links.py index afb1ba8..4852862 100644 --- a/test/trashed_web_links.py +++ b/test/trashed_web_links.py @@ -8,7 +8,7 @@ from box_sdk_gen.schemas import WebLink -from box_sdk_gen.managers.web_links import CreateWebLinkParentArg +from box_sdk_gen.managers.web_links import CreateWebLinkParent from box_sdk_gen.schemas import TrashWebLink @@ -28,12 +28,12 @@ def testTrashedWebLinks(): description: str = 'Weblink description' weblink: WebLink = client.web_links.create_web_link( url=url, - parent=CreateWebLinkParentArg(id=parent.id), + parent=CreateWebLinkParent(id=parent.id), name=name, description=description, ) client.web_links.delete_web_link_by_id(web_link_id=weblink.id) - from_trash: TrashWebLink = client.trashed_web_links.get_web_link_trash( + from_trash: TrashWebLink = client.trashed_web_links.get_trashed_web_link_by_id( web_link_id=weblink.id ) assert from_trash.id == weblink.id @@ -49,6 +49,6 @@ def testTrashedWebLinks(): assert restored_weblink.id == from_api.id assert restored_weblink.name == from_api.name client.web_links.delete_web_link_by_id(web_link_id=weblink.id) - client.trashed_web_links.delete_web_link_trash(web_link_id=weblink.id) + client.trashed_web_links.delete_trashed_web_link_by_id(web_link_id=weblink.id) with pytest.raises(Exception): - client.trashed_web_links.get_web_link_trash(web_link_id=weblink.id) + client.trashed_web_links.get_trashed_web_link_by_id(web_link_id=weblink.id) diff --git a/test/uploads.py b/test/uploads.py index 2818f17..2939618 100644 --- a/test/uploads.py +++ b/test/uploads.py @@ -2,13 +2,13 @@ from box_sdk_gen.schemas import Files -from box_sdk_gen.managers.uploads import UploadFileAttributesArg +from box_sdk_gen.managers.uploads import UploadFileAttributes -from box_sdk_gen.managers.uploads import UploadFileAttributesArgParentField +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField from box_sdk_gen.schemas import FileFull -from box_sdk_gen.managers.uploads import UploadFileVersionAttributesArg +from box_sdk_gen.managers.uploads import UploadFileVersionAttributes from box_sdk_gen.utils import get_uuid @@ -25,8 +25,8 @@ def testUploadFileAndFileVersion(): new_file_name: str = get_uuid() file_content_stream: ByteStream = generate_byte_stream(1024 * 1024) uploaded_files: Files = client.uploads.upload_file( - attributes=UploadFileAttributesArg( - name=new_file_name, parent=UploadFileAttributesArgParentField(id='0') + attributes=UploadFileAttributes( + name=new_file_name, parent=UploadFileAttributesParentField(id='0') ), file=file_content_stream, ) @@ -36,7 +36,7 @@ def testUploadFileAndFileVersion(): new_file_content_stream: ByteStream = generate_byte_stream(1024 * 1024) uploaded_files_version: Files = client.uploads.upload_file_version( file_id=uploaded_file.id, - attributes=UploadFileVersionAttributesArg(name=new_file_version_name), + attributes=UploadFileVersionAttributes(name=new_file_version_name), file=new_file_content_stream, ) new_file_version: FileFull = uploaded_files_version.entries[0] diff --git a/test/user_collaborations.py b/test/user_collaborations.py index cc62bc3..30fcd11 100644 --- a/test/user_collaborations.py +++ b/test/user_collaborations.py @@ -10,19 +10,19 @@ from box_sdk_gen.schemas import Collaboration -from box_sdk_gen.managers.user_collaborations import CreateCollaborationItemArg +from box_sdk_gen.managers.user_collaborations import CreateCollaborationItem -from box_sdk_gen.managers.user_collaborations import CreateCollaborationItemArgTypeField +from box_sdk_gen.managers.user_collaborations import CreateCollaborationItemTypeField -from box_sdk_gen.managers.user_collaborations import CreateCollaborationAccessibleByArg +from box_sdk_gen.managers.user_collaborations import CreateCollaborationAccessibleBy from box_sdk_gen.managers.user_collaborations import ( - CreateCollaborationAccessibleByArgTypeField, + CreateCollaborationAccessibleByTypeField, ) -from box_sdk_gen.managers.user_collaborations import CreateCollaborationRoleArg +from box_sdk_gen.managers.user_collaborations import CreateCollaborationRole -from box_sdk_gen.managers.user_collaborations import UpdateCollaborationByIdRoleArg +from box_sdk_gen.managers.user_collaborations import UpdateCollaborationByIdRole from box_sdk_gen.utils import get_uuid @@ -41,13 +41,13 @@ def testUserCollaborations(): ) folder: FolderFull = create_new_folder() collaboration: Collaboration = client.user_collaborations.create_collaboration( - item=CreateCollaborationItemArg( - type=CreateCollaborationItemArgTypeField.FOLDER.value, id=folder.id + item=CreateCollaborationItem( + type=CreateCollaborationItemTypeField.FOLDER.value, id=folder.id ), - accessible_by=CreateCollaborationAccessibleByArg( - type=CreateCollaborationAccessibleByArgTypeField.USER.value, id=user.id + accessible_by=CreateCollaborationAccessibleBy( + type=CreateCollaborationAccessibleByTypeField.USER.value, id=user.id ), - role=CreateCollaborationRoleArg.EDITOR.value, + role=CreateCollaborationRole.EDITOR.value, ) assert to_string(collaboration.role) == 'editor' collaboration_id: str = collaboration.id @@ -63,7 +63,7 @@ def testUserCollaborations(): updated_collaboration: Collaboration = ( client.user_collaborations.update_collaboration_by_id( collaboration_id=collaboration_id, - role=UpdateCollaborationByIdRoleArg.VIEWER.value, + role=UpdateCollaborationByIdRole.VIEWER.value, ) ) assert to_string(updated_collaboration.role) == 'viewer' @@ -83,14 +83,13 @@ def testExternalUserCollaborations(): user_login: str = ''.join([get_uuid(), '@boxdemo.com']) folder: FolderFull = create_new_folder() collaboration: Collaboration = client.user_collaborations.create_collaboration( - item=CreateCollaborationItemArg( - type=CreateCollaborationItemArgTypeField.FOLDER.value, id=folder.id + item=CreateCollaborationItem( + type=CreateCollaborationItemTypeField.FOLDER.value, id=folder.id ), - accessible_by=CreateCollaborationAccessibleByArg( - type=CreateCollaborationAccessibleByArgTypeField.USER.value, - login=user_login, + accessible_by=CreateCollaborationAccessibleBy( + type=CreateCollaborationAccessibleByTypeField.USER.value, login=user_login ), - role=CreateCollaborationRoleArg.EDITOR.value, + role=CreateCollaborationRole.EDITOR.value, ) assert to_string(collaboration.role) == 'editor' collaboration_id: str = collaboration.id @@ -106,7 +105,7 @@ def testExternalUserCollaborations(): updated_collaboration: Collaboration = ( client.user_collaborations.update_collaboration_by_id( collaboration_id=collaboration_id, - role=UpdateCollaborationByIdRoleArg.VIEWER.value, + role=UpdateCollaborationByIdRole.VIEWER.value, ) ) assert to_string(updated_collaboration.role) == 'viewer' diff --git a/test/webhooks.py b/test/webhooks.py index 4af1d70..99ed072 100644 --- a/test/webhooks.py +++ b/test/webhooks.py @@ -6,15 +6,15 @@ from box_sdk_gen.schemas import FolderFull -from box_sdk_gen.managers.folders import CreateFolderParentArg +from box_sdk_gen.managers.folders import CreateFolderParent from box_sdk_gen.schemas import Webhook -from box_sdk_gen.managers.webhooks import CreateWebhookTargetArg +from box_sdk_gen.managers.webhooks import CreateWebhookTarget -from box_sdk_gen.managers.webhooks import CreateWebhookTargetArgTypeField +from box_sdk_gen.managers.webhooks import CreateWebhookTargetTypeField -from box_sdk_gen.managers.webhooks import CreateWebhookTriggersArg +from box_sdk_gen.managers.webhooks import CreateWebhookTriggers from box_sdk_gen.schemas import Webhooks @@ -27,14 +27,14 @@ def testWebhooksCRUD(): folder: FolderFull = client.folders.create_folder( - name=get_uuid(), parent=CreateFolderParentArg(id='0') + name=get_uuid(), parent=CreateFolderParent(id='0') ) webhook: Webhook = client.webhooks.create_webhook( - target=CreateWebhookTargetArg( - id=folder.id, type=CreateWebhookTargetArgTypeField.FOLDER.value + target=CreateWebhookTarget( + id=folder.id, type=CreateWebhookTargetTypeField.FOLDER.value ), address='https://example.com/new-webhook', - triggers=[CreateWebhookTriggersArg.FILE_UPLOADED.value], + triggers=[CreateWebhookTriggers.FILE_UPLOADED.value], ) assert webhook.target.id == folder.id assert to_string(webhook.target.type) == 'folder' diff --git a/test/weblinks.py b/test/weblinks.py index 77536ca..44181d9 100644 --- a/test/weblinks.py +++ b/test/weblinks.py @@ -4,9 +4,9 @@ from box_sdk_gen.schemas import WebLink -from box_sdk_gen.managers.web_links import CreateWebLinkParentArg +from box_sdk_gen.managers.web_links import CreateWebLinkParent -from box_sdk_gen.managers.web_links import UpdateWebLinkByIdSharedLinkArg +from box_sdk_gen.managers.web_links import UpdateWebLinkByIdSharedLink from box_sdk_gen.utils import get_uuid @@ -24,7 +24,7 @@ def test_create_get_delete_weblink(): password: str = 'super-secret-password' weblink: WebLink = client.web_links.create_web_link( url=url, - parent=CreateWebLinkParentArg(id=parent.id), + parent=CreateWebLinkParent(id=parent.id), name=name, description=description, ) @@ -39,7 +39,7 @@ def test_create_get_delete_weblink(): updated_weblink: WebLink = client.web_links.update_web_link_by_id( web_link_id=weblink.id, name=updated_name, - shared_link=UpdateWebLinkByIdSharedLinkArg( + shared_link=UpdateWebLinkByIdSharedLink( access=shared_access, password=password ), ) diff --git a/test/zip_downloads.py b/test/zip_downloads.py index 58b1c6a..02d5752 100644 --- a/test/zip_downloads.py +++ b/test/zip_downloads.py @@ -8,13 +8,13 @@ from box_sdk_gen.utils import ByteStream -from box_sdk_gen.managers.zip_downloads import DownloadZipItemsArg +from box_sdk_gen.managers.zip_downloads import DownloadZipItems -from box_sdk_gen.managers.zip_downloads import DownloadZipItemsArgTypeField +from box_sdk_gen.managers.zip_downloads import DownloadZipItemsTypeField from box_sdk_gen.schemas import ZipDownload -from box_sdk_gen.managers.zip_downloads import CreateZipDownloadItemsArg +from box_sdk_gen.managers.zip_downloads import CreateZipDownloadItems from box_sdk_gen.schemas import ZipDownloadStatus @@ -39,14 +39,10 @@ def testZipDownload(): folder_1: FolderFull = create_new_folder() zip_stream: ByteStream = client.zip_downloads.download_zip( items=[ - DownloadZipItemsArg( - id=file_1.id, type=DownloadZipItemsArgTypeField.FILE.value - ), - DownloadZipItemsArg( - id=file_2.id, type=DownloadZipItemsArgTypeField.FILE.value - ), - DownloadZipItemsArg( - id=folder_1.id, type=DownloadZipItemsArgTypeField.FOLDER.value + DownloadZipItems(id=file_1.id, type=DownloadZipItemsTypeField.FILE.value), + DownloadZipItems(id=file_2.id, type=DownloadZipItemsTypeField.FILE.value), + DownloadZipItems( + id=folder_1.id, type=DownloadZipItemsTypeField.FOLDER.value ), ], download_file_name='zip', @@ -65,14 +61,14 @@ def testManualZipDownloadAndCheckStatus(): folder_1: FolderFull = create_new_folder() zip_download: ZipDownload = client.zip_downloads.create_zip_download( items=[ - CreateZipDownloadItemsArg( - id=file_1.id, type=DownloadZipItemsArgTypeField.FILE.value + CreateZipDownloadItems( + id=file_1.id, type=DownloadZipItemsTypeField.FILE.value ), - CreateZipDownloadItemsArg( - id=file_2.id, type=DownloadZipItemsArgTypeField.FILE.value + CreateZipDownloadItems( + id=file_2.id, type=DownloadZipItemsTypeField.FILE.value ), - CreateZipDownloadItemsArg( - id=folder_1.id, type=DownloadZipItemsArgTypeField.FOLDER.value + CreateZipDownloadItems( + id=folder_1.id, type=DownloadZipItemsTypeField.FOLDER.value ), ], download_file_name='zip',