-# Deprecation notice
+# Box Python SDK Gen
-This version of the Box Python SDK is under maintenance mode, and will be deprecated soon, only critical security updates and bug fixes will be provided. We recommend using the new version Box Python SDK, which can be found at [box/box-python-sdk-gen](https://github.com/box/box-python-sdk-gen)
+[](http://opensource.box.com/badges)
+
+[](https://badge.fury.io/py/box-sdk-gen)
+[](https://pypi.python.org/pypi/box-sdk-gen)
+
+[](https://coveralls.io/github/box/box-python-sdk-gen?branch=main)
-You can find the migration guide [here](https://github.com/box/box-python-sdk-gen/blob/main/migration-guide.md) for transitioning from Box Python SDK v3.x to the new `box-sdk-gen` package. If you have any questions, please create an issue in the new repository or reach out to [Box Developer Support](https://developer.box.com/support/).
+We are excited to introduce the stable release of the latest generation of Box Python SDK, designed to elevate the developer experience and streamline your integration with the Box Content Cloud.
-# Box Python SDK
+With this SDK, you’ll have access to:
-[](http://opensource.box.com/badges)
-[](http://box-python-sdk.readthedocs.org/en/latest)
-[](https://github.com/box/box-python-sdk/actions)
-[](https://pypi.python.org/pypi/boxsdk)
-[](https://pypi.python.org/pypi/boxsdk)
-[](https://coveralls.io/github/box/box-python-sdk?branch=main)
+1. Full API Support: The new generation of Box SDKs empowers developers with complete coverage of the Box API ecosystem. You can now access all the latest features and functionalities offered by Box, allowing you to build even more sophisticated and feature-rich applications.
+2. Rapid API Updates: Say goodbye to waiting for new Box APIs to be incorporated into the SDK. With our new auto-generation development approach, we can now add new Box APIs to the SDK at a much faster pace (in a matter of days). This means you can leverage the most up-to-date features in your applications without delay.
+3. Embedded Documentation: We understand that easy access to information is crucial for developers. With our new approach, we have included comprehensive documentation for all objects and parameters directly in the source code of the SDK. This means you no longer need to look up this information on the developer portal, saving you time and streamlining your development process.
+4. Enhanced Convenience Methods: Our commitment to enhancing your development experience continues with the introduction of convenience methods. These methods cover various aspects such as chunk uploads, classification, and much more.
+5. Seamless Start: The new SDKs integrate essential functionalities like authentication, automatic retries with exponential backoff, exception handling, request cancellation, and type checking, enabling you to focus solely on your application's business logic.
-Getting Started Docs:
+Embrace the new generation of Box SDKs and unlock the full potential of the Box Content Cloud.
+
+# Table of contents
-- [Deprecation notice](#deprecation-notice)
-- [Box Python SDK](#box-python-sdk)
+- [Box Python SDK Gen](#box-python-sdk-gen)
+- [Table of contents](#table-of-contents)
- [Installing](#installing)
- [Getting Started](#getting-started)
-- [Authorization](#authorization)
- - [Server-to-Server Auth with JWT](#server-to-server-auth-with-jwt)
- - [Traditional 3-legged OAuth2](#traditional-3-legged-oauth2)
- - [Get the Authorization URL](#get-the-authorization-url)
- - [Authenticate (Get Access/Refresh Tokens)](#authenticate-get-accessrefresh-tokens)
- - [Create an Authenticated Client](#create-an-authenticated-client)
- - [Instantiate a Client Given an Access and a Refresh Token](#instantiate-a-client-given-an-access-and-a-refresh-token)
- - [Other Auth Options](#other-auth-options)
-- [Usage Documentation](#usage-documentation)
- - [Making API Calls Manually](#making-api-calls-manually)
-- [Other Client Options](#other-client-options)
- - [Logging Client](#logging-client)
- - [Developer Token Client](#developer-token-client)
- - [Development Client](#development-client)
-- [Customization](#customization)
- - [Custom Subclasses](#custom-subclasses)
-- [FIPS 140-2 Compliance](#fips-140-2-compliance)
-- [Versions](#versions)
- - [Supported Version](#supported-version)
- - [Version schedule](#version-schedule)
-- [Contributing](#contributing)
- - [Developer Setup](#developer-setup)
- - [Testing](#testing)
+- [Documentation](#documentation)
+- [Upgrades](#upgrades)
+- [Integration Tests](#integration-tests)
+ - [Running integration tests locally](#running-integration-tests-locally)
+ - [Create Platform Application](#create-platform-application)
+ - [Export configuration](#export-configuration)
+ - [Running tests](#running-tests)
- [Questions, Bugs, and Feature Requests?](#questions-bugs-and-feature-requests)
- [Copyright and License](#copyright-and-license)
@@ -56,431 +46,107 @@ Getting Started Docs:
# Installing
-``` console
-pip install boxsdk
-```
-
-The current version of the SDK is v3.x --- With this release support for
-Python 3.5 and earlier (including 2.x) has been dropped. if you're
-looking for the code or documentation for v1.5.x, please see the [1.5
-branch](https://github.com/box/box-python-sdk/tree/1.5).
-
-# Getting Started
-
-To get started with the SDK, get a Developer Token from the
-Configuration page of your app in the [Box Developer
-Console](https://app.box.com/developers/console). You can use this token
-to make test calls for your own Box account.
-
-The SDK provides an interactive `DevelopmentClient` that makes it easy
-to test out the SDK in a REPL. This client will automatically prompt for
-a new Developer Token when it requires one, and will log HTTP requests
-and responses to aid in debugging and understanding how the SDK makes
-API calls.
-
-``` pycon
->>> from boxsdk import DevelopmentClient
->>> client = DevelopmentClient()
-Enter developer token:
->>> user = client.user().get()
-GET https://api.box.com/2.0/users/me {'headers': {'Authorization': '---wXyZ',
- 'User-Agent': 'box-python-sdk-2.0.0',
- 'X-Box-UA': 'agent=box-python-sdk/2.0.0; env=python/3.6.5'},
-'params': None}
-"GET https://api.box.com/2.0/users/me" 200 454
-{'Date': 'Thu, 01 Nov 2018 23:32:11 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=31536000', 'Cache-Control': 'no-cache, no-store', 'Content-Encoding': 'gzip', 'Vary': 'Accept-Encoding', 'BOX-REQUEST-ID': '0b50luc09ahp56m2jmkla8mgmh2', 'Age': '0'}
-{'address': '',
-'avatar_url': 'https://cloud.app.box.com/api/avatar/large/123456789',
-'created_at': '2012-06-07T11:14:50-07:00',
-'id': '123456789',
-'job_title': '',
-'language': 'en',
-'login': 'user@example.com',
-'max_upload_size': 16106127360,
-'modified_at': '2018-10-30T17:01:27-07:00',
-'name': 'Example User',
-'phone': '',
-'space_amount': 1000000000000000.0,
-'space_used': 14330018065,
-'status': 'active',
-'timezone': 'America/Los_Angeles',
-'type': 'user'}
-
->>> print(f'The current user ID is {user.id}')
-The current user ID is 123456789
-```
-
-Outside of a REPL, you can initialize a new `Client` with just the
-Developer Token to get started.
-
-``` python
-from boxsdk import OAuth2, Client
-
-auth = OAuth2(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- access_token='YOUR_DEVELOPER_TOKEN',
-)
-client = Client(auth)
-
-user = client.user().get()
-print(f'The current user ID is {user.id}')
-```
-
-# Authorization
-
-The Box API uses OAuth2 for auth. The SDK makes it relatively painless
-to work with OAuth2 tokens.
-
-## Server-to-Server Auth with JWT
-
-The Python SDK supports your [JWT
-Authentication](https://developer.box.com/en/guides/authentication/jwt/)
-applications.
-
-Authenticating with a JWT requires some extra dependencies. To get them,
-simply
-
-``` console
-pip install "boxsdk[jwt]"
-```
-
-Instead of instantiating your `Client` with an instance of `OAuth2`,
-instead use an instance of `JWTAuth`.
-
-``` python
-from boxsdk import JWTAuth
-from boxsdk import Client
-
-auth = JWTAuth(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- enterprise_id='YOUR_ENTERPRISE_ID',
- jwt_key_id='YOUR_JWT_KEY_ID',
- rsa_private_key_file_sys_path='CERT.PEM',
- rsa_private_key_passphrase='PASSPHRASE',
-)
-
-access_token = auth.authenticate_instance()
-client = Client(auth)
-```
-
-This client is able to create application users:
-
-``` python
-ned_stark_user = client.create_user('Ned Stark')
-```
-
-These users can then be authenticated:
-
-``` python
-ned_auth = JWTAuth(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- user=ned_stark_user,
- jwt_key_id='YOUR_JWT_KEY_ID',
- rsa_private_key_file_sys_path='CERT.PEM',
- rsa_private_key_passphrase='PASSPHRASE'
-)
-ned_auth.authenticate_user()
-ned_client = Client(ned_auth)
-```
-
-Requests made with `ned_client` (or objects returned from
-`ned_client`'s methods) will be performed on behalf of the newly
-created app user.
-
-## Traditional 3-legged OAuth2
-
-### Get the Authorization URL
-
-``` python
-from boxsdk import OAuth2
-
-oauth = OAuth2(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- store_tokens=your_store_tokens_callback_method,
-)
-
-auth_url, csrf_token = oauth.get_authorization_url('http://YOUR_REDIRECT_URL')
-```
-
-store_tokens is a callback used to store the access token and refresh
-token. You might want to define something like this:
-
-``` python
-def store_tokens(access_token, refresh_token):
- # store the tokens at secure storage (e.g. Keychain)
-```
-
-The SDK will keep the tokens in memory for the duration of the Python
-script run, so you don't always need to pass store_tokens.
-
-### Authenticate (Get Access/Refresh Tokens)
-
-If you navigate the user to the auth_url, the user will eventually get
-redirected to . After
-getting the code, you will be able to use the code to exchange for an
-access token and refresh token.
-
-The SDK handles all the work for you; all you need to do is run:
-
-``` python
-# Make sure that the csrf token you get from the `state` parameter
-# in the final redirect URI is the same token you get from the
-# get_authorization_url method.
-assert 'THE_CSRF_TOKEN_YOU_GOT' == csrf_token
-access_token, refresh_token = oauth.authenticate('YOUR_AUTH_CODE')
-```
-
-### Create an Authenticated Client
-
-``` python
-from boxsdk import Client
-
-client = Client(oauth)
-```
-
-And that's it! You can start using the client to do all kinds of cool
-stuff and the SDK will handle the token refresh for you automatically.
-
-### Instantiate a Client Given an Access and a Refresh Token
-
-Alternatively, you can instantiate an OAuth2 object with the access
-token and refresh token. Once you have an oauth object you can pass that
-into the Client object to instantiate a client and begin making calls.
-
-``` python
-from boxsdk import Client, OAuth2
-
-oauth = OAuth2(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- access_token='ACCESS_TOKEN',
- refresh_token='REFRESH_TOKEN',
-)
-
-client = Client(oauth)
-user = client.user().get()
-```
-
-This will retrieve the current user! From here you can use the client
-you created to start making calls.
-
-## Other Auth Options
-
-For advanced uses of the SDK, three additional auth classes are
-provided:
-
-- `CooperativelyManagedOAuth2`: Allows multiple auth instances to
- share tokens.
-- `RemoteOAuth2`: Allows use of the SDK on clients without access to
- your application's client secret. Instead, you provide a
- `retrieve_access_token` callback. That callback should perform the
- token refresh, perhaps on your server that does have access to the
- client secret.
-- `RedisManagedOAuth2`: Stores access and refresh tokens in Redis.
- This allows multiple processes (possibly spanning multiple machines)
- to share access tokens while synchronizing token refresh. This could
- be useful for a multiprocess web server, for example.
-
-# Usage Documentation
-
-Full documentation of the available functionality with example code is
-available in the [SDK documentation
-pages](https://github.com/box/box-python-sdk/blob/main/docs/usage), and
-there is also method-level documentation available on
-[ReadTheDocs](https://box-python-sdk.readthedocs.io/en/stable/index.html).
-
-## Making API Calls Manually
-
-The Box API is continually evolving. As such, there are API endpoints
-available that are not specifically supported by the SDK. You can still
-use these endpoints by using the `make_request` method of the `Client`.
-
-``` python
-# https://developer.box.com/en/reference/get-metadata-templates-id/
-# Returns a Python dictionary containing the result of the API request
-json_response = client.make_request(
- 'GET',
- client.get_url('metadata_templates', 'enterprise', 'customer', 'schema'),
-).json()
-```
-
-`make_request()` takes two parameters:
-
-- `method` - an HTTP verb like `GET` or `POST`
-- `url` - the URL of the requested API endpoint
-
-The `Client` class and Box objects have a `get_url` method. Pass it an
-endpoint to get the correct URL for use with that object and endpoint.
-
-For API calls which require body or query params, you can use `**kwargs`
-to pass extra params:
-
-- `data` - takes a jsonified dictionary of body parameters
-- `params` - takes a dictionary of query parameters
-
-``` python
-# https://developer.box.com/reference/post-folders/
-# Creates a new folder
-
-# JSONify the body
-body = json.dumps({
- 'name': 'test-subfolder',
- 'parent': {
- 'id': '0',
- }
-})
-
-client.make_request(
- 'POST',
- client.get_url('folders'),
- params={'fields': 'name,id'},
- data=body
-)
+```console
+pip install box-sdk-gen
```
-# Other Client Options
-
-## Logging Client
+This is autogenerated Box SDK version.
+Supported Python versions are Python 3.8 and above.
-For more insight into the network calls the SDK is making, you can use
-the `LoggingClient` class. This class logs information about network
-requests and responses made to the Box API.
+To install also extra dependencies required for JWT authentication, use command:
-``` pycon
->>> from boxsdk import LoggingClient
->>> client = LoggingClient()
->>> client.user().get()
-GET https://api.box.com/2.0/users/me {'headers': {u'Authorization': u'Bearer ---------------------------kBjp',
- u'User-Agent': u'box-python-sdk-1.5.0'},
- 'params': None}
-{"type":"user","id":"..","name":"Jeffrey Meadows","login":"..",..}
-
+```console
+pip install "box-sdk-gen[jwt]"
```
-## Developer Token Client
-
-The Box Developer Console allows for the creation of short-lived
-developer tokens. The SDK makes it easy to use these tokens. Use the
-`get_new_token_callback` parameter to control how the client will get
-new developer tokens as needed. The default is to prompt standard input
-for a token.
-
-## Development Client
-
-For exploring the Box API, or to quickly get going using the SDK, the
-`DevelopmentClient` class combines the `LoggingClient` with the
-`DeveloperTokenClient`.
-
-# Customization
+# Getting Started
-## Custom Subclasses
+To get started with the SDK, get a Developer Token from the Configuration page of your app in the [Box Developer
+Console](https://app.box.com/developers/console). You can use this token to make test calls for your own Box account.
-Custom object subclasses can be defined:
+The SDK provides an `BoxDeveloperTokenAuth` class, which allows you to authenticate using your Developer Token.
+Use instance of `BoxDeveloperTokenAuth` to initialize `BoxClient` object.
+Using `BoxClient` object you can access managers, which allow you to perform some operations on your Box account.
-``` pycon
-from boxsdk import Client
-from boxsdk import Folder
+The example below demonstrates how to authenticate with Developer Token and print names of all items inside a root folder.
-class MyFolderSubclass(Folder):
- pass
+```python
+from box_sdk_gen import BoxClient, BoxDeveloperTokenAuth
-client = Client(oauth)
-client.translator.register('folder', MyFolderSubclass)
-folder = client.folder('0')
+def main(token: str):
+ auth: BoxDeveloperTokenAuth = BoxDeveloperTokenAuth(token=token)
+ client: BoxClient = BoxClient(auth=auth)
+ for item in client.folders.get_folder_items('0').entries:
+ print(item.name)
->>> print folder
->>>
+if __name__ == '__main__':
+ main('INSERT YOUR DEVELOPER TOKEN HERE')
```
-If an object subclass is registered in this way, instances of this
-subclass will be returned from all SDK methods that previously returned
-an instance of the parent. See `BaseAPIJSONObjectMeta` and `Translator`
-to see how the SDK performs dynamic lookups to determine return types.
-
-# FIPS 140-2 Compliance
-
-The Python SDK allows the use of FIPS 140-2 validated SSL libraries, such as OpenSSL 3.0.
-However, some actions are required to enable this functionality.
-
-Currently, the latest distributions of Python default to OpenSSL v1.1.1, which is not FIPS compliant.
-Therefore, if you want to use OpenSSL 3.0 in your network communication,
-you need to ensure that Python uses a custom SSL library.
-One way to achieve this is by creating a custom Python distribution with the ssl module replaced.
+# Documentation
-If you are using JWT for authentication, it is also necessary to ensure that the cryptography library,
-which is one of the extra dependencies for JWT, uses OpenSSL 3.0.
-To enable FIPS mode for the `cryptography` library, you need to install a FIPS-compliant version of OpenSSL
-during the installation process of cryptography using the `pip` command.
+Browse the [docs](docs/README.md) or see [API Reference](https://developer.box.com/reference/) for more information.
-# Versions
-We use a modified version of [Semantic Versioning](https://semver.org/) for all changes. See [version strategy](VERSIONS.md) for details which is effective from 30 July 2022.
+# Upgrades
-## Supported Version
+Upgrading from our legacy SDKs to the new generation SDKs is a straightforward process. See our [migration guide](migration-guide.md) and [changelog](CHANGELOG.md) for more information.
-Only the current MAJOR version of SDK is supported. New features, functionality, bug fixes, and security updates will only be added to the current MAJOR version.
+# Integration Tests
-A current release is on the leading edge of our SDK development, and is intended for customers who are in active development and want the latest and greatest features. Instead of stating a release date for a new feature, we set a fixed minor or patch release cadence of maximum 2-3 months (while we may release more often). At the same time, there is no schedule for major or breaking release. Instead, we will communicate one quarter in advance the upcoming breaking change to allow customers to plan for the upgrade. We always recommend that all users run the latest available minor release for whatever major version is in use. We highly recommend upgrading to the latest SDK major release at the earliest convenient time and before the EOL date.
+## Running integration tests locally
-## Version schedule
+### Create Platform Application
-| Version | Supported Environments | State | First Release | EOL/Terminated |
-|---------|---------------------------------------------------------|-----------|---------------|----------------|
-| 3 | Python 3.6+ | Supported | 17 Jan 2022 | TBD |
-| 2 | | EOL | 01 Nov 2018 | 17 Jan 2022 |
-| 1 | | EOL | 10 Feb 2015 | 01 Nov 2018 |
+To run integration tests locally you will need a `Custom App` created in the [Box Developer
+Console](https://app.box.com/developers/console)
+with `Server Authentication (with JWT)` selected as authentication method.
+Once created you can edit properties of the application:
-# Contributing
+- In section `App Access Level` select `App + Enterprise Access`. You can enable all `Application Scopes`.
+- In section `Advanced Features` enable `Make API calls using the as-user header` and `Generate user access tokens`.
-See
-[CONTRIBUTING.md](https://github.com/box/box-python-sdk/blob/main/CONTRIBUTING.md).
+Now select `Authorization` and submit application to be reviewed by account admin.
-## Developer Setup
+### Export configuration
-Create a virtual environment and install packages -
+1. Select `Configuration` tab and in the bottom in the section `App Settings`
+ download your app configuration settings as JSON.
+2. Encode configuration file to Base64, e.g. using command: `base64 -i path_to_json_file`
+3. Set environment variable: `JWT_CONFIG_BASE_64` with base64 encoded jwt configuration file
+4. Set environment variable: `BOX_FILE_REQUEST_ID` with ID of file request already created in the user account, `BOX_EXTERNAL_USER_EMAIL` with email of free external user which not belongs to any enterprise.
+5. Set environment variable: `WORKFLOW_FOLDER_ID` with the ID of the Relay workflow that deletes the file that triggered the workflow. The workflow should have a manual start to be able to start it from the API.
+6. Set environment variable: `APP_ITEM_ASSOCIATION_FILE_ID` to the ID of the file with associated app item and `APP_ITEM_ASSOCIATION_FOLDER_ID` to the ID of the folder with associated app item.
+7. Set environment variable: `APP_ITEM_SHARED_LINK` to the shared link associated with app item.
+8. Set environment variable: `SLACK_AUTOMATION_USER_ID` to the ID of the user responsible for the Slack automation, `SLACK_ORG_ID` to the ID of the Slack organization and `SLACK_PARTNER_ITEM_ID` to the ID of the Slack partner item.
-``` console
-mkvirtualenv boxsdk
-pip install -r requirements-dev.txt
-```
-
-## Testing
-
-Run all tests using -
-
-``` console
-tox
-```
+### Running tests
-The tox tests include code style checks via pep8 and pylint.
+To run integration tests locally:
-The tox tests are configured to run on Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13.
+1. `pip install -r requirements-test.txt`
+2. `pytest`
# Questions, Bugs, and Feature Requests?
Need to contact us directly? [Browse the issues
-tickets](https://github.com/box/box-python-sdk/issues)! Or, if that
+tickets](https://github.com/box/box-python-sdk-gen/issues)! Or, if that
doesn't work, [file a new
-one](https://github.com/box/box-python-sdk/issues/new) and we will get
+one](https://github.com/box/box-python-sdk-gen/issues/new) and we will get
back to you. If you have general questions about the Box API, you can
-post to the [Box Developer
-Forum](https://community.box.com/t5/Developer-Forum/bd-p/DeveloperForum).
+post to the [Box Developer Forum](https://forum.box.com/).
# Copyright and License
- Copyright 2019 Box, Inc. All rights reserved.
+Copyright 2023 Box, Inc. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/VERSIONS.md b/VERSIONS.md
index 41fde357a..45c972031 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -1,5 +1,6 @@
# Version Lifecycle
-We use a modified version of [Semantic Versioning](https://semver.org/) for all changes. It is strongly encouraged that you pin at least the major version and potentially the minor version to avoid pulling in breaking changes. Increasing the major version of an SDK indicates that this SDK underwent significant and substantial changes to support new idioms and patterns in the language. Major versions are introduced when public interfaces (e.g. classes, methods, types, etc.), behaviours, or semantics have changed.
+
+We use a modified version of [Semantic Versioning](https://semver.org/) for all changes. It is strongly encouraged that you pin at least the major version and potentially the minor version to avoid pulling in breaking changes. Increasing the major version of an SDK indicates that this SDK underwent significant and substantial changes to support new idioms and patterns in the language. Major versions are introduced when public interfaces (e.g. classes, methods, types, etc.), behaviours, or semantics have changed.
Semantic Versions take the form of `MAJOR.MINOR.PATCH`.
@@ -11,13 +12,13 @@ The MAJOR version is used to indicate the family of technology represented by th
New MAJOR versions will be communicated in advance via:
-* An email announcement is sent to affected accounts, announcing our plans to end support for the specific SDK version. The email will outline the path to end-of-support, specify the campaign timelines, and provide upgrade guidance.
-* Box SDK documentation, such as API reference documentation, user guides, SDK product marketing pages, and GitHub readme(s) are updated to indicate the campaign timeline and provide guidance on upgrading affected applications.
-* Deprecation warnings are added to the SDKs, outlining the path to end-of-support and linking to the SDK documentation.
+- An email announcement is sent to affected accounts, announcing our plans to end support for the specific SDK version. The email will outline the path to end-of-support, specify the campaign timelines, and provide upgrade guidance.
+- Box SDK documentation, such as API reference documentation, user guides, SDK product marketing pages, and GitHub readme(s) are updated to indicate the campaign timeline and provide guidance on upgrading affected applications.
+- Deprecation warnings are added to the SDKs, outlining the path to end-of-support and linking to the SDK documentation.
Deprecations are introduced in minor releases. We will not introduce new deprecations in patch releases. These deprecations will preserve the existing behaviour while emitting a warning that provide guidance on:
-* How to achieve similar behaviour if an alternative is available
-* The version in which the deprecation will be enforced.
+- How to achieve similar behaviour if an alternative is available
+- The version in which the deprecation will be enforced.
Deprecations will only be enforced in major releases. For example, if a behaviour is deprecated in version 1.2.0, it will continue to work, with a warning, for all releases in the 1.x series. The behaviour will change and the deprecation will be removed in the next major release (2.x.x).
diff --git a/box_sdk_gen/__init__.py b/box_sdk_gen/__init__.py
new file mode 100644
index 000000000..6b93cb29f
--- /dev/null
+++ b/box_sdk_gen/__init__.py
@@ -0,0 +1,15 @@
+from box_sdk_gen.box import *
+
+from box_sdk_gen.serialization import *
+
+from box_sdk_gen.internal import *
+
+from box_sdk_gen.networking import *
+
+from box_sdk_gen.schemas import *
+
+from box_sdk_gen.parameters import *
+
+from box_sdk_gen.managers import *
+
+from box_sdk_gen.client import *
diff --git a/box_sdk_gen/box/__init__.py b/box_sdk_gen/box/__init__.py
new file mode 100644
index 000000000..78c141131
--- /dev/null
+++ b/box_sdk_gen/box/__init__.py
@@ -0,0 +1,11 @@
+from box_sdk_gen.box.errors import *
+
+from box_sdk_gen.box.token_storage import *
+
+from box_sdk_gen.box.developer_token_auth import *
+
+from box_sdk_gen.box.oauth import *
+
+from box_sdk_gen.box.jwt_auth import *
+
+from box_sdk_gen.box.ccg_auth import *
diff --git a/box_sdk_gen/box/ccg_auth.py b/box_sdk_gen/box/ccg_auth.py
new file mode 100644
index 000000000..f4dbd05a8
--- /dev/null
+++ b/box_sdk_gen/box/ccg_auth.py
@@ -0,0 +1,236 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenGrantTypeField
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenSubjectTokenTypeField
+
+from box_sdk_gen.schemas.access_token import AccessToken
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenBoxSubjectTypeField
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.box.token_storage import TokenStorage
+
+from box_sdk_gen.box.token_storage import InMemoryTokenStorage
+
+from box_sdk_gen.managers.authorization import AuthorizationManager
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2Token
+
+from box_sdk_gen.schemas.post_o_auth_2_revoke import PostOAuth2Revoke
+
+
+class CCGConfig:
+ def __init__(
+ self,
+ client_id: str,
+ client_secret: str,
+ *,
+ enterprise_id: Optional[str] = None,
+ user_id: Optional[str] = None,
+ token_storage: TokenStorage = None
+ ):
+ """
+ :param client_id: Box API key used for identifying the application the user is authenticating with
+ :type client_id: str
+ :param client_secret: Box API secret used for making auth requests.
+ :type client_secret: str
+ :param enterprise_id: The ID of the Box Developer Edition enterprise., defaults to None
+ :type enterprise_id: Optional[str], optional
+ :param user_id: The user id to authenticate. This value is not required. But if it is provided, then the user will be auto-authenticated at the time of the first API call., defaults to None
+ :type user_id: Optional[str], optional
+ :param token_storage: Object responsible for storing token. If no custom implementation provided,the token will be stored in memory., defaults to None
+ :type token_storage: TokenStorage, optional
+ """
+ if token_storage is None:
+ token_storage = InMemoryTokenStorage()
+ self.client_id = client_id
+ self.client_secret = client_secret
+ self.enterprise_id = enterprise_id
+ self.user_id = user_id
+ self.token_storage = token_storage
+
+
+class BoxCCGAuth(Authentication):
+ def __init__(self, config: CCGConfig, **kwargs):
+ """
+ :param config: Configuration object of Client Credentials Grant auth.
+ :type config: CCGConfig
+ """
+ super().__init__(**kwargs)
+ self.config = config
+ self.token_storage = self.config.token_storage
+ self.subject_id = (
+ self.config.user_id
+ if not self.config.user_id == None
+ else self.config.enterprise_id
+ )
+ self.subject_type = (
+ PostOAuth2TokenBoxSubjectTypeField.USER
+ if not self.config.user_id == None
+ else PostOAuth2TokenBoxSubjectTypeField.ENTERPRISE
+ )
+
+ def refresh_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Get a new access token using CCG auth
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ token: AccessToken = auth_manager.request_access_token(
+ PostOAuth2TokenGrantTypeField.CLIENT_CREDENTIALS,
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ box_subject_type=self.subject_type,
+ box_subject_id=self.subject_id,
+ )
+ self.token_storage.store(token)
+ return token
+
+ def retrieve_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Return a current token or get a new one when not available.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ old_token: Optional[AccessToken] = self.token_storage.get()
+ if old_token == None:
+ new_token: AccessToken = self.refresh_token(network_session=network_session)
+ return new_token
+ return old_token
+
+ def retrieve_authorization_header(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> str:
+ token: AccessToken = self.retrieve_token(network_session=network_session)
+ return ''.join(['Bearer ', token.access_token])
+
+ def with_user_subject(
+ self, user_id: str, *, token_storage: TokenStorage = None
+ ) -> 'BoxCCGAuth':
+ """
+ Create a new BoxCCGAuth instance that uses the provided user ID as the subject ID.
+
+ May be one of this application's created App User. Depending on the configured User Access Level, may also be any other App User or Managed User in the enterprise.
+
+
+
+
+
+
+
+ :param user_id: The id of the user to authenticate
+ :type user_id: str
+ :param token_storage: Object responsible for storing token in newly created BoxCCGAuth. If no custom implementation provided, the token will be stored in memory., defaults to None
+ :type token_storage: TokenStorage, optional
+ """
+ if token_storage is None:
+ token_storage = InMemoryTokenStorage()
+ new_config: CCGConfig = CCGConfig(
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ enterprise_id=self.config.enterprise_id,
+ user_id=user_id,
+ token_storage=token_storage,
+ )
+ return BoxCCGAuth(config=new_config)
+
+ def with_enterprise_subject(
+ self, enterprise_id: str, *, token_storage: TokenStorage = None
+ ) -> 'BoxCCGAuth':
+ """
+ Create a new BoxCCGAuth instance that uses the provided enterprise ID as the subject ID.
+ :param enterprise_id: The id of the enterprise to authenticate
+ :type enterprise_id: str
+ :param token_storage: Object responsible for storing token in newly created BoxCCGAuth. If no custom implementation provided, the token will be stored in memory., defaults to None
+ :type token_storage: TokenStorage, optional
+ """
+ if token_storage is None:
+ token_storage = InMemoryTokenStorage()
+ new_config: CCGConfig = CCGConfig(
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ enterprise_id=enterprise_id,
+ user_id=None,
+ token_storage=token_storage,
+ )
+ return BoxCCGAuth(config=new_config)
+
+ def downscope_token(
+ self,
+ scopes: List[str],
+ *,
+ resource: Optional[str] = None,
+ shared_link: Optional[str] = None,
+ network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Downscope access token to the provided scopes. Returning a new access token with the provided scopes, with the original access token unchanged.
+ :param scopes: The scope(s) to apply to the resulting token.
+ :type scopes: List[str]
+ :param resource: The file or folder to get a downscoped token for. If None and shared_link None, the resulting token will not be scoped down to just a single item. The resource should be a full URL to an item, e.g. https://api.box.com/2.0/files/123456., defaults to None
+ :type resource: Optional[str], optional
+ :param shared_link: The shared link to get a downscoped token for. If None and item None, the resulting token will not be scoped down to just a single item., defaults to None
+ :type shared_link: Optional[str], optional
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ token: Optional[AccessToken] = self.retrieve_token(
+ network_session=network_session
+ )
+ if token == None:
+ raise BoxSDKError(
+ message='No access token is available. Make an API call to retrieve a token before calling this method.'
+ )
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ downscoped_token: AccessToken = auth_manager.request_access_token(
+ PostOAuth2TokenGrantTypeField.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE,
+ subject_token=token.access_token,
+ subject_token_type=PostOAuth2TokenSubjectTokenTypeField.URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN,
+ resource=resource,
+ scope=' '.join(scopes),
+ box_shared_link=shared_link,
+ )
+ return downscoped_token
+
+ def revoke_token(self, *, network_session: Optional[NetworkSession] = None) -> None:
+ """
+ Revoke the current access token and remove it from token storage.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ old_token: Optional[AccessToken] = self.token_storage.get()
+ if old_token == None:
+ return None
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ auth_manager.revoke_access_token(
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ token=old_token.access_token,
+ )
+ self.token_storage.clear()
+ return None
diff --git a/box_sdk_gen/box/developer_token_auth.py b/box_sdk_gen/box/developer_token_auth.py
new file mode 100644
index 000000000..8c803c8a4
--- /dev/null
+++ b/box_sdk_gen/box/developer_token_auth.py
@@ -0,0 +1,139 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenGrantTypeField
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenSubjectTokenTypeField
+
+from box_sdk_gen.schemas.access_token import AccessToken
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.box.token_storage import TokenStorage
+
+from box_sdk_gen.box.token_storage import InMemoryTokenStorage
+
+from box_sdk_gen.managers.authorization import AuthorizationManager
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2Token
+
+from box_sdk_gen.schemas.post_o_auth_2_revoke import PostOAuth2Revoke
+
+
+class DeveloperTokenConfig:
+ def __init__(
+ self, *, client_id: Optional[str] = None, client_secret: Optional[str] = None
+ ):
+ self.client_id = client_id
+ self.client_secret = client_secret
+
+
+class BoxDeveloperTokenAuth(Authentication):
+ def __init__(self, token: str, *, config: DeveloperTokenConfig = None, **kwargs):
+ """
+ :param config: Configuration object of DeveloperTokenAuth., defaults to None
+ :type config: DeveloperTokenConfig, optional
+ """
+ super().__init__(**kwargs)
+ self.token = token
+ self.config = config
+ self.token_storage = InMemoryTokenStorage(
+ token=AccessToken(access_token=self.token)
+ )
+
+ def retrieve_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Retrieves stored developer token
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ token: Optional[AccessToken] = self.token_storage.get()
+ if token == None:
+ raise BoxSDKError(message='No access token is available.')
+ return token
+
+ def refresh_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Developer token cannot be refreshed
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ raise BoxSDKError(
+ message='Developer token has expired. Please provide a new one.'
+ )
+
+ def retrieve_authorization_header(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> str:
+ token: AccessToken = self.retrieve_token(network_session=network_session)
+ return ''.join(['Bearer ', token.access_token])
+
+ def revoke_token(self, *, network_session: Optional[NetworkSession] = None) -> None:
+ """
+ Revoke an active Access Token, effectively logging a user out that has been previously authenticated.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ token: Optional[AccessToken] = self.token_storage.get()
+ if token == None:
+ return None
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ auth_manager.revoke_access_token(
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ token=token.access_token,
+ )
+ self.token_storage.clear()
+ return None
+
+ def downscope_token(
+ self,
+ scopes: List[str],
+ *,
+ resource: Optional[str] = None,
+ shared_link: Optional[str] = None,
+ network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Downscope access token to the provided scopes. Returning a new access token with the provided scopes, with the original access token unchanged.
+ :param scopes: The scope(s) to apply to the resulting token.
+ :type scopes: List[str]
+ :param resource: The file or folder to get a downscoped token for. If None and shared_link None, the resulting token will not be scoped down to just a single item. The resource should be a full URL to an item, e.g. https://api.box.com/2.0/files/123456., defaults to None
+ :type resource: Optional[str], optional
+ :param shared_link: The shared link to get a downscoped token for. If None and item None, the resulting token will not be scoped down to just a single item., defaults to None
+ :type shared_link: Optional[str], optional
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ token: Optional[AccessToken] = self.retrieve_token(
+ network_session=network_session
+ )
+ if token == None or token.access_token == None:
+ raise BoxSDKError(message='No access token is available.')
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ downscoped_token: AccessToken = auth_manager.request_access_token(
+ PostOAuth2TokenGrantTypeField.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE,
+ subject_token=token.access_token,
+ subject_token_type=PostOAuth2TokenSubjectTokenTypeField.URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN,
+ resource=resource,
+ scope=' '.join(scopes),
+ box_shared_link=shared_link,
+ )
+ return downscoped_token
diff --git a/box_sdk_gen/box/errors.py b/box_sdk_gen/box/errors.py
new file mode 100644
index 000000000..b1baf3d72
--- /dev/null
+++ b/box_sdk_gen/box/errors.py
@@ -0,0 +1,136 @@
+import pprint
+from datetime import datetime
+from typing import Any, Dict, Optional
+
+from ..internal.logging import DataSanitizer
+from ..internal.errors import GeneratedCodeError
+
+
+class BoxSDKError(GeneratedCodeError):
+ def __init__(
+ self,
+ message: str,
+ timestamp: Optional[datetime] = None,
+ error: Optional[Exception] = None,
+ **kwargs,
+ ):
+ super().__init__(message, **kwargs)
+ self.name = 'BoxSDKError'
+ self.message = message
+ self.timestamp = timestamp if timestamp is not None else datetime.now()
+ self.error = error
+
+ def __str__(self):
+ return ''.join(
+ (
+ f'\nTimestamp: {self.timestamp}',
+ f'\nUnderlying error: {self.error}',
+ f'\nMessage: {self.message}',
+ )
+ )
+
+
+class RequestInfo:
+ def __init__(
+ self,
+ method: str,
+ url: str,
+ query_params: Dict[str, str],
+ headers: Dict[str, str],
+ body: Optional[str] = None,
+ ):
+ self.method = method
+ self.url = url
+ self.query_params = query_params
+ self.headers = headers
+ self.body = body
+
+ def print(self, data_sanitizer: DataSanitizer):
+ return ''.join(
+ (
+ f'\n\tMethod: {self.method}',
+ f'\n\tURL: {self.url}',
+ f'\n\tQuery params: \n{pprint.pformat(self.query_params, indent=8)}',
+ f'\n\tHeaders: \n{pprint.pformat(data_sanitizer.sanitize_headers(self.headers), indent=8)}',
+ ''.join(
+ [
+ '\n\tBody: ',
+ '\n' if self.body else '',
+ pprint.pformat(self.body, indent=8),
+ ]
+ ),
+ )
+ )
+
+
+class ResponseInfo:
+ def __init__(
+ self,
+ status_code: int,
+ headers: Dict[str, str],
+ body: Dict = None,
+ raw_body: Optional[str] = None,
+ code: Optional[str] = None,
+ context_info: Optional[Dict[str, Any]] = None,
+ request_id: Optional[str] = None,
+ help_url: Optional[str] = None,
+ ):
+ self.status_code = status_code
+ self.headers = headers
+ self.body = body
+ self.raw_body = raw_body
+ self.code = code
+ self.context_info = context_info
+ self.request_id = request_id
+ self.help_url = help_url
+
+ def print(self, data_sanitizer: DataSanitizer):
+ return ''.join(
+ (
+ f'\n\tStatus code: {self.status_code}',
+ f'\n\tHeaders: \n{pprint.pformat(data_sanitizer.sanitize_headers(self.headers), indent=8)}',
+ f'\n\tCode: {self.code}',
+ f'\n\tContext Info: \n{pprint.pformat(self.context_info, indent=8)}',
+ f'\n\tRequest Id: {self.request_id}',
+ f'\n\tHelp Url: {self.help_url}',
+ ''.join(
+ [
+ '\n\tBody: ',
+ '\n' if self.body else '',
+ pprint.pformat(
+ data_sanitizer.sanitize_body(self.body), indent=8
+ ),
+ ]
+ ),
+ )
+ )
+
+
+class BoxAPIError(BoxSDKError):
+ def __init__(
+ self,
+ request_info: RequestInfo,
+ response_info: ResponseInfo,
+ message: str,
+ timestamp: Optional[datetime] = None,
+ error: Optional[str] = None,
+ *,
+ data_sanitizer: DataSanitizer = None,
+ **kwargs,
+ ):
+ super().__init__(message=message, timestamp=timestamp, error=error, **kwargs)
+ if data_sanitizer is None:
+ data_sanitizer = DataSanitizer()
+ self.name = 'BoxAPIError'
+ self.request_info = request_info
+ self.response_info = response_info
+ self.data_sanitizer = data_sanitizer
+
+ def __str__(self):
+ return ''.join(
+ [
+ f'\t{super(BoxAPIError, self).__str__()}',
+ f'\nRequest: {self.request_info.print(self.data_sanitizer)}',
+ f'\nResponse: {self.response_info.print(self.data_sanitizer)}',
+ ]
+ )
diff --git a/box_sdk_gen/box/jwt_auth.py b/box_sdk_gen/box/jwt_auth.py
new file mode 100644
index 000000000..0040f7da9
--- /dev/null
+++ b/box_sdk_gen/box/jwt_auth.py
@@ -0,0 +1,478 @@
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from box_sdk_gen.serialization.json import deserialize
+
+from typing import List
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenGrantTypeField
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenSubjectTokenTypeField
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.schemas.access_token import AccessToken
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2Token
+
+from box_sdk_gen.schemas.post_o_auth_2_revoke import PostOAuth2Revoke
+
+from box_sdk_gen.box.token_storage import TokenStorage
+
+from box_sdk_gen.box.token_storage import InMemoryTokenStorage
+
+from box_sdk_gen.serialization.json import json_to_serialized_data
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import get_uuid
+
+from box_sdk_gen.internal.utils import read_text_from_file
+
+from box_sdk_gen.internal.utils import is_browser
+
+from box_sdk_gen.internal.utils import get_epoch_time_in_seconds
+
+from box_sdk_gen.internal.utils import create_jwt_assertion
+
+from box_sdk_gen.internal.utils import JwtSignOptions
+
+from box_sdk_gen.internal.utils import JwtKey
+
+from box_sdk_gen.internal.utils import JwtAlgorithm
+
+from box_sdk_gen.internal.utils import PrivateKeyDecryptor
+
+from box_sdk_gen.internal.utils import DefaultPrivateKeyDecryptor
+
+from box_sdk_gen.managers.authorization import AuthorizationManager
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class JwtConfigAppSettingsAppAuth(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'public_key_id': 'publicKeyID',
+ 'private_key': 'privateKey',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'publicKeyID': 'public_key_id',
+ 'privateKey': 'private_key',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(self, public_key_id: str, private_key: str, passphrase: str, **kwargs):
+ """
+ :param public_key_id: Public key ID
+ :type public_key_id: str
+ :param private_key: Private key
+ :type private_key: str
+ :param passphrase: Passphrase
+ :type passphrase: str
+ """
+ super().__init__(**kwargs)
+ self.public_key_id = public_key_id
+ self.private_key = private_key
+ self.passphrase = passphrase
+
+
+class JwtConfigAppSettings(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'client_id': 'clientID',
+ 'client_secret': 'clientSecret',
+ 'app_auth': 'appAuth',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'clientID': 'client_id',
+ 'clientSecret': 'client_secret',
+ 'appAuth': 'app_auth',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ client_id: str,
+ client_secret: str,
+ app_auth: JwtConfigAppSettingsAppAuth,
+ **kwargs
+ ):
+ """
+ :param client_id: App client ID
+ :type client_id: str
+ :param client_secret: App client secret
+ :type client_secret: str
+ :param app_auth: App auth settings
+ :type app_auth: JwtConfigAppSettingsAppAuth
+ """
+ super().__init__(**kwargs)
+ self.client_id = client_id
+ self.client_secret = client_secret
+ self.app_auth = app_auth
+
+
+class JwtConfigFile(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'enterprise_id': 'enterpriseID',
+ 'user_id': 'userID',
+ 'box_app_settings': 'boxAppSettings',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'enterpriseID': 'enterprise_id',
+ 'userID': 'user_id',
+ 'boxAppSettings': 'box_app_settings',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ box_app_settings: JwtConfigAppSettings,
+ *,
+ enterprise_id: Optional[str] = None,
+ user_id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param box_app_settings: App settings
+ :type box_app_settings: JwtConfigAppSettings
+ :param enterprise_id: Enterprise ID, defaults to None
+ :type enterprise_id: Optional[str], optional
+ :param user_id: User ID, defaults to None
+ :type user_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.box_app_settings = box_app_settings
+ self.enterprise_id = enterprise_id
+ self.user_id = user_id
+
+
+class JWTConfig:
+ def __init__(
+ self,
+ client_id: str,
+ client_secret: str,
+ jwt_key_id: str,
+ private_key: str,
+ private_key_passphrase: str,
+ *,
+ enterprise_id: Optional[str] = None,
+ user_id: Optional[str] = None,
+ algorithm: Optional[JwtAlgorithm] = JwtAlgorithm.RS256,
+ token_storage: TokenStorage = None,
+ private_key_decryptor: PrivateKeyDecryptor = None
+ ):
+ """
+ :param client_id: App client ID
+ :type client_id: str
+ :param client_secret: App client secret
+ :type client_secret: str
+ :param jwt_key_id: Public key ID
+ :type jwt_key_id: str
+ :param private_key: Private key
+ :type private_key: str
+ :param private_key_passphrase: Passphrase
+ :type private_key_passphrase: str
+ :param enterprise_id: Enterprise ID, defaults to None
+ :type enterprise_id: Optional[str], optional
+ :param user_id: User ID, defaults to None
+ :type user_id: Optional[str], optional
+ """
+ if token_storage is None:
+ token_storage = InMemoryTokenStorage()
+ if private_key_decryptor is None:
+ private_key_decryptor = DefaultPrivateKeyDecryptor()
+ self.client_id = client_id
+ self.client_secret = client_secret
+ self.jwt_key_id = jwt_key_id
+ self.private_key = private_key
+ self.private_key_passphrase = private_key_passphrase
+ self.enterprise_id = enterprise_id
+ self.user_id = user_id
+ self.algorithm = algorithm
+ self.token_storage = token_storage
+ self.private_key_decryptor = private_key_decryptor
+
+ @staticmethod
+ def from_config_json_string(
+ config_json_string: str,
+ *,
+ token_storage: Optional[TokenStorage] = None,
+ private_key_decryptor: Optional[PrivateKeyDecryptor] = None
+ ) -> 'JWTConfig':
+ """
+ Create an auth instance as defined by a string content of JSON file downloaded from the Box Developer Console.
+
+ See https://developer.box.com/en/guides/authentication/jwt/ for more information.
+
+ :param config_json_string: String content of JSON file containing the configuration.
+ :type config_json_string: str
+ :param token_storage: Object responsible for storing token. If no custom implementation provided, the token will be stored in memory, defaults to None
+ :type token_storage: Optional[TokenStorage], optional
+ :param private_key_decryptor: Object responsible for decrypting private key for jwt auth. If no custom implementation provided, the DefaultPrivateKeyDecryptor will be used., defaults to None
+ :type private_key_decryptor: Optional[PrivateKeyDecryptor], optional
+ """
+ config_json: JwtConfigFile = deserialize(
+ json_to_serialized_data(config_json_string), JwtConfigFile
+ )
+ token_storage_to_use: Optional[TokenStorage] = (
+ InMemoryTokenStorage() if token_storage == None else token_storage
+ )
+ private_key_decryptor_to_use: Optional[PrivateKeyDecryptor] = (
+ DefaultPrivateKeyDecryptor()
+ if private_key_decryptor == None
+ else private_key_decryptor
+ )
+ new_config: 'JWTConfig' = JWTConfig(
+ client_id=config_json.box_app_settings.client_id,
+ client_secret=config_json.box_app_settings.client_secret,
+ enterprise_id=config_json.enterprise_id,
+ user_id=config_json.user_id,
+ jwt_key_id=config_json.box_app_settings.app_auth.public_key_id,
+ private_key=config_json.box_app_settings.app_auth.private_key,
+ private_key_passphrase=config_json.box_app_settings.app_auth.passphrase,
+ token_storage=token_storage_to_use,
+ private_key_decryptor=private_key_decryptor_to_use,
+ )
+ return new_config
+
+ @staticmethod
+ def from_config_file(
+ config_file_path: str,
+ *,
+ token_storage: Optional[TokenStorage] = None,
+ private_key_decryptor: Optional[PrivateKeyDecryptor] = None
+ ) -> 'JWTConfig':
+ """
+ Create an auth instance as defined by a JSON file downloaded from the Box Developer Console.
+
+ See https://developer.box.com/en/guides/authentication/jwt/ for more information.
+
+ :param config_file_path: Path to the JSON file containing the configuration.
+ :type config_file_path: str
+ :param token_storage: Object responsible for storing token. If no custom implementation provided, the token will be stored in memory., defaults to None
+ :type token_storage: Optional[TokenStorage], optional
+ :param private_key_decryptor: Object responsible for decrypting private key for jwt auth. If no custom implementation provided, the DefaultPrivateKeyDecryptor will be used., defaults to None
+ :type private_key_decryptor: Optional[PrivateKeyDecryptor], optional
+ """
+ config_json_string: str = read_text_from_file(config_file_path)
+ return JWTConfig.from_config_json_string(
+ config_json_string,
+ token_storage=token_storage,
+ private_key_decryptor=private_key_decryptor,
+ )
+
+
+class BoxJWTAuth(Authentication):
+ def __init__(self, config: JWTConfig, **kwargs):
+ """
+ :param config: An object containing all JWT configuration to use for authentication
+ :type config: JWTConfig
+ """
+ super().__init__(**kwargs)
+ self.config = config
+ self.token_storage = self.config.token_storage
+ self.subject_id = (
+ self.config.enterprise_id
+ if not self.config.enterprise_id == None
+ else self.config.user_id
+ )
+ self.subject_type = (
+ 'enterprise' if not self.config.enterprise_id == None else 'user'
+ )
+
+ def refresh_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Get new access token using JWT auth.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ if is_browser():
+ raise BoxSDKError(
+ message='JWT auth is not supported in browser environment.'
+ )
+ alg: JwtAlgorithm = (
+ self.config.algorithm
+ if not self.config.algorithm == None
+ else JwtAlgorithm.RS256
+ )
+ claims: Dict = {
+ 'exp': get_epoch_time_in_seconds() + 30,
+ 'box_sub_type': self.subject_type,
+ }
+ jwt_options: JwtSignOptions = JwtSignOptions(
+ algorithm=alg,
+ audience='https://api.box.com/oauth2/token',
+ subject=self.subject_id,
+ issuer=self.config.client_id,
+ jwtid=get_uuid(),
+ keyid=self.config.jwt_key_id,
+ private_key_decryptor=self.config.private_key_decryptor,
+ )
+ jwt_key: JwtKey = JwtKey(
+ key=self.config.private_key, passphrase=self.config.private_key_passphrase
+ )
+ assertion: str = create_jwt_assertion(claims, jwt_key, jwt_options)
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ token: AccessToken = auth_manager.request_access_token(
+ PostOAuth2TokenGrantTypeField.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_JWT_BEARER,
+ assertion=assertion,
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ )
+ self.token_storage.store(token)
+ return token
+
+ def retrieve_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Get the current access token. If the current access token is expired or not found, this method will attempt to refresh the token.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ old_token: Optional[AccessToken] = self.token_storage.get()
+ if old_token == None:
+ new_token: AccessToken = self.refresh_token(network_session=network_session)
+ return new_token
+ return old_token
+
+ def retrieve_authorization_header(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> str:
+ token: AccessToken = self.retrieve_token(network_session=network_session)
+ return ''.join(['Bearer ', token.access_token])
+
+ def with_user_subject(
+ self, user_id: str, *, token_storage: TokenStorage = None
+ ) -> 'BoxJWTAuth':
+ """
+ Create a new BoxJWTAuth instance that uses the provided user ID as the subject of the JWT assertion.
+
+ May be one of this application's created App User. Depending on the configured User Access Level, may also be any other App User or Managed User in the enterprise.
+
+
+
+
+
+
+
+ :param user_id: The id of the user to authenticate
+ :type user_id: str
+ :param token_storage: Object responsible for storing token in newly created BoxJWTAuth. If no custom implementation provided, the token will be stored in memory., defaults to None
+ :type token_storage: TokenStorage, optional
+ """
+ if token_storage is None:
+ token_storage = InMemoryTokenStorage()
+ new_config: JWTConfig = JWTConfig(
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ enterprise_id=None,
+ user_id=user_id,
+ jwt_key_id=self.config.jwt_key_id,
+ private_key=self.config.private_key,
+ private_key_passphrase=self.config.private_key_passphrase,
+ token_storage=token_storage,
+ )
+ new_auth: 'BoxJWTAuth' = BoxJWTAuth(config=new_config)
+ return new_auth
+
+ def with_enterprise_subject(
+ self, enterprise_id: str, *, token_storage: TokenStorage = None
+ ) -> 'BoxJWTAuth':
+ """
+ Create a new BoxJWTAuth instance that uses the provided enterprise ID as the subject of the JWT assertion.
+ :param enterprise_id: The id of the enterprise to authenticate
+ :type enterprise_id: str
+ :param token_storage: Object responsible for storing token in newly created BoxJWTAuth. If no custom implementation provided, the token will be stored in memory., defaults to None
+ :type token_storage: TokenStorage, optional
+ """
+ if token_storage is None:
+ token_storage = InMemoryTokenStorage()
+ new_config: JWTConfig = JWTConfig(
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ enterprise_id=enterprise_id,
+ user_id=None,
+ jwt_key_id=self.config.jwt_key_id,
+ private_key=self.config.private_key,
+ private_key_passphrase=self.config.private_key_passphrase,
+ token_storage=token_storage,
+ )
+ new_auth: 'BoxJWTAuth' = BoxJWTAuth(config=new_config)
+ return new_auth
+
+ def downscope_token(
+ self,
+ scopes: List[str],
+ *,
+ resource: Optional[str] = None,
+ shared_link: Optional[str] = None,
+ network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Downscope access token to the provided scopes. Returning a new access token with the provided scopes, with the original access token unchanged.
+ :param scopes: The scope(s) to apply to the resulting token.
+ :type scopes: List[str]
+ :param resource: The file or folder to get a downscoped token for. If None and shared_link None, the resulting token will not be scoped down to just a single item. The resource should be a full URL to an item, e.g. https://api.box.com/2.0/files/123456., defaults to None
+ :type resource: Optional[str], optional
+ :param shared_link: The shared link to get a downscoped token for. If None and item None, the resulting token will not be scoped down to just a single item., defaults to None
+ :type shared_link: Optional[str], optional
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ token: Optional[AccessToken] = self.retrieve_token(
+ network_session=network_session
+ )
+ if token == None:
+ raise BoxSDKError(
+ message='No access token is available. Make an API call to retrieve a token before calling this method.'
+ )
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ downscoped_token: AccessToken = auth_manager.request_access_token(
+ PostOAuth2TokenGrantTypeField.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE,
+ subject_token=token.access_token,
+ subject_token_type=PostOAuth2TokenSubjectTokenTypeField.URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN,
+ resource=resource,
+ scope=' '.join(scopes),
+ box_shared_link=shared_link,
+ )
+ return downscoped_token
+
+ def revoke_token(self, *, network_session: Optional[NetworkSession] = None) -> None:
+ """
+ Revoke the current access token and remove it from token storage.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ old_token: Optional[AccessToken] = self.token_storage.get()
+ if old_token == None:
+ return None
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ auth_manager.revoke_access_token(
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ token=old_token.access_token,
+ )
+ self.token_storage.clear()
+ return None
diff --git a/box_sdk_gen/box/oauth.py b/box_sdk_gen/box/oauth.py
new file mode 100644
index 000000000..1c62ead04
--- /dev/null
+++ b/box_sdk_gen/box/oauth.py
@@ -0,0 +1,250 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.serialization.json import serialize
+
+from typing import List
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenGrantTypeField
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenSubjectTokenTypeField
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.schemas.access_token import AccessToken
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2Token
+
+from box_sdk_gen.schemas.post_o_auth_2_revoke import PostOAuth2Revoke
+
+from box_sdk_gen.managers.authorization import AuthorizationManager
+
+from box_sdk_gen.box.token_storage import TokenStorage
+
+from box_sdk_gen.box.token_storage import InMemoryTokenStorage
+
+from box_sdk_gen.serialization.json import sd_to_url_params
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class OAuthConfig:
+ def __init__(
+ self, client_id: str, client_secret: str, *, token_storage: TokenStorage = None
+ ):
+ if token_storage is None:
+ token_storage = InMemoryTokenStorage()
+ self.client_id = client_id
+ self.client_secret = client_secret
+ self.token_storage = token_storage
+
+
+class GetAuthorizeUrlOptions:
+ def __init__(
+ self,
+ *,
+ client_id: Optional[str] = None,
+ redirect_uri: Optional[str] = None,
+ response_type: Optional[str] = None,
+ state: Optional[str] = None,
+ scope: Optional[str] = None
+ ):
+ """
+ :param client_id: Box API key used for identifying the application the user is authenticating with, defaults to None
+ :type client_id: Optional[str], optional
+ :param redirect_uri: The URI to which Box redirects the browser after the user has granted or denied the application permission. This URI match one of the redirect URIs in the configuration of your application., defaults to None
+ :type redirect_uri: Optional[str], optional
+ :param response_type: The type of response we would like to receive., defaults to None
+ :type response_type: Optional[str], optional
+ :param state: 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., defaults to None
+ :type state: Optional[str], optional
+ :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., defaults to None
+ :type scope: Optional[str], optional
+ """
+ self.client_id = client_id
+ self.redirect_uri = redirect_uri
+ self.response_type = response_type
+ self.state = state
+ self.scope = scope
+
+
+class BoxOAuth(Authentication):
+ def __init__(self, config: OAuthConfig, **kwargs):
+ """
+ :param config: Configuration object of OAuth.
+ :type config: OAuthConfig
+ """
+ super().__init__(**kwargs)
+ self.config = config
+ self.token_storage = self.config.token_storage
+
+ def get_authorize_url(self, *, options: GetAuthorizeUrlOptions = None) -> str:
+ """
+ Get the authorization URL for the app user.
+ """
+ if options is None:
+ options = GetAuthorizeUrlOptions()
+ params_map: Dict[str, str] = prepare_params(
+ {
+ 'client_id': (
+ options.client_id
+ if not options.client_id == None
+ else self.config.client_id
+ ),
+ 'response_type': (
+ options.response_type
+ if not options.response_type == None
+ else 'code'
+ ),
+ 'redirect_uri': options.redirect_uri,
+ 'state': options.state,
+ 'scope': options.scope,
+ }
+ )
+ return ''.join(
+ [
+ 'https://account.box.com/api/oauth2/authorize?',
+ sd_to_url_params(serialize(params_map)),
+ ]
+ )
+
+ def get_tokens_authorization_code_grant(
+ self,
+ authorization_code: str,
+ *,
+ network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Acquires token info using an authorization code.
+ :param authorization_code: The authorization code to use to get tokens.
+ :type authorization_code: str
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ token: AccessToken = auth_manager.request_access_token(
+ PostOAuth2TokenGrantTypeField.AUTHORIZATION_CODE,
+ code=authorization_code,
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ )
+ self.token_storage.store(token)
+ return token
+
+ def retrieve_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Get the current access token. If the current access token is expired or not found, this method will attempt to refresh the token.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ token: Optional[AccessToken] = self.token_storage.get()
+ if token == None:
+ raise BoxSDKError(
+ message='Access and refresh tokens not available. Authenticate before making any API call first.'
+ )
+ return token
+
+ def refresh_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Get a new access token for the platform app user.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ old_token: Optional[AccessToken] = self.token_storage.get()
+ token_used_for_refresh: Optional[str] = (
+ old_token.refresh_token if not old_token == None else None
+ )
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ token: AccessToken = auth_manager.request_access_token(
+ PostOAuth2TokenGrantTypeField.REFRESH_TOKEN,
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ refresh_token=token_used_for_refresh,
+ )
+ self.token_storage.store(token)
+ return token
+
+ def retrieve_authorization_header(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> str:
+ token: AccessToken = self.retrieve_token(network_session=network_session)
+ return ''.join(['Bearer ', token.access_token])
+
+ def revoke_token(self, *, network_session: Optional[NetworkSession] = None) -> None:
+ """
+ Revoke an active Access Token, effectively logging a user out that has been previously authenticated.
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ token: Optional[AccessToken] = self.token_storage.get()
+ if token == None:
+ return None
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ auth_manager.revoke_access_token(
+ client_id=self.config.client_id,
+ client_secret=self.config.client_secret,
+ token=token.access_token,
+ )
+ return None
+
+ def downscope_token(
+ self,
+ scopes: List[str],
+ *,
+ resource: Optional[str] = None,
+ shared_link: Optional[str] = None,
+ network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ """
+ Downscope access token to the provided scopes. Returning a new access token with the provided scopes, with the original access token unchanged.
+ :param scopes: The scope(s) to apply to the resulting token.
+ :type scopes: List[str]
+ :param resource: The file or folder to get a downscoped token for. If None and shared_link None, the resulting token will not be scoped down to just a single item. The resource should be a full URL to an item, e.g. https://api.box.com/2.0/files/123456., defaults to None
+ :type resource: Optional[str], optional
+ :param shared_link: The shared link to get a downscoped token for. If None and item None, the resulting token will not be scoped down to just a single item., defaults to None
+ :type shared_link: Optional[str], optional
+ :param network_session: An object to keep network session state, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ """
+ token: Optional[AccessToken] = self.retrieve_token(
+ network_session=network_session
+ )
+ if token == None or token.access_token == None:
+ raise BoxSDKError(message='No access token is available.')
+ auth_manager: AuthorizationManager = AuthorizationManager(
+ network_session=(
+ network_session if not network_session == None else NetworkSession()
+ )
+ )
+ downscoped_token: AccessToken = auth_manager.request_access_token(
+ PostOAuth2TokenGrantTypeField.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE,
+ subject_token=token.access_token,
+ subject_token_type=PostOAuth2TokenSubjectTokenTypeField.URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN,
+ resource=resource,
+ scope=' '.join(scopes),
+ box_shared_link=shared_link,
+ )
+ return downscoped_token
diff --git a/box_sdk_gen/box/token_storage.py b/box_sdk_gen/box/token_storage.py
new file mode 100644
index 000000000..5b4d2e4b7
--- /dev/null
+++ b/box_sdk_gen/box/token_storage.py
@@ -0,0 +1,74 @@
+import shelve
+from abc import abstractmethod
+from typing import Optional
+
+from ..schemas.access_token import AccessToken
+
+
+class TokenStorage:
+ @abstractmethod
+ def store(self, token: AccessToken) -> None:
+ pass
+
+ @abstractmethod
+ def get(self) -> Optional[AccessToken]:
+ pass
+
+ @abstractmethod
+ def clear(self) -> None:
+ pass
+
+
+class InMemoryTokenStorage(TokenStorage):
+ def __init__(self, token: Optional[AccessToken] = None):
+ self._token = token
+
+ def store(self, token: AccessToken) -> None:
+ self._token = token
+
+ def get(self) -> Optional[AccessToken]:
+ return self._token
+
+ def clear(self) -> None:
+ self._token = None
+
+
+class FileTokenStorage(TokenStorage):
+ def __init__(self, filename: str = 'token_storage'):
+ self.filename = filename
+
+ def store(self, token: AccessToken) -> None:
+ with shelve.open(self.filename) as file:
+ file['token'] = token
+
+ def get(self) -> Optional[AccessToken]:
+ with shelve.open(self.filename) as file:
+ return file.get('token', None)
+
+ def clear(self) -> None:
+ with shelve.open(self.filename) as file:
+ if 'token' in file:
+ del file['token']
+
+
+class FileWithInMemoryCacheTokenStorage(TokenStorage):
+ def __init__(self, filename: str = 'token_storage'):
+ self.filename = filename
+ self.cached_token: Optional[AccessToken] = None
+
+ def store(self, token: AccessToken) -> None:
+ with shelve.open(self.filename) as file:
+ file['token'] = token
+ self.cached_token = token
+
+ def get(self) -> Optional[AccessToken]:
+ if self.cached_token is None:
+ with shelve.open(self.filename) as file:
+ self.cached_token = file.get('token', None)
+ return self.cached_token
+
+ def clear(self) -> None:
+ with shelve.open(self.filename) as file:
+ if 'token' in file:
+ del file['token']
+ self.cached_token = None
diff --git a/box_sdk_gen/client.py b/box_sdk_gen/client.py
new file mode 100644
index 000000000..b49eebb45
--- /dev/null
+++ b/box_sdk_gen/client.py
@@ -0,0 +1,530 @@
+from typing import Dict
+
+from box_sdk_gen.managers.authorization import AuthorizationManager
+
+from box_sdk_gen.managers.files import FilesManager
+
+from box_sdk_gen.managers.trashed_files import TrashedFilesManager
+
+from box_sdk_gen.managers.app_item_associations import AppItemAssociationsManager
+
+from box_sdk_gen.managers.downloads import DownloadsManager
+
+from box_sdk_gen.managers.uploads import UploadsManager
+
+from box_sdk_gen.managers.chunked_uploads import ChunkedUploadsManager
+
+from box_sdk_gen.managers.list_collaborations import ListCollaborationsManager
+
+from box_sdk_gen.managers.comments import CommentsManager
+
+from box_sdk_gen.managers.tasks import TasksManager
+
+from box_sdk_gen.managers.file_versions import FileVersionsManager
+
+from box_sdk_gen.managers.file_metadata import FileMetadataManager
+
+from box_sdk_gen.managers.file_classifications import FileClassificationsManager
+
+from box_sdk_gen.managers.skills import SkillsManager
+
+from box_sdk_gen.managers.file_watermarks import FileWatermarksManager
+
+from box_sdk_gen.managers.file_requests import FileRequestsManager
+
+from box_sdk_gen.managers.folders import FoldersManager
+
+from box_sdk_gen.managers.trashed_folders import TrashedFoldersManager
+
+from box_sdk_gen.managers.folder_metadata import FolderMetadataManager
+
+from box_sdk_gen.managers.folder_classifications import FolderClassificationsManager
+
+from box_sdk_gen.managers.trashed_items import TrashedItemsManager
+
+from box_sdk_gen.managers.folder_watermarks import FolderWatermarksManager
+
+from box_sdk_gen.managers.folder_locks import FolderLocksManager
+
+from box_sdk_gen.managers.metadata_templates import MetadataTemplatesManager
+
+from box_sdk_gen.managers.classifications import ClassificationsManager
+
+from box_sdk_gen.managers.metadata_cascade_policies import (
+ MetadataCascadePoliciesManager,
+)
+
+from box_sdk_gen.managers.search import SearchManager
+
+from box_sdk_gen.managers.user_collaborations import UserCollaborationsManager
+
+from box_sdk_gen.managers.task_assignments import TaskAssignmentsManager
+
+from box_sdk_gen.managers.shared_links_files import SharedLinksFilesManager
+
+from box_sdk_gen.managers.shared_links_folders import SharedLinksFoldersManager
+
+from box_sdk_gen.managers.web_links import WebLinksManager
+
+from box_sdk_gen.managers.trashed_web_links import TrashedWebLinksManager
+
+from box_sdk_gen.managers.shared_links_web_links import SharedLinksWebLinksManager
+
+from box_sdk_gen.managers.shared_links_app_items import SharedLinksAppItemsManager
+
+from box_sdk_gen.managers.users import UsersManager
+
+from box_sdk_gen.managers.session_termination import SessionTerminationManager
+
+from box_sdk_gen.managers.avatars import AvatarsManager
+
+from box_sdk_gen.managers.transfer import TransferManager
+
+from box_sdk_gen.managers.email_aliases import EmailAliasesManager
+
+from box_sdk_gen.managers.memberships import MembershipsManager
+
+from box_sdk_gen.managers.invites import InvitesManager
+
+from box_sdk_gen.managers.groups import GroupsManager
+
+from box_sdk_gen.managers.webhooks import WebhooksManager
+
+from box_sdk_gen.managers.events import EventsManager
+
+from box_sdk_gen.managers.collections import CollectionsManager
+
+from box_sdk_gen.managers.recent_items import RecentItemsManager
+
+from box_sdk_gen.managers.retention_policies import RetentionPoliciesManager
+
+from box_sdk_gen.managers.retention_policy_assignments import (
+ RetentionPolicyAssignmentsManager,
+)
+
+from box_sdk_gen.managers.legal_hold_policies import LegalHoldPoliciesManager
+
+from box_sdk_gen.managers.legal_hold_policy_assignments import (
+ LegalHoldPolicyAssignmentsManager,
+)
+
+from box_sdk_gen.managers.file_version_retentions import FileVersionRetentionsManager
+
+from box_sdk_gen.managers.file_version_legal_holds import FileVersionLegalHoldsManager
+
+from box_sdk_gen.managers.shield_information_barriers import (
+ ShieldInformationBarriersManager,
+)
+
+from box_sdk_gen.managers.shield_information_barrier_reports import (
+ ShieldInformationBarrierReportsManager,
+)
+
+from box_sdk_gen.managers.shield_information_barrier_segments import (
+ ShieldInformationBarrierSegmentsManager,
+)
+
+from box_sdk_gen.managers.shield_information_barrier_segment_members import (
+ ShieldInformationBarrierSegmentMembersManager,
+)
+
+from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import (
+ ShieldInformationBarrierSegmentRestrictionsManager,
+)
+
+from box_sdk_gen.managers.device_pinners import DevicePinnersManager
+
+from box_sdk_gen.managers.terms_of_services import TermsOfServicesManager
+
+from box_sdk_gen.managers.terms_of_service_user_statuses import (
+ TermsOfServiceUserStatusesManager,
+)
+
+from box_sdk_gen.managers.collaboration_allowlist_entries import (
+ CollaborationAllowlistEntriesManager,
+)
+
+from box_sdk_gen.managers.collaboration_allowlist_exempt_targets import (
+ CollaborationAllowlistExemptTargetsManager,
+)
+
+from box_sdk_gen.managers.storage_policies import StoragePoliciesManager
+
+from box_sdk_gen.managers.storage_policy_assignments import (
+ StoragePolicyAssignmentsManager,
+)
+
+from box_sdk_gen.managers.zip_downloads import ZipDownloadsManager
+
+from box_sdk_gen.managers.sign_requests import SignRequestsManager
+
+from box_sdk_gen.managers.workflows import WorkflowsManager
+
+from box_sdk_gen.managers.sign_templates import SignTemplatesManager
+
+from box_sdk_gen.managers.integration_mappings import IntegrationMappingsManager
+
+from box_sdk_gen.managers.ai import AiManager
+
+from box_sdk_gen.managers.ai_studio import AiStudioManager
+
+from box_sdk_gen.managers.docgen_template import DocgenTemplateManager
+
+from box_sdk_gen.managers.docgen import DocgenManager
+
+from box_sdk_gen.managers.hubs import HubsManager
+
+from box_sdk_gen.managers.hub_collaborations import HubCollaborationsManager
+
+from box_sdk_gen.managers.hub_items import HubItemsManager
+
+from box_sdk_gen.managers.shield_lists import ShieldListsManager
+
+from box_sdk_gen.managers.archives import ArchivesManager
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.networking.base_urls import BaseUrls
+
+from box_sdk_gen.networking.proxy_config import ProxyConfig
+
+
+class BoxClient:
+ def __init__(self, auth: Authentication, *, network_session: NetworkSession = None):
+ if network_session is None:
+ network_session = NetworkSession(base_urls=BaseUrls())
+ self.auth = auth
+ self.network_session = network_session
+ self.authorization = AuthorizationManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.files = FilesManager(auth=self.auth, network_session=self.network_session)
+ self.trashed_files = TrashedFilesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.app_item_associations = AppItemAssociationsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.downloads = DownloadsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.uploads = UploadsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.chunked_uploads = ChunkedUploadsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.list_collaborations = ListCollaborationsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.comments = CommentsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.tasks = TasksManager(auth=self.auth, network_session=self.network_session)
+ self.file_versions = FileVersionsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.file_metadata = FileMetadataManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.file_classifications = FileClassificationsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.skills = SkillsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.file_watermarks = FileWatermarksManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.file_requests = FileRequestsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.folders = FoldersManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.trashed_folders = TrashedFoldersManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.folder_metadata = FolderMetadataManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.folder_classifications = FolderClassificationsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.trashed_items = TrashedItemsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.folder_watermarks = FolderWatermarksManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.folder_locks = FolderLocksManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.metadata_templates = MetadataTemplatesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.classifications = ClassificationsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.metadata_cascade_policies = MetadataCascadePoliciesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.search = SearchManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.user_collaborations = UserCollaborationsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.task_assignments = TaskAssignmentsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.shared_links_files = SharedLinksFilesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.shared_links_folders = SharedLinksFoldersManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.web_links = WebLinksManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.trashed_web_links = TrashedWebLinksManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.shared_links_web_links = SharedLinksWebLinksManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.shared_links_app_items = SharedLinksAppItemsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.users = UsersManager(auth=self.auth, network_session=self.network_session)
+ self.session_termination = SessionTerminationManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.avatars = AvatarsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.transfer = TransferManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.email_aliases = EmailAliasesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.memberships = MembershipsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.invites = InvitesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.groups = GroupsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.webhooks = WebhooksManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.events = EventsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.collections = CollectionsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.recent_items = RecentItemsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.retention_policies = RetentionPoliciesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.retention_policy_assignments = RetentionPolicyAssignmentsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.legal_hold_policies = LegalHoldPoliciesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.legal_hold_policy_assignments = LegalHoldPolicyAssignmentsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.file_version_retentions = FileVersionRetentionsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.file_version_legal_holds = FileVersionLegalHoldsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.shield_information_barriers = ShieldInformationBarriersManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.shield_information_barrier_reports = (
+ ShieldInformationBarrierReportsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ )
+ self.shield_information_barrier_segments = (
+ ShieldInformationBarrierSegmentsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ )
+ self.shield_information_barrier_segment_members = (
+ ShieldInformationBarrierSegmentMembersManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ )
+ self.shield_information_barrier_segment_restrictions = (
+ ShieldInformationBarrierSegmentRestrictionsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ )
+ self.device_pinners = DevicePinnersManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.terms_of_services = TermsOfServicesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.terms_of_service_user_statuses = TermsOfServiceUserStatusesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.collaboration_allowlist_entries = CollaborationAllowlistEntriesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.collaboration_allowlist_exempt_targets = (
+ CollaborationAllowlistExemptTargetsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ )
+ self.storage_policies = StoragePoliciesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.storage_policy_assignments = StoragePolicyAssignmentsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.zip_downloads = ZipDownloadsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.sign_requests = SignRequestsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.workflows = WorkflowsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.sign_templates = SignTemplatesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.integration_mappings = IntegrationMappingsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.ai = AiManager(auth=self.auth, network_session=self.network_session)
+ self.ai_studio = AiStudioManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.docgen_template = DocgenTemplateManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.docgen = DocgenManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.hubs = HubsManager(auth=self.auth, network_session=self.network_session)
+ self.hub_collaborations = HubCollaborationsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.hub_items = HubItemsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.shield_lists = ShieldListsManager(
+ auth=self.auth, network_session=self.network_session
+ )
+ self.archives = ArchivesManager(
+ auth=self.auth, network_session=self.network_session
+ )
+
+ def make_request(self, fetch_options: FetchOptions) -> FetchResponse:
+ """
+ Make a custom http request using the client authentication and network session.
+ :param fetch_options: Options to be passed to the fetch call
+ :type fetch_options: FetchOptions
+ """
+ auth: Authentication = (
+ self.auth if fetch_options.auth == None else fetch_options.auth
+ )
+ network_session: NetworkSession = (
+ self.network_session
+ if fetch_options.network_session == None
+ else fetch_options.network_session
+ )
+ enriched_fetch_options: FetchOptions = FetchOptions(
+ auth=auth,
+ network_session=network_session,
+ url=fetch_options.url,
+ method=fetch_options.method,
+ params=fetch_options.params,
+ headers=fetch_options.headers,
+ data=fetch_options.data,
+ file_stream=fetch_options.file_stream,
+ multipart_data=fetch_options.multipart_data,
+ content_type=fetch_options.content_type,
+ response_format=fetch_options.response_format,
+ follow_redirects=fetch_options.follow_redirects,
+ )
+ return network_session.network_client.fetch(enriched_fetch_options)
+
+ def with_as_user_header(self, user_id: str) -> 'BoxClient':
+ """
+ Create a new client to impersonate user with the provided ID. All calls made with the new client will be made in context of the impersonated user, leaving the original client unmodified.
+ :param user_id: ID of an user to impersonate
+ :type user_id: str
+ """
+ return BoxClient(
+ auth=self.auth,
+ network_session=self.network_session.with_additional_headers(
+ {'As-User': user_id}
+ ),
+ )
+
+ def with_suppressed_notifications(self) -> 'BoxClient':
+ """
+ Create a new client with suppressed notifications. Calls made with the new client will not trigger email or webhook notifications
+ """
+ return BoxClient(
+ auth=self.auth,
+ network_session=self.network_session.with_additional_headers(
+ {'Box-Notifications': 'off'}
+ ),
+ )
+
+ def with_extra_headers(
+ self, *, extra_headers: Dict[str, str] = None
+ ) -> 'BoxClient':
+ """
+ Create a new client with a custom set of headers that will be included in every API call
+ :param extra_headers: Custom set of headers that will be included in every API call, defaults to None
+ :type extra_headers: Dict[str, str], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ return 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),
+ )
+
+ def with_proxy(self, config: ProxyConfig) -> 'BoxClient':
+ """
+ Create a new client with a custom proxy that will be used for every API call
+ """
+ return BoxClient(
+ auth=self.auth, network_session=self.network_session.with_proxy(config)
+ )
diff --git a/box_sdk_gen/internal/__init__.py b/box_sdk_gen/internal/__init__.py
new file mode 100644
index 000000000..af3032fc6
--- /dev/null
+++ b/box_sdk_gen/internal/__init__.py
@@ -0,0 +1,9 @@
+from box_sdk_gen.internal.utils import *
+
+from box_sdk_gen.internal.logging import *
+
+from box_sdk_gen.internal.errors import *
+
+from box_sdk_gen.internal.base_object import *
+
+from box_sdk_gen.internal.null_value import *
diff --git a/box_sdk_gen/internal/base_object.py b/box_sdk_gen/internal/base_object.py
new file mode 100644
index 000000000..47c407323
--- /dev/null
+++ b/box_sdk_gen/internal/base_object.py
@@ -0,0 +1,165 @@
+from datetime import datetime, date
+from enum import EnumMeta, Enum
+from typing import get_args, get_origin, Union, Optional
+from .null_value import NullValue
+
+
+class BaseObject:
+ _discriminator = (None, {})
+ _json_to_fields_mapping = {}
+ _fields_to_json_mapping = {}
+
+ def __init__(self, **kwargs):
+ self._raw_data: dict = {}
+ self.__dict__.update(kwargs)
+
+ @classmethod
+ def from_dict(cls, data: dict):
+ unpacked_attributes = {}
+ for key, value in data.items():
+ mapping_field_name = cls._json_to_fields_mapping.get(key, key)
+ annotation = cls.__init__.__annotations__.get(mapping_field_name, None)
+ unpacked_attributes[mapping_field_name] = cls._deserialize(
+ key, value, annotation
+ )
+ return cls(**unpacked_attributes)
+
+ @property
+ def raw_data(self):
+ """
+ Returns the raw json representation returned by the API
+ :return: dict with the raw json data
+ """
+ return self._raw_data
+
+ def to_dict(self) -> dict:
+ result_dict = {}
+ for k, v in vars(self).items():
+ # Skip private and protected attributes
+ if k.startswith("_"):
+ continue
+ if v is None:
+ continue
+ if isinstance(v, NullValue):
+ value = None
+ elif type(v) is list:
+ value = [
+ item.to_dict() if isinstance(item, BaseObject) else item
+ for item in v
+ ]
+ elif type(v) is dict:
+ value = {
+ key: value.to_dict() if isinstance(value, BaseObject) else value
+ for key, value in v.items()
+ }
+ elif isinstance(v, BaseObject):
+ value = v.to_dict()
+ elif isinstance(v, Enum):
+ value = v.value
+ elif isinstance(v, date):
+ value = v.isoformat()
+ elif isinstance(v, datetime):
+ value = v.isoformat().replace('+00:00', 'Z')
+ else:
+ value = v
+ result_dict[self._fields_to_json_mapping.get(k, k)] = value
+
+ return result_dict
+
+ @classmethod
+ def _deserialize(cls, key, value, annotation=None):
+ if annotation is None or value is None:
+ return value
+ if get_origin(annotation) == Optional:
+ return cls._deserialize(key, value, get_args(annotation))
+ if get_origin(annotation) == Union:
+ union_without_none_type = [
+ arg for arg in get_args(annotation) if arg is not type(None)
+ ]
+ if len(union_without_none_type) == 1:
+ return cls._deserialize(key, value, union_without_none_type[0])
+
+ if get_origin(annotation) == list:
+ return cls._deserialize_list(key, value, annotation)
+ elif get_origin(annotation) == Union:
+ return cls._deserialize_union(key, value, annotation)
+ elif isinstance(annotation, EnumMeta):
+ return cls._deserialize_enum(key, value, annotation)
+ elif annotation == datetime:
+ return cls._deserialize_datetime(key, value, annotation)
+ elif annotation == date:
+ return cls._deserialize_date(key, value, annotation)
+ elif isinstance(annotation, type) and issubclass(annotation, BaseObject):
+ return cls._deserialize_nested_type(key, value, annotation)
+ else:
+ return value
+
+ @classmethod
+ def _deserialize_list(cls, key, value, annotation: list):
+ try:
+ list_type = get_args(annotation)[0]
+ return [
+ cls._deserialize(key, list_entry, list_type) for list_entry in value
+ ]
+ except Exception:
+ return value
+
+ @classmethod
+ def _deserialize_union(cls, key, value, annotation):
+ try:
+ possible_types = get_args(annotation)
+ if value is None:
+ if type(None) not in possible_types:
+ print(
+ 'Value: ', value, 'should not be allowed in Union:', annotation
+ )
+ return value
+
+ for possible_type in possible_types:
+ if (
+ isinstance(possible_type, type)
+ and issubclass(possible_type, BaseObject)
+ and value.get(possible_type._discriminator[0], None)
+ in possible_type._discriminator[1]
+ ):
+ return cls._deserialize(key, value, possible_type)
+
+ for possible_type in possible_types:
+ try:
+ return cls._deserialize(key, value, possible_type)
+ except Exception:
+ continue
+ return value
+ except Exception:
+ return value
+
+ @classmethod
+ def _deserialize_enum(cls, key, value, annotation):
+ try:
+ return getattr(annotation, value.upper().replace(' ', '_'))
+ except Exception:
+ return value
+
+ @classmethod
+ def _deserialize_datetime(cls, key, value, annotation):
+ try:
+ return datetime.fromisoformat(value.replace('Z', '+00:00'))
+ except Exception:
+ return value
+
+ @classmethod
+ def _deserialize_date(cls, key, value, annotation):
+ try:
+ return date.fromisoformat(value)
+ except Exception:
+ return value
+
+ @classmethod
+ def _deserialize_nested_type(cls, key, value, annotation):
+ try:
+ return annotation.from_dict(value)
+ except Exception:
+ return value
+
+ def __repr__(self) -> str:
+ return f'{self.__class__} {self.to_dict()}'
diff --git a/box_sdk_gen/internal/errors.py b/box_sdk_gen/internal/errors.py
new file mode 100644
index 000000000..856fd6a38
--- /dev/null
+++ b/box_sdk_gen/internal/errors.py
@@ -0,0 +1,6 @@
+class GeneratedCodeError(Exception):
+ def __init__(self, message: str, **kwargs):
+ super().__init__(message)
+ self.name = 'GeneratedCodeError'
+ self.message = message
+ self.extra = kwargs
diff --git a/box_sdk_gen/internal/logging.py b/box_sdk_gen/internal/logging.py
new file mode 100644
index 000000000..41371aa47
--- /dev/null
+++ b/box_sdk_gen/internal/logging.py
@@ -0,0 +1,31 @@
+from typing import Dict
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import sanitize_map
+
+from box_sdk_gen.serialization.json import sanitize_serialized_data
+
+
+class DataSanitizer:
+ def __init__(self):
+ self._keys_to_sanitize = {
+ 'authorization': '',
+ 'access_token': '',
+ 'refresh_token': '',
+ 'subject_token': '',
+ 'token': '',
+ 'client_id': '',
+ 'client_secret': '',
+ 'shared_link': '',
+ 'download_url': '',
+ 'jwt_private_key': '',
+ 'jwt_private_key_passphrase': '',
+ 'password': '',
+ }
+
+ def sanitize_headers(self, headers: Dict[str, str]) -> Dict[str, str]:
+ return sanitize_map(headers, self._keys_to_sanitize)
+
+ def sanitize_body(self, body: SerializedData) -> SerializedData:
+ return sanitize_serialized_data(body, self._keys_to_sanitize)
diff --git a/box_sdk_gen/internal/null_value.py b/box_sdk_gen/internal/null_value.py
new file mode 100644
index 000000000..9001c9a06
--- /dev/null
+++ b/box_sdk_gen/internal/null_value.py
@@ -0,0 +1,5 @@
+class NullValue:
+ pass
+
+
+null = NullValue()
diff --git a/box_sdk_gen/internal/utils.py b/box_sdk_gen/internal/utils.py
new file mode 100644
index 000000000..9289a03ca
--- /dev/null
+++ b/box_sdk_gen/internal/utils.py
@@ -0,0 +1,501 @@
+import base64
+import datetime
+import hashlib
+import os
+import re
+import shutil
+import uuid
+import time
+import hmac
+from random import uniform
+from enum import Enum
+from io import SEEK_CUR, SEEK_END, SEEK_SET, BufferedIOBase, BytesIO
+from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, BinaryIO
+
+from abc import abstractmethod
+from typing import Any
+
+try:
+ import jwt
+ from cryptography.hazmat.backends import default_backend
+ from cryptography.hazmat.primitives import serialization
+except ImportError:
+ jwt, default_backend, serialization = None, None, None
+
+from .base_object import BaseObject
+from ..serialization.json import sd_to_json, sanitized_value
+from ..serialization.json import serialize
+from .null_value import null
+
+ByteStream = BufferedIOBase
+OutputStream = BinaryIO
+Buffer = bytes
+
+
+class ResponseByteStream(ByteStream):
+ def __init__(self, request_iterator):
+ self._iterator = request_iterator
+ self._buffer = b''
+ self._position = 0
+ self._eos = False
+
+ def _read_from_iterator(self, size):
+ """
+ Read up to `size` bytes from the iterator into the buffer
+ :param size: Number of bytes to read. If None, read the entire stream.
+ """
+ if self._eos:
+ return
+
+ while len(self._buffer) < size:
+ try:
+ chunk = next(self._iterator)
+ self._buffer += chunk
+ except StopIteration:
+ self._eos = True
+ break
+
+ def tell(self):
+ """
+ Returns the current position in the stream
+ :return:
+ """
+ return self._position
+
+ def read(self, size=None):
+ """
+ Reads up to `size` bytes from the stream
+ :param size: Read up to `size` bytes from the stream. If None read the entire stream.
+ :return: Bytes read from the stream
+ """
+ if size is None:
+ # Read everything remaining in the stream.
+ result = self._buffer + b''.join(self._iterator)
+ self._buffer = b''
+ self._position += len(result)
+ self._eos = True
+ return result
+
+ self._read_from_iterator(size)
+ result = self._buffer[:size]
+ self._buffer = self._buffer[size:]
+ self._position += len(result)
+ return result
+
+ def seek(self, position, whence=SEEK_SET):
+ """
+ Move the stream to given position
+ :param position: Position to move to
+ :param whence: One of SEEK_SET = 0, SEEK_CUR = 1 or SEEK_END = 2
+ :return: The new position in the stream
+ """
+ if whence == SEEK_SET:
+ if position < self._position:
+ raise ValueError('Cannot seek backwards in a stream')
+ self.read(position - self._position)
+ elif whence == SEEK_CUR:
+ self.read(position)
+ elif whence == SEEK_END:
+ raise NotImplementedError('SEEK_END is not supported for streams')
+ else:
+ raise ValueError('Invalid value for `whence`')
+
+ return self._position
+
+
+def get_env_var(name: str) -> str:
+ return os.getenv(name)
+
+
+def get_uuid() -> str:
+ return str(uuid.uuid1())
+
+
+def decode_base_64(value: str) -> str:
+ return base64.b64decode(value).decode()
+
+
+def generate_byte_buffer(size: int) -> Buffer:
+ return Buffer(os.urandom(size))
+
+
+def generate_byte_stream_from_buffer(buffer: Buffer) -> ByteStream:
+ return BytesIO(buffer)
+
+
+def generate_byte_stream(size: int) -> ByteStream:
+ return BytesIO(os.urandom(size))
+
+
+def buffer_equals(buffer1: Buffer, buffer2: Buffer) -> bool:
+ return buffer1 == buffer2
+
+
+def buffer_length(buffer: Buffer) -> int:
+ return len(buffer)
+
+
+def decode_base_64_byte_stream(value: str) -> ByteStream:
+ return BytesIO(base64.b64decode(value))
+
+
+def string_to_byte_stream(value: str) -> ByteStream:
+ return BytesIO(bytes(value, 'utf-8'))
+
+
+def read_byte_stream(byte_stream: ByteStream) -> Buffer:
+ return Buffer(byte_stream.read())
+
+
+def write_input_stream_to_output_stream(
+ input_stream: ByteStream, output_stream: OutputStream
+):
+ shutil.copyfileobj(input_stream, output_stream)
+
+
+def get_file_output_stream(file_path: str) -> OutputStream:
+ return open(file_path, 'wb')
+
+
+def close_file_output_stream(file_output_stream: OutputStream):
+ file_output_stream.close()
+
+
+def read_buffer_from_file(path: str) -> bytes:
+ with open(path, 'rb') as file:
+ return file.read()
+
+
+def prepare_params(map: Dict[str, Optional[str]]) -> Dict[str, str]:
+ return {k: v for k, v in map.items() if v is not None}
+
+
+def to_string(value: Any) -> Optional[str]:
+ if value is None:
+ return None
+ if isinstance(value, datetime.datetime):
+ return date_time_to_string(value)
+ if isinstance(value, datetime.date):
+ return date_to_string(value)
+ if (
+ isinstance(value, BaseObject)
+ or isinstance(value, list)
+ and len(value) >= 1
+ and isinstance(value[0], BaseObject)
+ ):
+ return ''.join(sd_to_json(serialize(value)).split())
+ if isinstance(value, list):
+ return ','.join(map(to_string, value))
+ if isinstance(value, Enum):
+ return value.value
+ return str(value)
+
+
+class HashName(str, Enum):
+ SHA1 = 'sha1'
+
+
+class Hash:
+ def __init__(self, algorithm: HashName):
+ self.algorithm = algorithm
+ self.hash = hashlib.sha1()
+
+ def update_hash(self, data: Buffer):
+ self.hash.update(data)
+
+ def digest_hash(self, encoding):
+ return base64.b64encode(self.hash.digest()).decode("utf-8")
+
+
+def hex_to_base_64(data: hex):
+ return base64.b64encode(bytes.fromhex(data)).decode()
+
+
+T = TypeVar('T')
+Iterator = Iterable[T]
+Accumulator = TypeVar('Accumulator')
+
+
+def iterate_chunks(
+ stream: ByteStream, chunk_size: int, file_size: int
+) -> Iterable[ByteStream]:
+ stream_is_finished = False
+ while not stream_is_finished:
+ copied_length = 0
+ chunk = b''
+ while copied_length < chunk_size:
+ bytes_read = stream.read(chunk_size - copied_length)
+ if bytes_read is None:
+ # stream returns none when no bytes are ready currently but there are
+ # potentially more bytes in the stream to be read.
+ continue
+ if not bytes_read:
+ # stream is exhausted.
+ stream_is_finished = True
+ break
+ chunk += bytes_read
+ copied_length += len(bytes_read)
+ if chunk:
+ yield BytesIO(chunk)
+
+
+def reduce_iterator(
+ iterator: Iterator,
+ reducer: Callable[[Accumulator, T], Accumulator],
+ initial_value: Accumulator,
+) -> Accumulator:
+ result = initial_value
+
+ for item in iterator:
+ result = reducer(result, item)
+
+ return result
+
+
+def read_text_from_file(file_path: str) -> str:
+ with open(file_path, 'r') as file:
+ return file.read()
+
+
+def is_browser() -> bool:
+ return False
+
+
+def get_epoch_time_in_seconds() -> int:
+ return int(time.time())
+
+
+def get_value_from_object_raw_data(obj: BaseObject, key: str) -> Any:
+ keys = key.split('.')
+ value: dict = obj.raw_data
+ for k in keys:
+ value = value.get(k, {})
+ return value
+
+
+class PrivateKeyDecryptor:
+ """Class used for private key decryption in JWT auth."""
+
+ @abstractmethod
+ def decrypt_private_key(self, encryptedPrivateKey: str, passphrase: str) -> Any:
+ """Decrypts private key using a passphrase."""
+ pass
+
+
+class DefaultPrivateKeyDecryptor(PrivateKeyDecryptor):
+ def decrypt_private_key(self, encryptedPrivateKey: str, passphrase: str) -> Any:
+ if default_backend is None or serialization is None:
+ raise ImportError(
+ 'Missing `cryptography` dependency. `cryptography` library is required to create JWT assertion.'
+ )
+ encoded_private_key = encode_str_ascii_or_raise(encryptedPrivateKey)
+ encoded_passphrase = encode_str_ascii_or_raise(passphrase)
+
+ return serialization.load_pem_private_key(
+ encoded_private_key,
+ password=encoded_passphrase,
+ backend=default_backend(),
+ )
+
+
+class JwtAlgorithm(str, Enum):
+ HS256 = 'HS256'
+ HS384 = 'HS384'
+ HS512 = 'HS512'
+ RS256 = 'RS256'
+ RS384 = 'RS384'
+ RS512 = 'RS512'
+ ES256 = 'ES256'
+ ES384 = 'ES384'
+ ES512 = 'ES512'
+ PS256 = 'PS256'
+ PS384 = 'PS384'
+ PS512 = 'PS512'
+ none = 'none'
+
+
+class JwtSignOptions(BaseObject):
+ def __init__(
+ self,
+ algorithm: JwtAlgorithm,
+ headers: Dict[str, str] = None,
+ audience: Optional[str] = None,
+ issuer: Optional[str] = None,
+ subject: Optional[str] = None,
+ jwtid: Optional[str] = None,
+ keyid: Optional[str] = None,
+ private_key_decryptor: Optional[PrivateKeyDecryptor] = None,
+ **kwargs,
+ ):
+ super().__init__(**kwargs)
+ if headers is None:
+ headers = {}
+ self.algorithm = algorithm
+ self.headers = headers
+ self.audience = audience
+ self.issuer = issuer
+ self.subject = subject
+ self.jwtid = jwtid
+ self.keyid = keyid
+ self.private_key_decryptor = (
+ private_key_decryptor
+ if private_key_decryptor is not None
+ else DefaultPrivateKeyDecryptor()
+ )
+
+
+class JwtKey(BaseObject):
+ def __init__(self, key: str, passphrase: str, **kwargs):
+ super().__init__(**kwargs)
+ self.key = key
+ self.passphrase = passphrase
+
+
+def encode_str_ascii_or_raise(passphrase: str) -> bytes:
+ try:
+ return passphrase.encode('ascii')
+ except UnicodeError as unicode_error:
+ raise TypeError(
+ "private_key and private_key_passphrase must contain binary data (bytes/str), not a text/unicode string"
+ ) from unicode_error
+
+
+def create_jwt_assertion(claims: dict, key: JwtKey, options: JwtSignOptions) -> str:
+ if jwt is None:
+ raise ImportError(
+ 'Missing `PyJWT` dependency. `PyJWT` library is required to create JWT assertion.'
+ )
+ return jwt.encode(
+ {
+ 'iss': options.issuer,
+ 'sub': options.subject,
+ 'box_sub_type': claims['box_sub_type'],
+ 'aud': options.audience,
+ 'jti': options.jwtid,
+ 'exp': claims['exp'],
+ },
+ options.private_key_decryptor.decrypt_private_key(key.key, key.passphrase),
+ algorithm=options.algorithm,
+ headers={'kid': options.keyid},
+ )
+
+
+Date = datetime.date
+DateTime = datetime.datetime
+
+
+def date_to_string(date: Date) -> str:
+ return date.isoformat()
+
+
+def date_from_string(date: str) -> Date:
+ return Date.fromisoformat(date)
+
+
+def date_time_to_string(date_time: DateTime) -> str:
+ return date_time.isoformat().replace('+00:00', 'Z')
+
+
+def date_time_from_string(date_time: str) -> DateTime:
+ return DateTime.fromisoformat(date_time.replace('Z', '+00:00'))
+
+
+def date_time_to_epoch_seconds(date_time: DateTime) -> int:
+ return int(date_time.timestamp())
+
+
+def epoch_seconds_to_date_time(epoch_seconds: int) -> DateTime:
+ return DateTime.fromtimestamp(epoch_seconds, datetime.timezone.utc)
+
+
+def delay_in_seconds(seconds: int):
+ time.sleep(seconds)
+
+
+def create_null():
+ return null
+
+
+def escape_unicode(value: str) -> str:
+ def replace_char(match):
+ char = match.group(0)
+ code_point = ord(char)
+ if char == '\n':
+ return '\\n'
+ elif char == '\r':
+ return '\\r'
+ elif char == '\t':
+ return '\\t'
+ elif code_point <= 0xFFFF: # Basic Multilingual Plane (BMP)
+ return f"\\u{code_point:04x}"
+ else: # Supplementary Plane (Surrogate Pair)
+ code_point -= 0x10000
+ high_surrogate = 0xD800 + (code_point >> 10)
+ low_surrogate = 0xDC00 + (code_point & 0x3FF)
+ return f"\\u{high_surrogate:04x}\\u{low_surrogate:04x}"
+
+ # Replace any backslashes that are NOT part of a \/ with double backslash
+ temp = re.sub(r'\\(?!/)', r'\\\\', value)
+
+ # Match special characters, non-ASCII characters
+ return re.sub(r'[^\x20-\x7e]|[\n\r\t]', replace_char, temp)
+
+
+def compute_webhook_signature(
+ body: str,
+ headers: Dict[str, str],
+ signature_key: str,
+ escape_body: Optional[bool] = False,
+) -> Optional[str]:
+ """
+ Computes the Hmac for the webhook notification given one signature key.
+
+ :param body:
+ The encoded webhook body.
+ :param headers:
+ The headers for the `Webhook` notification.
+ :param signature_key:
+ The `Webhook` signature key for this application.
+ :param escape_body:
+ Indicates if payload should be escaped or left as is.
+ :return:
+ An Hmac signature.
+ """
+ if signature_key is None:
+ return None
+ if headers.get('box-signature-version') != '1':
+ return None
+ if headers.get('box-signature-algorithm') != 'HmacSHA256':
+ return None
+
+ encoded_body = (escape_unicode(body) if escape_body else body).encode('utf-8')
+ encoded_signature_key = signature_key.encode('utf-8')
+ encoded_delivery_time_stamp = headers.get('box-delivery-timestamp').encode('utf-8')
+ new_hmac = hmac.new(encoded_signature_key, digestmod=hashlib.sha256)
+ new_hmac.update(encoded_body)
+ new_hmac.update(encoded_delivery_time_stamp)
+ signature = base64.b64encode(new_hmac.digest()).decode()
+ return signature
+
+
+def compare_signatures(
+ expected_signature: Optional[str], received_signature: Optional[str]
+) -> bool:
+ if not expected_signature or not received_signature:
+ return False
+ if len(expected_signature) != len(received_signature):
+ return False
+ return hmac.compare_digest(expected_signature, received_signature)
+
+
+def random(min: float, max: float) -> float:
+ return uniform(min, max)
+
+
+def sanitize_map(
+ dictionary: Dict[str, str], keys_to_sanitize: Dict[str, str]
+) -> Dict[str, str]:
+ return {
+ k: sanitized_value() if k.lower() in keys_to_sanitize else v
+ for k, v in dictionary.items()
+ }
diff --git a/box_sdk_gen/managers/__init__.py b/box_sdk_gen/managers/__init__.py
new file mode 100644
index 000000000..d5a840f81
--- /dev/null
+++ b/box_sdk_gen/managers/__init__.py
@@ -0,0 +1,157 @@
+from box_sdk_gen.managers.authorization import *
+
+from box_sdk_gen.managers.files import *
+
+from box_sdk_gen.managers.trashed_files import *
+
+from box_sdk_gen.managers.app_item_associations import *
+
+from box_sdk_gen.managers.downloads import *
+
+from box_sdk_gen.managers.uploads import *
+
+from box_sdk_gen.managers.chunked_uploads import *
+
+from box_sdk_gen.managers.list_collaborations import *
+
+from box_sdk_gen.managers.comments import *
+
+from box_sdk_gen.managers.tasks import *
+
+from box_sdk_gen.managers.file_versions import *
+
+from box_sdk_gen.managers.file_metadata import *
+
+from box_sdk_gen.managers.file_classifications import *
+
+from box_sdk_gen.managers.skills import *
+
+from box_sdk_gen.managers.file_watermarks import *
+
+from box_sdk_gen.managers.file_requests import *
+
+from box_sdk_gen.managers.folders import *
+
+from box_sdk_gen.managers.trashed_folders import *
+
+from box_sdk_gen.managers.folder_metadata import *
+
+from box_sdk_gen.managers.folder_classifications import *
+
+from box_sdk_gen.managers.trashed_items import *
+
+from box_sdk_gen.managers.folder_watermarks import *
+
+from box_sdk_gen.managers.folder_locks import *
+
+from box_sdk_gen.managers.metadata_templates import *
+
+from box_sdk_gen.managers.classifications import *
+
+from box_sdk_gen.managers.metadata_cascade_policies import *
+
+from box_sdk_gen.managers.search import *
+
+from box_sdk_gen.managers.user_collaborations import *
+
+from box_sdk_gen.managers.task_assignments import *
+
+from box_sdk_gen.managers.shared_links_files import *
+
+from box_sdk_gen.managers.shared_links_folders import *
+
+from box_sdk_gen.managers.web_links import *
+
+from box_sdk_gen.managers.trashed_web_links import *
+
+from box_sdk_gen.managers.shared_links_web_links import *
+
+from box_sdk_gen.managers.shared_links_app_items import *
+
+from box_sdk_gen.managers.users import *
+
+from box_sdk_gen.managers.session_termination import *
+
+from box_sdk_gen.managers.avatars import *
+
+from box_sdk_gen.managers.transfer import *
+
+from box_sdk_gen.managers.email_aliases import *
+
+from box_sdk_gen.managers.memberships import *
+
+from box_sdk_gen.managers.invites import *
+
+from box_sdk_gen.managers.groups import *
+
+from box_sdk_gen.managers.webhooks import *
+
+from box_sdk_gen.managers.events import *
+
+from box_sdk_gen.managers.collections import *
+
+from box_sdk_gen.managers.recent_items import *
+
+from box_sdk_gen.managers.retention_policies import *
+
+from box_sdk_gen.managers.retention_policy_assignments import *
+
+from box_sdk_gen.managers.legal_hold_policies import *
+
+from box_sdk_gen.managers.legal_hold_policy_assignments import *
+
+from box_sdk_gen.managers.file_version_retentions import *
+
+from box_sdk_gen.managers.file_version_legal_holds import *
+
+from box_sdk_gen.managers.shield_information_barriers import *
+
+from box_sdk_gen.managers.shield_information_barrier_reports import *
+
+from box_sdk_gen.managers.shield_information_barrier_segments import *
+
+from box_sdk_gen.managers.shield_information_barrier_segment_members import *
+
+from box_sdk_gen.managers.shield_information_barrier_segment_restrictions import *
+
+from box_sdk_gen.managers.device_pinners import *
+
+from box_sdk_gen.managers.terms_of_services import *
+
+from box_sdk_gen.managers.terms_of_service_user_statuses import *
+
+from box_sdk_gen.managers.collaboration_allowlist_entries import *
+
+from box_sdk_gen.managers.collaboration_allowlist_exempt_targets import *
+
+from box_sdk_gen.managers.storage_policies import *
+
+from box_sdk_gen.managers.storage_policy_assignments import *
+
+from box_sdk_gen.managers.zip_downloads import *
+
+from box_sdk_gen.managers.sign_requests import *
+
+from box_sdk_gen.managers.workflows import *
+
+from box_sdk_gen.managers.sign_templates import *
+
+from box_sdk_gen.managers.integration_mappings import *
+
+from box_sdk_gen.managers.ai import *
+
+from box_sdk_gen.managers.ai_studio import *
+
+from box_sdk_gen.managers.docgen_template import *
+
+from box_sdk_gen.managers.docgen import *
+
+from box_sdk_gen.managers.hubs import *
+
+from box_sdk_gen.managers.hub_collaborations import *
+
+from box_sdk_gen.managers.hub_items import *
+
+from box_sdk_gen.managers.shield_lists import *
+
+from box_sdk_gen.managers.archives import *
diff --git a/box_sdk_gen/managers/ai.py b/box_sdk_gen/managers/ai.py
new file mode 100644
index 000000000..4ab53e5b9
--- /dev/null
+++ b/box_sdk_gen/managers/ai.py
@@ -0,0 +1,477 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from typing import Union
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.schemas.ai_item_ask import AiItemAsk
+
+from box_sdk_gen.schemas.ai_dialogue_history import AiDialogueHistory
+
+from box_sdk_gen.schemas.ai_agent_reference import AiAgentReference
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.ai_item_base import AiItemBase
+
+from box_sdk_gen.schemas.ai_response_full import AiResponseFull
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.ai_ask import AiAsk
+
+from box_sdk_gen.schemas.ai_response import AiResponse
+
+from box_sdk_gen.schemas.ai_text_gen import AiTextGen
+
+from box_sdk_gen.schemas.ai_agent_ask import AiAgentAsk
+
+from box_sdk_gen.schemas.ai_agent_text_gen import AiAgentTextGen
+
+from box_sdk_gen.schemas.ai_agent_extract import AiAgentExtract
+
+from box_sdk_gen.schemas.ai_agent_extract_structured import AiAgentExtractStructured
+
+from box_sdk_gen.schemas.ai_extract import AiExtract
+
+from box_sdk_gen.schemas.ai_extract_structured_response import (
+ AiExtractStructuredResponse,
+)
+
+from box_sdk_gen.schemas.ai_extract_structured import AiExtractStructured
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+
+class CreateAiAskMode(str, Enum):
+ MULTIPLE_ITEM_QA = 'multiple_item_qa'
+ SINGLE_ITEM_QA = 'single_item_qa'
+
+
+class CreateAiTextGenItemsTypeField(str, Enum):
+ FILE = 'file'
+
+
+class CreateAiTextGenItems(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CreateAiTextGenItemsTypeField = CreateAiTextGenItemsTypeField.FILE,
+ content: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the item.
+ :type id: str
+ :param type: The type of the item., defaults to CreateAiTextGenItemsTypeField.FILE
+ :type type: CreateAiTextGenItemsTypeField, optional
+ :param content: The content to use as context for generating new text or editing existing text., defaults to None
+ :type content: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.content = content
+
+
+class GetAiAgentDefaultConfigMode(str, Enum):
+ ASK = 'ask'
+ TEXT_GEN = 'text_gen'
+ EXTRACT = 'extract'
+ EXTRACT_STRUCTURED = 'extract_structured'
+
+
+class CreateAiExtractStructuredMetadataTemplateTypeField(str, Enum):
+ METADATA_TEMPLATE = 'metadata_template'
+
+
+class CreateAiExtractStructuredMetadataTemplate(BaseObject):
+ _discriminator = 'type', {'metadata_template'}
+
+ def __init__(
+ self,
+ *,
+ template_key: Optional[str] = None,
+ type: Optional[CreateAiExtractStructuredMetadataTemplateTypeField] = None,
+ scope: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param template_key: The name of the metadata template., defaults to None
+ :type template_key: Optional[str], optional
+ :param type: Value is always `metadata_template`., defaults to None
+ :type type: Optional[CreateAiExtractStructuredMetadataTemplateTypeField], optional
+ :param scope: The scope of the metadata template that can either be global or
+ enterprise.
+ * The **global** scope is used for templates that are
+ available to any Box enterprise.
+ * The **enterprise** scope represents templates created within a specific enterprise,
+ containing the ID of that enterprise., defaults to None
+ :type scope: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.template_key = template_key
+ self.type = type
+ self.scope = scope
+
+
+class CreateAiExtractStructuredFieldsOptionsField(BaseObject):
+ def __init__(self, key: str, **kwargs):
+ """
+ :param key: A unique identifier for the field.
+ :type key: str
+ """
+ super().__init__(**kwargs)
+ self.key = key
+
+
+class CreateAiExtractStructuredFields(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'display_name': 'displayName',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'displayName': 'display_name',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ key: str,
+ *,
+ description: Optional[str] = None,
+ display_name: Optional[str] = None,
+ prompt: Optional[str] = None,
+ type: Optional[str] = None,
+ options: Optional[List[CreateAiExtractStructuredFieldsOptionsField]] = None,
+ **kwargs
+ ):
+ """
+ :param key: A unique identifier for the field.
+ :type key: str
+ :param description: A description of the field., defaults to None
+ :type description: Optional[str], optional
+ :param display_name: The display name of the field., defaults to None
+ :type display_name: Optional[str], optional
+ :param prompt: The context about the key that may include how to find and format it., defaults to None
+ :type prompt: Optional[str], optional
+ :param type: The type of the field. It include but is not limited to string, float, date, enum, and multiSelect., defaults to None
+ :type type: Optional[str], optional
+ :param options: A list of options for this field. This is most often used in combination with the enum and multiSelect field types., defaults to None
+ :type options: Optional[List[CreateAiExtractStructuredFieldsOptionsField]], optional
+ """
+ super().__init__(**kwargs)
+ self.key = key
+ self.description = description
+ self.display_name = display_name
+ self.prompt = prompt
+ self.type = type
+ self.options = options
+
+
+class AiManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def create_ai_ask(
+ self,
+ mode: CreateAiAskMode,
+ prompt: str,
+ items: List[AiItemAsk],
+ *,
+ dialogue_history: Optional[List[AiDialogueHistory]] = None,
+ include_citations: Optional[bool] = None,
+ ai_agent: Optional[Union[AiAgentAsk, AiAgentReference]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Optional[AiResponseFull]:
+ """
+ Sends an AI request to supported LLMs and returns an answer specifically focused on the user's question given the provided context.
+ :param mode: Box AI handles text documents with text representations up to 1MB in size, or a maximum of 25 files,
+ whichever comes first. If the text file size exceeds 1MB, the first 1MB of text representation will be processed.
+ Box AI handles image documents with a resolution of 1024 x 1024 pixels, with a maximum of 5 images or 5 pages
+ for multi-page images. If the number of image or image pages exceeds 5, the first 5 images or pages will
+ be processed. If you set mode parameter to `single_item_qa`, the items array can have one element only.
+ Currently Box AI does not support multi-modal requests. If both images and text are sent Box AI will only
+ process the text.
+ :type mode: CreateAiAskMode
+ :param prompt: The prompt provided by the client to be answered by the LLM.
+ The prompt's length is limited to 10000 characters.
+ :type prompt: str
+ :param items: The items to be processed by the LLM, often files.
+ :type items: List[AiItemAsk]
+ :param dialogue_history: The history of prompts and answers previously passed to the LLM. This provides additional context to the LLM in generating the response., defaults to None
+ :type dialogue_history: Optional[List[AiDialogueHistory]], optional
+ :param include_citations: A flag to indicate whether citations should be returned., defaults to None
+ :type include_citations: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'mode': mode,
+ 'prompt': prompt,
+ 'items': items,
+ 'dialogue_history': dialogue_history,
+ 'include_citations': include_citations,
+ 'ai_agent': ai_agent,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/ai/ask']),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ if to_string(response.status) == '204':
+ return None
+ return deserialize(response.data, AiResponseFull)
+
+ def create_ai_text_gen(
+ self,
+ prompt: str,
+ items: List[CreateAiTextGenItems],
+ *,
+ dialogue_history: Optional[List[AiDialogueHistory]] = None,
+ ai_agent: Optional[Union[AiAgentReference, AiAgentTextGen]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AiResponse:
+ """
+ Sends an AI request to supported Large Language Models (LLMs) and returns generated text based on the provided prompt.
+ :param prompt: The prompt provided by the client to be answered by the LLM. The prompt's length is limited to 10000 characters.
+ :type prompt: str
+ :param items: The items to be processed by the LLM, often files.
+ The array can include **exactly one** element.
+
+ **Note**: Box AI handles documents with text representations up to 1MB in size.
+ If the file size exceeds 1MB, the first 1MB of text representation will be processed.
+ :type items: List[CreateAiTextGenItems]
+ :param dialogue_history: The history of prompts and answers previously passed to the LLM. This parameter provides the additional context to the LLM when generating the response., defaults to None
+ :type dialogue_history: Optional[List[AiDialogueHistory]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'prompt': prompt,
+ 'items': items,
+ 'dialogue_history': dialogue_history,
+ 'ai_agent': ai_agent,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/ai/text_gen']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AiResponse)
+
+ def get_ai_agent_default_config(
+ self,
+ mode: GetAiAgentDefaultConfigMode,
+ *,
+ language: Optional[str] = None,
+ model: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Union[AiAgentAsk, AiAgentTextGen, AiAgentExtract, AiAgentExtractStructured]:
+ """
+ Get the AI agent default config.
+ :param mode: The mode to filter the agent config to return.
+ :type mode: GetAiAgentDefaultConfigMode
+ :param language: The ISO language code to return the agent config for.
+ If the language is not supported the default agent config is returned., defaults to None
+ :type language: Optional[str], optional
+ :param model: The model to return the default agent config for., defaults to None
+ :type model: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'mode': to_string(mode),
+ 'language': to_string(language),
+ 'model': to_string(model),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/ai_agent_default']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(
+ response.data,
+ Union[AiAgentAsk, AiAgentTextGen, AiAgentExtract, AiAgentExtractStructured],
+ )
+
+ def create_ai_extract(
+ self,
+ prompt: str,
+ items: List[AiItemBase],
+ *,
+ ai_agent: Optional[Union[AiAgentReference, AiAgentExtract]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AiResponse:
+ """
+ Sends an AI request to supported Large Language Models (LLMs) and extracts metadata in form of key-value pairs.
+
+ In this request, both the prompt and the output can be freeform.
+
+
+ Metadata template setup before sending the request is not required.
+
+ :param prompt: The prompt provided to a Large Language Model (LLM) in the request. The prompt can be up to 10000 characters long and it can be an XML or a JSON schema.
+ :type prompt: str
+ :param items: The items that LLM will process. Currently, you can use files only.
+ :type items: List[AiItemBase]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'prompt': prompt, 'items': items, 'ai_agent': ai_agent}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/ai/extract']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AiResponse)
+
+ def create_ai_extract_structured(
+ self,
+ items: List[AiItemBase],
+ *,
+ metadata_template: Optional[CreateAiExtractStructuredMetadataTemplate] = None,
+ fields: Optional[List[CreateAiExtractStructuredFields]] = None,
+ ai_agent: Optional[Union[AiAgentReference, AiAgentExtractStructured]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AiExtractStructuredResponse:
+ """
+ Sends an AI request to supported Large Language Models (LLMs) and returns extracted metadata as a set of key-value pairs.
+
+ For this request, you either need a metadata template or a list of fields you want to extract.
+
+
+ Input is **either** a metadata template or a list of fields to ensure the structure.
+
+
+ To learn more about creating templates, see [Creating metadata templates in the Admin Console](https://support.box.com/hc/en-us/articles/360044194033-Customizing-Metadata-Templates)
+
+
+ or use the [metadata template API](g://metadata/templates/create).
+
+ :param items: The items to be processed by the LLM. Currently you can use files only.
+ :type items: List[AiItemBase]
+ :param metadata_template: The metadata template containing the fields to extract.
+ For your request to work, you must provide either `metadata_template` or `fields`, but not both., defaults to None
+ :type metadata_template: Optional[CreateAiExtractStructuredMetadataTemplate], optional
+ :param fields: The fields to be extracted from the provided items.
+ For your request to work, you must provide either `metadata_template` or `fields`, but not both., defaults to None
+ :type fields: Optional[List[CreateAiExtractStructuredFields]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'items': items,
+ 'metadata_template': metadata_template,
+ 'fields': fields,
+ 'ai_agent': ai_agent,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/ai/extract_structured',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AiExtractStructuredResponse)
diff --git a/box_sdk_gen/managers/ai_studio.py b/box_sdk_gen/managers/ai_studio.py
new file mode 100644
index 000000000..d43740e2a
--- /dev/null
+++ b/box_sdk_gen/managers/ai_studio.py
@@ -0,0 +1,328 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.schemas.group_base import GroupBase
+
+from box_sdk_gen.schemas.ai_agent_allowed_entity import AiAgentAllowedEntity
+
+from box_sdk_gen.schemas.ai_studio_agent_ask import AiStudioAgentAsk
+
+from box_sdk_gen.schemas.ai_studio_agent_text_gen import AiStudioAgentTextGen
+
+from box_sdk_gen.schemas.ai_studio_agent_extract import AiStudioAgentExtract
+
+from box_sdk_gen.schemas.ai_multiple_agent_response import AiMultipleAgentResponse
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.ai_single_agent_response_full import AiSingleAgentResponseFull
+
+from box_sdk_gen.schemas.create_ai_agent import CreateAiAgent
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateAiAgentType(str, Enum):
+ AI_AGENT = 'ai_agent'
+
+
+class UpdateAiAgentByIdType(str, Enum):
+ AI_AGENT = 'ai_agent'
+
+
+class AiStudioManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_ai_agents(
+ self,
+ *,
+ mode: Optional[List[str]] = None,
+ fields: Optional[List[str]] = None,
+ agent_state: Optional[List[str]] = None,
+ include_box_default: Optional[bool] = None,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AiMultipleAgentResponse:
+ """
+ Lists AI agents based on the provided parameters.
+ :param mode: The mode to filter the agent config to return. Possible values are: `ask`, `text_gen`, and `extract`., defaults to None
+ :type mode: Optional[List[str]], optional
+ :param fields: The fields to return in the response., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param agent_state: The state of the agents to return. Possible values are: `enabled`, `disabled` and `enabled_for_selected_users`., defaults to None
+ :type agent_state: Optional[List[str]], optional
+ :param include_box_default: Whether to include the Box default agents in the response., defaults to None
+ :type include_box_default: Optional[bool], optional
+ :param marker: Defines the position marker at which to begin returning results., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'mode': to_string(mode),
+ 'fields': to_string(fields),
+ 'agent_state': to_string(agent_state),
+ 'include_box_default': to_string(include_box_default),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/ai_agents']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AiMultipleAgentResponse)
+
+ def create_ai_agent(
+ self,
+ name: str,
+ access_state: str,
+ *,
+ type: CreateAiAgentType = CreateAiAgentType.AI_AGENT,
+ icon_reference: Optional[str] = None,
+ allowed_entities: Optional[List[AiAgentAllowedEntity]] = None,
+ ask: Optional[AiStudioAgentAsk] = None,
+ text_gen: Optional[AiStudioAgentTextGen] = None,
+ extract: Optional[AiStudioAgentExtract] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AiSingleAgentResponseFull:
+ """
+ Creates an AI agent. At least one of the following capabilities must be provided: `ask`, `text_gen`, `extract`.
+ :param name: The name of the AI Agent.
+ :type name: str
+ :param access_state: The state of the AI Agent. Possible values are: `enabled`, `disabled`, and `enabled_for_selected_users`.
+ :type access_state: str
+ :param type: The type of agent used to handle queries., defaults to CreateAiAgentType.AI_AGENT
+ :type type: CreateAiAgentType, optional
+ :param icon_reference: The icon reference of the AI Agent. It should have format of the URL `https://cdn01.boxcdn.net/app-assets/aistudio/avatars/`
+ where possible values of `file_name` are: `logo_boxAi.png`,`logo_stamp.png`,`logo_legal.png`,`logo_finance.png`,`logo_config.png`,`logo_handshake.png`,`logo_analytics.png`,`logo_classification.png`., defaults to None
+ :type icon_reference: Optional[str], optional
+ :param allowed_entities: List of allowed users or groups., defaults to None
+ :type allowed_entities: Optional[List[AiAgentAllowedEntity]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'type': type,
+ 'name': name,
+ 'access_state': access_state,
+ 'icon_reference': icon_reference,
+ 'allowed_entities': allowed_entities,
+ 'ask': ask,
+ 'text_gen': text_gen,
+ 'extract': extract,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/ai_agents']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AiSingleAgentResponseFull)
+
+ def update_ai_agent_by_id(
+ self,
+ agent_id: str,
+ name: str,
+ access_state: str,
+ *,
+ type: UpdateAiAgentByIdType = UpdateAiAgentByIdType.AI_AGENT,
+ icon_reference: Optional[str] = None,
+ allowed_entities: Optional[List[AiAgentAllowedEntity]] = None,
+ ask: Optional[AiStudioAgentAsk] = None,
+ text_gen: Optional[AiStudioAgentTextGen] = None,
+ extract: Optional[AiStudioAgentExtract] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AiSingleAgentResponseFull:
+ """
+ Updates an AI agent.
+ :param agent_id: The ID of the agent to update.
+ Example: "1234"
+ :type agent_id: str
+ :param name: The name of the AI Agent.
+ :type name: str
+ :param access_state: The state of the AI Agent. Possible values are: `enabled`, `disabled`, and `enabled_for_selected_users`.
+ :type access_state: str
+ :param type: The type of agent used to handle queries., defaults to UpdateAiAgentByIdType.AI_AGENT
+ :type type: UpdateAiAgentByIdType, optional
+ :param icon_reference: The icon reference of the AI Agent. It should have format of the URL `https://cdn01.boxcdn.net/app-assets/aistudio/avatars/`
+ where possible values of `file_name` are: `logo_boxAi.png`,`logo_stamp.png`,`logo_legal.png`,`logo_finance.png`,`logo_config.png`,`logo_handshake.png`,`logo_analytics.png`,`logo_classification.png`., defaults to None
+ :type icon_reference: Optional[str], optional
+ :param allowed_entities: List of allowed users or groups., defaults to None
+ :type allowed_entities: Optional[List[AiAgentAllowedEntity]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'type': type,
+ 'name': name,
+ 'access_state': access_state,
+ 'icon_reference': icon_reference,
+ 'allowed_entities': allowed_entities,
+ 'ask': ask,
+ 'text_gen': text_gen,
+ 'extract': extract,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/ai_agents/',
+ to_string(agent_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AiSingleAgentResponseFull)
+
+ def get_ai_agent_by_id(
+ self,
+ agent_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AiSingleAgentResponseFull:
+ """
+ Gets an AI Agent using the `agent_id` parameter.
+ :param agent_id: The agent id to get.
+ Example: "1234"
+ :type agent_id: str
+ :param fields: The fields to return in the response., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/ai_agents/',
+ to_string(agent_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AiSingleAgentResponseFull)
+
+ def delete_ai_agent_by_id(
+ self, agent_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes an AI agent using the provided parameters.
+ :param agent_id: The ID of the agent to delete.
+ Example: "1234"
+ :type agent_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/ai_agents/',
+ to_string(agent_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/app_item_associations.py b/box_sdk_gen/managers/app_item_associations.py
new file mode 100644
index 000000000..6f32278ed
--- /dev/null
+++ b/box_sdk_gen/managers/app_item_associations.py
@@ -0,0 +1,197 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.app_item_associations import AppItemAssociations
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class AppItemAssociationsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_app_item_associations(
+ self,
+ file_id: str,
+ *,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ application_type: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AppItemAssociations:
+ """
+ **This is a beta feature, which means that its availability might be limited.**
+
+ Returns all app items the file is associated with. This includes app items
+
+
+ associated with ancestors of the file. Assuming the context user has access
+
+
+ to the file, the type/ids are revealed even if the context user does not
+
+
+ have **View** permission on the app item.
+
+ :param 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"
+ :type file_id: str
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param application_type: If given, only return app items for this application type., defaults to None
+ :type application_type: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'limit': to_string(limit),
+ 'marker': to_string(marker),
+ 'application_type': to_string(application_type),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/app_item_associations',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AppItemAssociations)
+
+ def get_folder_app_item_associations(
+ self,
+ folder_id: str,
+ *,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ application_type: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AppItemAssociations:
+ """
+ **This is a beta feature, which means that its availability might be limited.**
+
+ Returns all app items the folder is associated with. This includes app items
+
+
+ associated with ancestors of the folder. Assuming the context user has access
+
+
+ to the folder, the type/ids are revealed even if the context user does not
+
+
+ have **View** permission on the app item.
+
+ :param 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"
+ :type folder_id: str
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param application_type: If given, returns only app items for this application type., defaults to None
+ :type application_type: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'limit': to_string(limit),
+ 'marker': to_string(marker),
+ 'application_type': to_string(application_type),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/app_item_associations',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AppItemAssociations)
diff --git a/box_sdk_gen/managers/archives.py b/box_sdk_gen/managers/archives.py
new file mode 100644
index 000000000..bf0a3f58f
--- /dev/null
+++ b/box_sdk_gen/managers/archives.py
@@ -0,0 +1,171 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.v2025_r0.archives_v2025_r0 import ArchivesV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0
+
+from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import (
+ BoxVersionHeaderV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.archive_v2025_r0 import ArchiveV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class ArchivesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_archives_v2025_r0(
+ self,
+ *,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ArchivesV2025R0:
+ """
+ Retrieves archives for an enterprise.
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination., defaults to None
+ :type marker: Optional[str], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {'limit': to_string(limit), 'marker': to_string(marker)}
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/archives']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ArchivesV2025R0)
+
+ def create_archive_v2025_r0(
+ self,
+ name: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ArchiveV2025R0:
+ """
+ Creates an archive.
+ :param name: The name of the archive.
+ :type name: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'name': name}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/archives']),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ArchiveV2025R0)
+
+ def delete_archive_by_id_v2025_r0(
+ self,
+ archive_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Permanently deletes an archive.
+ :param archive_id: The ID of the archive.
+ Example: "982312"
+ :type archive_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/archives/',
+ to_string(archive_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/authorization.py b/box_sdk_gen/managers/authorization.py
new file mode 100644
index 000000000..7bcb2af9c
--- /dev/null
+++ b/box_sdk_gen/managers/authorization.py
@@ -0,0 +1,434 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenGrantTypeField
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenSubjectTokenTypeField
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenBoxSubjectTypeField
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.access_token import AccessToken
+
+from box_sdk_gen.schemas.o_auth_2_error import OAuth2Error
+
+from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2Token
+
+from box_sdk_gen.schemas.post_o_auth_2_token_refresh_access_token import (
+ PostOAuth2TokenRefreshAccessToken,
+)
+
+from box_sdk_gen.schemas.post_o_auth_2_revoke import PostOAuth2Revoke
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class 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: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def authorize_user(
+ self,
+ response_type: AuthorizeUserResponseType,
+ client_id: str,
+ *,
+ redirect_uri: Optional[str] = None,
+ state: Optional[str] = None,
+ scope: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Authorize a user by sending them through the [Box](https://box.com)
+
+ website and request their permission to act on their behalf.
+
+
+ This is the first step when authenticating a user using
+
+
+ OAuth 2.0. To request a user's authorization to use the Box APIs
+
+
+ on their behalf you will need to send a user to the URL with this
+
+
+ format.
+
+ :param response_type: The type of response we'd like to receive.
+ :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
+ 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.
+ :type client_id: str
+ :param redirect_uri: The URI to which Box redirects the browser after the user has granted
+ or denied the application permission. This URI match one of the redirect
+ URIs in the configuration of your application. It must be a
+ valid HTTPS URI and it needs to be able to handle the redirection to
+ complete the next step in the OAuth 2.0 flow.
+ Although this parameter is optional, it must be a part of the
+ authorization URL if you configured multiple redirect URIs
+ for the application in the developer console. A missing parameter causes
+ a `redirect_uri_missing` error after the user grants application access., defaults to None
+ :type redirect_uri: Optional[str], optional
+ :param state: 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., defaults to None
+ :type state: Optional[str], optional
+ :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., defaults to None
+ :type scope: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'response_type': to_string(response_type),
+ 'client_id': to_string(client_id),
+ 'redirect_uri': to_string(redirect_uri),
+ 'state': to_string(state),
+ 'scope': to_string(scope),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.oauth_2_url, '/authorize']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ 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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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**.., defaults to None
+ :type scope: Optional[str], optional
+ :param resource: Full URL for the file that the token should be generated for., defaults to None
+ :type resource: Optional[str], optional
+ :param box_subject_type: Used in combination with `client_credentials` as the `grant_type`., defaults to None
+ :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., defaults to None
+ :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., defaults to None
+ :type box_shared_link: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ '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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/oauth2/token']),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/x-www-form-urlencoded',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AccessToken)
+
+ def refresh_access_token(
+ self,
+ client_id: str,
+ client_secret: str,
+ refresh_token: str,
+ *,
+ grant_type: RefreshAccessTokenGrantType = RefreshAccessTokenGrantType.REFRESH_TOKEN,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AccessToken:
+ """
+ Refresh an Access Token using its client ID, secret, and refresh token.
+ :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 grant_type: The type of request being made, in this case a refresh request., defaults to RefreshAccessTokenGrantType.REFRESH_TOKEN
+ :type grant_type: RefreshAccessTokenGrantType, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ '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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/oauth2/token#refresh']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/x-www-form-urlencoded',
+ response_format=ResponseFormat.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., defaults to None
+ :type client_id: Optional[str], optional
+ :param client_secret: The client secret of the application requesting to revoke
+ an access token., defaults to None
+ :type client_secret: Optional[str], optional
+ :param token: The access token to revoke., defaults to None
+ :type token: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'client_id': client_id,
+ 'client_secret': client_secret,
+ 'token': token,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/oauth2/revoke']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/x-www-form-urlencoded',
+ response_format=ResponseFormat.NO_CONTENT,
+ 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
new file mode 100644
index 000000000..a6ff17103
--- /dev/null
+++ b/box_sdk_gen/managers/avatars.py
@@ -0,0 +1,174 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.user_avatar import UserAvatar
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.networking.fetch_options import MultipartItem
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class AvatarsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_user_avatar(
+ self, user_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ByteStream:
+ """
+ Retrieves an image of a the user's avatar.
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ '/avatar',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.BINARY,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return response.content
+
+ def create_user_avatar(
+ self,
+ user_id: str,
+ pic: ByteStream,
+ *,
+ pic_file_name: Optional[str] = None,
+ pic_content_type: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UserAvatar:
+ """
+ Adds or updates a user avatar.
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param pic: The image file to be uploaded to Box.
+ Accepted file extensions are `.jpg` or `.png`.
+ The maximum file size is 1MB.
+ :type pic: ByteStream
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'pic': pic,
+ 'pic_file_name': pic_file_name,
+ 'pic_content_type': pic_content_type,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ '/avatar',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ multipart_data=[
+ MultipartItem(
+ part_name='pic',
+ file_stream=pic,
+ file_name=pic_file_name,
+ content_type=pic_content_type,
+ )
+ ],
+ content_type='multipart/form-data',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UserAvatar)
+
+ def delete_user_avatar(
+ self, user_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes an existing user avatar.
+
+ You cannot reverse this operation.
+
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ '/avatar',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/chunked_uploads.py b/box_sdk_gen/managers/chunked_uploads.py
new file mode 100644
index 000000000..1ff148681
--- /dev/null
+++ b/box_sdk_gen/managers/chunked_uploads.py
@@ -0,0 +1,872 @@
+from typing import List
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.internal.utils import Buffer
+
+from box_sdk_gen.internal.utils import HashName
+
+from box_sdk_gen.internal.utils import Iterator
+
+from box_sdk_gen.schemas.upload_session import UploadSession
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.uploaded_part import UploadedPart
+
+from box_sdk_gen.schemas.upload_parts import UploadParts
+
+from box_sdk_gen.schemas.files import Files
+
+from box_sdk_gen.schemas.upload_part import UploadPart
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.internal.utils import generate_byte_stream_from_buffer
+
+from box_sdk_gen.internal.utils import hex_to_base_64
+
+from box_sdk_gen.internal.utils import iterate_chunks
+
+from box_sdk_gen.internal.utils import read_byte_stream
+
+from box_sdk_gen.internal.utils import reduce_iterator
+
+from box_sdk_gen.internal.utils import Hash
+
+from box_sdk_gen.internal.utils import buffer_length
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+
+class _PartAccumulator:
+ def __init__(
+ self,
+ last_index: int,
+ parts: List[UploadPart],
+ file_size: int,
+ upload_part_url: str,
+ file_hash: Hash,
+ ):
+ self.last_index = last_index
+ self.parts = parts
+ self.file_size = file_size
+ self.upload_part_url = upload_part_url
+ self.file_hash = file_hash
+
+
+class ChunkedUploadsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def create_file_upload_session(
+ self,
+ folder_id: str,
+ file_size: int,
+ file_name: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadSession:
+ """
+ Creates an upload session for a new file.
+ :param folder_id: The ID of the folder to upload the new file to.
+ :type folder_id: str
+ :param file_size: The total number of bytes of the file to be uploaded.
+ :type file_size: int
+ :param file_name: The name of new file.
+ :type file_name: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'folder_id': folder_id,
+ 'file_size': file_size,
+ 'file_name': file_name,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.upload_url,
+ '/2.0/files/upload_sessions',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadSession)
+
+ def create_file_upload_session_for_existing_file(
+ self,
+ file_id: str,
+ file_size: int,
+ *,
+ file_name: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadSession:
+ """
+ Creates an upload session for an existing file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param file_size: The total number of bytes of the file to be uploaded.
+ :type file_size: int
+ :param file_name: The optional new name of new file., defaults to None
+ :type file_name: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'file_size': file_size, 'file_name': file_name}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.upload_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/upload_sessions',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadSession)
+
+ def get_file_upload_session_by_url(
+ self, url: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadSession:
+ """
+ Using this method with urls provided in response when creating a new upload session is preferred to use over GetFileUploadSessionById method.
+
+ This allows to always upload your content to the closest Box data center and can significantly improve upload speed.
+
+
+ Return information about an upload session.
+
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) endpoint.
+
+ :param url: URL of getFileUploadSessionById method
+ :type url: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=url,
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadSession)
+
+ def get_file_upload_session_by_id(
+ self,
+ upload_session_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadSession:
+ """
+ Return information about an upload session.
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) endpoint.
+
+ :param upload_session_id: The ID of the upload session.
+ Example: "D5E3F7A"
+ :type upload_session_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.upload_url,
+ '/2.0/files/upload_sessions/',
+ to_string(upload_session_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadSession)
+
+ def upload_file_part_by_url(
+ self,
+ url: str,
+ request_body: ByteStream,
+ digest: str,
+ content_range: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadedPart:
+ """
+ Using this method with urls provided in response when creating a new upload session is preferred to use over UploadFilePart method.
+
+ This allows to always upload your content to the closest Box data center and can significantly improve upload speed.
+
+
+ Uploads a chunk of a file for an upload session.
+
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+
+
+ and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+ :param url: URL of uploadFilePart method
+ :type url: str
+ :param request_body: Request body of uploadFilePart method
+ :type request_body: ByteStream
+ :param digest: The [RFC3230][1] message digest of the chunk uploaded.
+
+ Only SHA1 is supported. The SHA1 digest must be base64
+ encoded. The format of this header is as
+ `sha=BASE64_ENCODED_DIGEST`.
+
+ To get the value for the `SHA` digest, use the
+ openSSL command to encode the file part:
+ `openssl sha1 -binary | base64`.
+
+ [1]: https://tools.ietf.org/html/rfc3230
+ :type digest: str
+ :param content_range: The byte range of the chunk.
+
+ Must not overlap with the range of a part already
+ uploaded this session. Each part’s size must be
+ exactly equal in size to the part size specified
+ in the upload session that you created.
+ One exception is the last part of the file, as this can be smaller.
+
+ When providing the value for `content-range`, remember that:
+
+ * The lower bound of each part's byte range
+ must be a multiple of the part size.
+ * The higher bound must be a multiple of the part size - 1.
+ :type content_range: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'digest': to_string(digest),
+ 'content-range': to_string(content_range),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=url,
+ method='PUT',
+ headers=headers_map,
+ file_stream=request_body,
+ content_type='application/octet-stream',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadedPart)
+
+ def upload_file_part(
+ self,
+ upload_session_id: str,
+ request_body: ByteStream,
+ digest: str,
+ content_range: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadedPart:
+ """
+ Uploads a chunk of a file for an upload session.
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+
+
+ and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+ :param upload_session_id: The ID of the upload session.
+ Example: "D5E3F7A"
+ :type upload_session_id: str
+ :param request_body: Request body of uploadFilePart method
+ :type request_body: ByteStream
+ :param digest: The [RFC3230][1] message digest of the chunk uploaded.
+
+ Only SHA1 is supported. The SHA1 digest must be base64
+ encoded. The format of this header is as
+ `sha=BASE64_ENCODED_DIGEST`.
+
+ To get the value for the `SHA` digest, use the
+ openSSL command to encode the file part:
+ `openssl sha1 -binary | base64`.
+
+ [1]: https://tools.ietf.org/html/rfc3230
+ :type digest: str
+ :param content_range: The byte range of the chunk.
+
+ Must not overlap with the range of a part already
+ uploaded this session. Each part’s size must be
+ exactly equal in size to the part size specified
+ in the upload session that you created.
+ One exception is the last part of the file, as this can be smaller.
+
+ When providing the value for `content-range`, remember that:
+
+ * The lower bound of each part's byte range
+ must be a multiple of the part size.
+ * The higher bound must be a multiple of the part size - 1.
+ :type content_range: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'digest': to_string(digest),
+ 'content-range': to_string(content_range),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.upload_url,
+ '/2.0/files/upload_sessions/',
+ to_string(upload_session_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ file_stream=request_body,
+ content_type='application/octet-stream',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadedPart)
+
+ def delete_file_upload_session_by_url(
+ self, url: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Using this method with urls provided in response when creating a new upload session is preferred to use over DeleteFileUploadSessionById method.
+
+ This allows to always upload your content to the closest Box data center and can significantly improve upload speed.
+
+
+ Abort an upload session and discard all data uploaded.
+
+
+ This cannot be reversed.
+
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+
+
+ and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+ :param url: URL of deleteFileUploadSessionById method
+ :type url: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=url,
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def delete_file_upload_session_by_id(
+ self,
+ upload_session_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Abort an upload session and discard all data uploaded.
+
+ This cannot be reversed.
+
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+
+
+ and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+ :param upload_session_id: The ID of the upload session.
+ Example: "D5E3F7A"
+ :type upload_session_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.upload_url,
+ '/2.0/files/upload_sessions/',
+ to_string(upload_session_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_file_upload_session_parts_by_url(
+ self,
+ url: str,
+ *,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadParts:
+ """
+ Using this method with urls provided in response when creating a new upload session is preferred to use over GetFileUploadSessionParts method.
+
+ This allows to always upload your content to the closest Box data center and can significantly improve upload speed.
+
+
+ Return a list of the chunks uploaded to the upload session so far.
+
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+
+
+ and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+ :param url: URL of getFileUploadSessionParts method
+ :type url: str
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=url,
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadParts)
+
+ def get_file_upload_session_parts(
+ self,
+ upload_session_id: str,
+ *,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadParts:
+ """
+ Return a list of the chunks uploaded to the upload session so far.
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+
+
+ and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+ :param upload_session_id: The ID of the upload session.
+ Example: "D5E3F7A"
+ :type upload_session_id: str
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.upload_url,
+ '/2.0/files/upload_sessions/',
+ to_string(upload_session_id),
+ '/parts',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadParts)
+
+ def create_file_upload_session_commit_by_url(
+ self,
+ url: str,
+ parts: List[UploadPart],
+ digest: str,
+ *,
+ if_match: Optional[str] = None,
+ if_none_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Optional[Files]:
+ """
+ Using this method with urls provided in response when creating a new upload session is preferred to use over CreateFileUploadSessionCommit method.
+
+ This allows to always upload your content to the closest Box data center and can significantly improve upload speed.
+
+
+ Close an upload session and create a file from the uploaded chunks.
+
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+
+
+ and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+ :param url: URL of createFileUploadSessionCommit method
+ :type url: str
+ :param parts: The list details for the uploaded parts.
+ :type parts: List[UploadPart]
+ :param digest: The [RFC3230][1] message digest of the whole file.
+
+ Only SHA1 is supported. The SHA1 digest must be Base64
+ encoded. The format of this header is as
+ `sha=BASE64_ENCODED_DIGEST`.
+
+ [1]: https://tools.ietf.org/html/rfc3230
+ :type digest: str
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param if_none_match: Ensures an item is only returned if it has changed.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `304 Not Modified` if the item has not
+ changed since., defaults to None
+ :type if_none_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'parts': parts}
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'digest': to_string(digest),
+ 'if-match': to_string(if_match),
+ 'if-none-match': to_string(if_none_match),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=url,
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ if to_string(response.status) == '202':
+ return None
+ return deserialize(response.data, Files)
+
+ def create_file_upload_session_commit(
+ self,
+ upload_session_id: str,
+ parts: List[UploadPart],
+ digest: str,
+ *,
+ if_match: Optional[str] = None,
+ if_none_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Optional[Files]:
+ """
+ Close an upload session and create a file from the uploaded chunks.
+
+ The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+
+
+ and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+ :param upload_session_id: The ID of the upload session.
+ Example: "D5E3F7A"
+ :type upload_session_id: str
+ :param parts: The list details for the uploaded parts.
+ :type parts: List[UploadPart]
+ :param digest: The [RFC3230][1] message digest of the whole file.
+
+ Only SHA1 is supported. The SHA1 digest must be Base64
+ encoded. The format of this header is as
+ `sha=BASE64_ENCODED_DIGEST`.
+
+ [1]: https://tools.ietf.org/html/rfc3230
+ :type digest: str
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param if_none_match: Ensures an item is only returned if it has changed.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `304 Not Modified` if the item has not
+ changed since., defaults to None
+ :type if_none_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'parts': parts}
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'digest': to_string(digest),
+ 'if-match': to_string(if_match),
+ 'if-none-match': to_string(if_none_match),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.upload_url,
+ '/2.0/files/upload_sessions/',
+ to_string(upload_session_id),
+ '/commit',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ if to_string(response.status) == '202':
+ return None
+ return deserialize(response.data, Files)
+
+ 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)
+ hash: Hash = Hash(algorithm=HashName.SHA1)
+ hash.update_hash(chunk_buffer)
+ sha_1: str = hash.digest_hash('base64')
+ digest: str = ''.join(['sha=', sha_1])
+ chunk_size: int = buffer_length(chunk_buffer)
+ bytes_start: int = last_index + 1
+ bytes_end: int = last_index + chunk_size
+ content_range: str = ''.join(
+ [
+ 'bytes ',
+ to_string(bytes_start),
+ '-',
+ to_string(bytes_end),
+ '/',
+ to_string(acc.file_size),
+ ]
+ )
+ uploaded_part: UploadedPart = self.upload_file_part_by_url(
+ acc.upload_part_url,
+ generate_byte_stream_from_buffer(chunk_buffer),
+ digest,
+ content_range,
+ )
+ part: UploadPart = uploaded_part.part
+ part_sha_1: str = hex_to_base_64(part.sha_1)
+ assert part_sha_1 == sha_1
+ assert part.size == chunk_size
+ assert part.offset == bytes_start
+ acc.file_hash.update_hash(chunk_buffer)
+ return _PartAccumulator(
+ last_index=bytes_end,
+ parts=parts + [part],
+ file_size=acc.file_size,
+ upload_part_url=acc.upload_part_url,
+ file_hash=acc.file_hash,
+ )
+
+ 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.
+ :type file: ByteStream
+ :param file_name: The name of the file, which will be used for storage in Box.
+ :type file_name: str
+ :param file_size: The total size of the file for the chunked upload in bytes.
+ :type file_size: int
+ :param parent_folder_id: The ID of the folder where the file should be uploaded.
+ :type parent_folder_id: str
+ """
+ upload_session: UploadSession = self.create_file_upload_session(
+ parent_folder_id, file_size, file_name
+ )
+ upload_part_url: str = upload_session.session_endpoints.upload_part
+ commit_url: str = upload_session.session_endpoints.commit
+ list_parts_url: str = upload_session.session_endpoints.list_parts
+ part_size: int = upload_session.part_size
+ total_parts: int = upload_session.total_parts
+ assert part_size * total_parts >= file_size
+ assert upload_session.num_parts_processed == 0
+ file_hash: Hash = Hash(algorithm=HashName.SHA1)
+ chunks_iterator: Iterator = iterate_chunks(file, part_size, file_size)
+ results: _PartAccumulator = reduce_iterator(
+ chunks_iterator,
+ self._reducer,
+ _PartAccumulator(
+ last_index=-1,
+ parts=[],
+ file_size=file_size,
+ upload_part_url=upload_part_url,
+ file_hash=file_hash,
+ ),
+ )
+ parts: List[UploadPart] = results.parts
+ processed_session_parts: UploadParts = (
+ self.get_file_upload_session_parts_by_url(list_parts_url)
+ )
+ assert processed_session_parts.total_count == total_parts
+ sha_1: str = file_hash.digest_hash('base64')
+ digest: str = ''.join(['sha=', sha_1])
+ committed_session: Optional[Files] = (
+ self.create_file_upload_session_commit_by_url(commit_url, parts, digest)
+ )
+ return committed_session.entries[0]
diff --git a/box_sdk_gen/managers/classifications.py b/box_sdk_gen/managers/classifications.py
new file mode 100644
index 000000000..a76312ce7
--- /dev/null
+++ b/box_sdk_gen/managers/classifications.py
@@ -0,0 +1,707 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.classification_template import ClassificationTemplate
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class AddClassificationRequestBodyOpField(str, Enum):
+ ADDENUMOPTION = 'addEnumOption'
+
+
+class AddClassificationRequestBodyFieldKeyField(str, Enum):
+ BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key'
+
+
+class AddClassificationRequestBodyDataStaticConfigClassificationField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'classification_definition': 'classificationDefinition',
+ 'color_id': 'colorID',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'classificationDefinition': 'classification_definition',
+ 'colorID': 'color_id',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ classification_definition: Optional[str] = None,
+ color_id: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param classification_definition: A longer description of the classification., defaults to None
+ :type classification_definition: Optional[str], optional
+ :param color_id: An internal Box identifier used to assign a color to
+ a classification label.
+
+ Mapping between a `colorID` and a color may change
+ without notice. Currently, the color mappings are as
+ follows.
+
+ * `0`: Yellow.
+ * `1`: Orange.
+ * `2`: Watermelon red.
+ * `3`: Purple rain.
+ * `4`: Light blue.
+ * `5`: Dark blue.
+ * `6`: Light green.
+ * `7`: Gray., defaults to None
+ :type color_id: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.classification_definition = classification_definition
+ self.color_id = color_id
+
+
+class AddClassificationRequestBodyDataStaticConfigField(BaseObject):
+ def __init__(
+ self,
+ *,
+ classification: Optional[
+ AddClassificationRequestBodyDataStaticConfigClassificationField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param classification: Additional details for the classification., defaults to None
+ :type classification: Optional[AddClassificationRequestBodyDataStaticConfigClassificationField], optional
+ """
+ super().__init__(**kwargs)
+ self.classification = classification
+
+
+class AddClassificationRequestBodyDataField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'static_config': 'staticConfig',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'staticConfig': 'static_config',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ key: str,
+ *,
+ static_config: Optional[
+ AddClassificationRequestBodyDataStaticConfigField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param key: The label of the classification as shown in the web and
+ mobile interfaces. This is the only field required to
+ add a classification.
+ :type key: str
+ :param static_config: A static configuration for the classification., defaults to None
+ :type static_config: Optional[AddClassificationRequestBodyDataStaticConfigField], optional
+ """
+ super().__init__(**kwargs)
+ self.key = key
+ self.static_config = static_config
+
+
+class AddClassificationRequestBody(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'field_key': 'fieldKey',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'fieldKey': 'field_key',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ data: AddClassificationRequestBodyDataField,
+ *,
+ op: AddClassificationRequestBodyOpField = AddClassificationRequestBodyOpField.ADDENUMOPTION,
+ field_key: AddClassificationRequestBodyFieldKeyField = AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY,
+ **kwargs
+ ):
+ """
+ :param data: The details of the classification to add.
+ :type data: AddClassificationRequestBodyDataField
+ :param op: The type of change to perform on the classification
+ object., defaults to AddClassificationRequestBodyOpField.ADDENUMOPTION
+ :type op: AddClassificationRequestBodyOpField, optional
+ :param field_key: Defines classifications
+ available in the enterprise., defaults to AddClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY
+ :type field_key: AddClassificationRequestBodyFieldKeyField, optional
+ """
+ super().__init__(**kwargs)
+ self.data = data
+ self.op = op
+ self.field_key = field_key
+
+
+class UpdateClassificationRequestBodyOpField(str, Enum):
+ EDITENUMOPTION = 'editEnumOption'
+
+
+class UpdateClassificationRequestBodyFieldKeyField(str, Enum):
+ BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key'
+
+
+class UpdateClassificationRequestBodyDataStaticConfigClassificationField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'classification_definition': 'classificationDefinition',
+ 'color_id': 'colorID',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'classificationDefinition': 'classification_definition',
+ 'colorID': 'color_id',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ classification_definition: Optional[str] = None,
+ color_id: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param classification_definition: A longer description of the classification., defaults to None
+ :type classification_definition: Optional[str], optional
+ :param color_id: An internal Box identifier used to assign a color to
+ a classification label.
+
+ Mapping between a `colorID` and a color may change
+ without notice. Currently, the color mappings are as
+ follows.
+
+ * `0`: Yellow.
+ * `1`: Orange.
+ * `2`: Watermelon red.
+ * `3`: Purple rain.
+ * `4`: Light blue.
+ * `5`: Dark blue.
+ * `6`: Light green.
+ * `7`: Gray., defaults to None
+ :type color_id: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.classification_definition = classification_definition
+ self.color_id = color_id
+
+
+class UpdateClassificationRequestBodyDataStaticConfigField(BaseObject):
+ def __init__(
+ self,
+ *,
+ classification: Optional[
+ UpdateClassificationRequestBodyDataStaticConfigClassificationField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param classification: Additional details for the classification., defaults to None
+ :type classification: Optional[UpdateClassificationRequestBodyDataStaticConfigClassificationField], optional
+ """
+ super().__init__(**kwargs)
+ self.classification = classification
+
+
+class UpdateClassificationRequestBodyDataField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'static_config': 'staticConfig',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'staticConfig': 'static_config',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ key: str,
+ *,
+ static_config: Optional[
+ UpdateClassificationRequestBodyDataStaticConfigField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param key: A new label for the classification, as it will be
+ shown in the web and mobile interfaces.
+ :type key: str
+ :param static_config: A static configuration for the classification., defaults to None
+ :type static_config: Optional[UpdateClassificationRequestBodyDataStaticConfigField], optional
+ """
+ super().__init__(**kwargs)
+ self.key = key
+ self.static_config = static_config
+
+
+class UpdateClassificationRequestBody(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'field_key': 'fieldKey',
+ 'enum_option_key': 'enumOptionKey',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'fieldKey': 'field_key',
+ 'enumOptionKey': 'enum_option_key',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ enum_option_key: str,
+ data: UpdateClassificationRequestBodyDataField,
+ *,
+ op: UpdateClassificationRequestBodyOpField = UpdateClassificationRequestBodyOpField.EDITENUMOPTION,
+ field_key: UpdateClassificationRequestBodyFieldKeyField = UpdateClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY,
+ **kwargs
+ ):
+ """
+ :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: UpdateClassificationRequestBodyDataField
+ :param op: The type of change to perform on the classification
+ object., defaults to UpdateClassificationRequestBodyOpField.EDITENUMOPTION
+ :type op: UpdateClassificationRequestBodyOpField, optional
+ :param field_key: Defines classifications
+ available in the enterprise., defaults to UpdateClassificationRequestBodyFieldKeyField.BOX__SECURITY__CLASSIFICATION__KEY
+ :type field_key: UpdateClassificationRequestBodyFieldKeyField, optional
+ """
+ super().__init__(**kwargs)
+ self.enum_option_key = enum_option_key
+ self.data = data
+ self.op = op
+ self.field_key = field_key
+
+
+class CreateClassificationTemplateScope(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class CreateClassificationTemplateTemplateKey(str, Enum):
+ SECURITYCLASSIFICATION_6VMVOCHWUWO = 'securityClassification-6VMVochwUWo'
+
+
+class CreateClassificationTemplateDisplayName(str, Enum):
+ CLASSIFICATION = 'Classification'
+
+
+class CreateClassificationTemplateFieldsTypeField(str, Enum):
+ ENUM = 'enum'
+
+
+class CreateClassificationTemplateFieldsKeyField(str, Enum):
+ BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key'
+
+
+class CreateClassificationTemplateFieldsDisplayNameField(str, Enum):
+ CLASSIFICATION = 'Classification'
+
+
+class CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField(
+ BaseObject
+):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'classification_definition': 'classificationDefinition',
+ 'color_id': 'colorID',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'classificationDefinition': 'classification_definition',
+ 'colorID': 'color_id',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ classification_definition: Optional[str] = None,
+ color_id: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param classification_definition: A longer description of the classification., defaults to None
+ :type classification_definition: Optional[str], optional
+ :param color_id: An identifier used to assign a color to
+ a classification label.
+
+ Mapping between a `colorID` and a color may
+ change without notice. Currently, the color
+ mappings are as follows.
+
+ * `0`: Yellow.
+ * `1`: Orange.
+ * `2`: Watermelon red.
+ * `3`: Purple rain.
+ * `4`: Light blue.
+ * `5`: Dark blue.
+ * `6`: Light green.
+ * `7`: Gray., defaults to None
+ :type color_id: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.classification_definition = classification_definition
+ self.color_id = color_id
+
+
+class CreateClassificationTemplateFieldsOptionsStaticConfigField(BaseObject):
+ def __init__(
+ self,
+ *,
+ classification: Optional[
+ CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param classification: Additional information about the classification., defaults to None
+ :type classification: Optional[CreateClassificationTemplateFieldsOptionsStaticConfigClassificationField], optional
+ """
+ super().__init__(**kwargs)
+ self.classification = classification
+
+
+class CreateClassificationTemplateFieldsOptionsField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'static_config': 'staticConfig',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'staticConfig': 'static_config',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ key: str,
+ *,
+ static_config: Optional[
+ CreateClassificationTemplateFieldsOptionsStaticConfigField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param key: The display name and key this classification. This
+ will be show in the Box UI.
+ :type key: str
+ :param static_config: Additional information about the classification., defaults to None
+ :type static_config: Optional[CreateClassificationTemplateFieldsOptionsStaticConfigField], optional
+ """
+ super().__init__(**kwargs)
+ self.key = key
+ self.static_config = static_config
+
+
+class CreateClassificationTemplateFields(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'display_name': 'displayName',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'displayName': 'display_name',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {'enum'}
+
+ def __init__(
+ self,
+ options: List[CreateClassificationTemplateFieldsOptionsField],
+ *,
+ type: CreateClassificationTemplateFieldsTypeField = CreateClassificationTemplateFieldsTypeField.ENUM,
+ key: CreateClassificationTemplateFieldsKeyField = CreateClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY,
+ display_name: CreateClassificationTemplateFieldsDisplayNameField = CreateClassificationTemplateFieldsDisplayNameField.CLASSIFICATION,
+ hidden: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param options: The actual list of classifications that are present on
+ this template.
+ :type options: List[CreateClassificationTemplateFieldsOptionsField]
+ :param type: The type of the field
+ that is always enum., defaults to CreateClassificationTemplateFieldsTypeField.ENUM
+ :type type: CreateClassificationTemplateFieldsTypeField, optional
+ :param key: Defines classifications
+ available in the enterprise., defaults to CreateClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY
+ :type key: CreateClassificationTemplateFieldsKeyField, optional
+ :param display_name: A display name for the classification., defaults to CreateClassificationTemplateFieldsDisplayNameField.CLASSIFICATION
+ :type display_name: CreateClassificationTemplateFieldsDisplayNameField, optional
+ :param hidden: Determines if the classification
+ template is
+ hidden or available on
+ web and mobile
+ devices., defaults to None
+ :type hidden: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.options = options
+ self.type = type
+ self.key = key
+ self.display_name = display_name
+ self.hidden = hidden
+
+
+class ClassificationsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_classification_template(
+ self, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ClassificationTemplate:
+ """
+ Retrieves the classification metadata template and lists all the
+
+ classifications available to this enterprise.
+
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
+
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ClassificationTemplate)
+
+ def add_classification(
+ self,
+ request_body: List[AddClassificationRequestBody],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ClassificationTemplate:
+ """
+ Adds one or more new classifications to the list of classifications
+
+ available to the enterprise.
+
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
+
+ :param request_body: Request body of addClassification method
+ :type request_body: List[AddClassificationRequestBody]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#add',
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ClassificationTemplate)
+
+ def update_classification(
+ self,
+ request_body: List[UpdateClassificationRequestBody],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ClassificationTemplate:
+ """
+ Updates the labels and descriptions of one or more classifications
+
+ available to the enterprise.
+
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
+
+ :param request_body: Request body of updateClassification method
+ :type request_body: List[UpdateClassificationRequestBody]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#update',
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json-patch+json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ClassificationTemplate)
+
+ def create_classification_template(
+ self,
+ fields: List[CreateClassificationTemplateFields],
+ *,
+ scope: CreateClassificationTemplateScope = CreateClassificationTemplateScope.ENTERPRISE,
+ template_key: CreateClassificationTemplateTemplateKey = CreateClassificationTemplateTemplateKey.SECURITYCLASSIFICATION_6VMVOCHWUWO,
+ display_name: CreateClassificationTemplateDisplayName = CreateClassificationTemplateDisplayName.CLASSIFICATION,
+ hidden: Optional[bool] = None,
+ copy_instance_on_item_copy: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ClassificationTemplate:
+ """
+ When an enterprise does not yet have any classifications, this API call
+
+ initializes the classification template with an initial set of
+
+
+ classifications.
+
+
+ If an enterprise already has a classification, the template will already
+
+
+ exist and instead an API call should be made to add additional
+
+
+ classifications.
+
+ :param fields: The classification template requires exactly
+ one field, which holds
+ all the valid classification values.
+ :type fields: List[CreateClassificationTemplateFields]
+ :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., defaults to CreateClassificationTemplateScope.ENTERPRISE
+ :type scope: CreateClassificationTemplateScope, optional
+ :param template_key: Defines the list of metadata templates., defaults to CreateClassificationTemplateTemplateKey.SECURITYCLASSIFICATION_6VMVOCHWUWO
+ :type template_key: CreateClassificationTemplateTemplateKey, optional
+ :param display_name: The name of the
+ template as shown in web and mobile interfaces., defaults to CreateClassificationTemplateDisplayName.CLASSIFICATION
+ :type display_name: CreateClassificationTemplateDisplayName, optional
+ :param hidden: Determines if the classification template is
+ hidden or available on web and mobile
+ devices., defaults to None
+ :type hidden: Optional[bool], optional
+ :param copy_instance_on_item_copy: Determines if classifications are
+ copied along when the file or folder is
+ copied., defaults to None
+ :type copy_instance_on_item_copy: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'scope': scope,
+ 'templateKey': template_key,
+ 'displayName': display_name,
+ 'hidden': hidden,
+ 'copyInstanceOnItemCopy': copy_instance_on_item_copy,
+ 'fields': fields,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/schema#classifications',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ClassificationTemplate)
diff --git a/box_sdk_gen/managers/collaboration_allowlist_entries.py b/box_sdk_gen/managers/collaboration_allowlist_entries.py
new file mode 100644
index 000000000..15176d4fe
--- /dev/null
+++ b/box_sdk_gen/managers/collaboration_allowlist_entries.py
@@ -0,0 +1,226 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.collaboration_allowlist_entries import (
+ CollaborationAllowlistEntries,
+)
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.collaboration_allowlist_entry import (
+ CollaborationAllowlistEntry,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateCollaborationWhitelistEntryDirection(str, Enum):
+ INBOUND = 'inbound'
+ OUTBOUND = 'outbound'
+ BOTH = 'both'
+
+
+class CollaborationAllowlistEntriesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_collaboration_whitelist_entries(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CollaborationAllowlistEntries:
+ """
+ Returns the list domains that have been deemed safe to create collaborations
+
+ for within the current enterprise.
+
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination.
+
+ This requires `usemarker` to be set to `true`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaboration_whitelist_entries',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CollaborationAllowlistEntries)
+
+ def create_collaboration_whitelist_entry(
+ self,
+ domain: str,
+ direction: CreateCollaborationWhitelistEntryDirection,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CollaborationAllowlistEntry:
+ """
+ Creates a new entry in the list of allowed domains to allow
+
+ collaboration for.
+
+ :param domain: The domain to add to the list of allowed domains.
+ :type domain: str
+ :param direction: The direction in which to allow collaborations.
+ :type direction: CreateCollaborationWhitelistEntryDirection
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'domain': domain, 'direction': direction}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaboration_whitelist_entries',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CollaborationAllowlistEntry)
+
+ def get_collaboration_whitelist_entry_by_id(
+ self,
+ collaboration_whitelist_entry_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CollaborationAllowlistEntry:
+ """
+ Returns a domain that has been deemed safe to create collaborations
+
+ for within the current enterprise.
+
+ :param collaboration_whitelist_entry_id: The ID of the entry in the list.
+ Example: "213123"
+ :type collaboration_whitelist_entry_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaboration_whitelist_entries/',
+ to_string(collaboration_whitelist_entry_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CollaborationAllowlistEntry)
+
+ def delete_collaboration_whitelist_entry_by_id(
+ self,
+ collaboration_whitelist_entry_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes a domain from the list of domains that have been deemed safe to create
+
+ collaborations for within the current enterprise.
+
+ :param collaboration_whitelist_entry_id: The ID of the entry in the list.
+ Example: "213123"
+ :type collaboration_whitelist_entry_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaboration_whitelist_entries/',
+ to_string(collaboration_whitelist_entry_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py b/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py
new file mode 100644
index 000000000..aaacce06f
--- /dev/null
+++ b/box_sdk_gen/managers/collaboration_allowlist_exempt_targets.py
@@ -0,0 +1,227 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.collaboration_allowlist_exempt_targets import (
+ CollaborationAllowlistExemptTargets,
+)
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.collaboration_allowlist_exempt_target import (
+ CollaborationAllowlistExemptTarget,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateCollaborationWhitelistExemptTargetUser(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of the user to exempt.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class CollaborationAllowlistExemptTargetsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_collaboration_whitelist_exempt_targets(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CollaborationAllowlistExemptTargets:
+ """
+ Returns a list of users who have been exempt from the collaboration
+
+ domain restrictions.
+
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination.
+
+ This requires `usemarker` to be set to `true`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaboration_whitelist_exempt_targets',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CollaborationAllowlistExemptTargets)
+
+ def create_collaboration_whitelist_exempt_target(
+ self,
+ user: CreateCollaborationWhitelistExemptTargetUser,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CollaborationAllowlistExemptTarget:
+ """
+ Exempts a user from the restrictions set out by the allowed list of domains
+
+ for collaborations.
+
+ :param user: The user to exempt.
+ :type user: CreateCollaborationWhitelistExemptTargetUser
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'user': user}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaboration_whitelist_exempt_targets',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CollaborationAllowlistExemptTarget)
+
+ def get_collaboration_whitelist_exempt_target_by_id(
+ self,
+ collaboration_whitelist_exempt_target_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CollaborationAllowlistExemptTarget:
+ """
+ Returns a users who has been exempt from the collaboration
+
+ domain restrictions.
+
+ :param collaboration_whitelist_exempt_target_id: The ID of the exemption to the list.
+ Example: "984923"
+ :type collaboration_whitelist_exempt_target_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaboration_whitelist_exempt_targets/',
+ to_string(collaboration_whitelist_exempt_target_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CollaborationAllowlistExemptTarget)
+
+ def delete_collaboration_whitelist_exempt_target_by_id(
+ self,
+ collaboration_whitelist_exempt_target_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes a user's exemption from the restrictions set out by the allowed list
+
+ of domains for collaborations.
+
+ :param collaboration_whitelist_exempt_target_id: The ID of the exemption to the list.
+ Example: "984923"
+ :type collaboration_whitelist_exempt_target_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaboration_whitelist_exempt_targets/',
+ to_string(collaboration_whitelist_exempt_target_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/collections.py b/box_sdk_gen/managers/collections.py
new file mode 100644
index 000000000..bb060a8d3
--- /dev/null
+++ b/box_sdk_gen/managers/collections.py
@@ -0,0 +1,217 @@
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.collections import Collections
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.items_offset_paginated import ItemsOffsetPaginated
+
+from box_sdk_gen.schemas.collection import Collection
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CollectionsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_collections(
+ self,
+ *,
+ fields: Optional[List[str]] = None,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Collections:
+ """
+ Retrieves all collections for a given user.
+
+ Currently, only the `favorites` collection
+
+
+ is supported.
+
+ :param fields: A comma-separated list of attributes to include in the
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'offset': to_string(offset),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/collections']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Collections)
+
+ def get_collection_items(
+ self,
+ collection_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ItemsOffsetPaginated:
+ """
+ Retrieves the files and/or folders contained within
+
+ this collection.
+
+ :param collection_id: The ID of the collection.
+ Example: "926489"
+ :type collection_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'offset': to_string(offset),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collections/',
+ to_string(collection_id),
+ '/items',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ItemsOffsetPaginated)
+
+ def get_collection_by_id(
+ self,
+ collection_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Collection:
+ """
+ Retrieves a collection by its ID.
+ :param collection_id: The ID of the collection.
+ Example: "926489"
+ :type collection_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collections/',
+ to_string(collection_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Collection)
diff --git a/box_sdk_gen/managers/comments.py b/box_sdk_gen/managers/comments.py
new file mode 100644
index 000000000..f09708a1b
--- /dev/null
+++ b/box_sdk_gen/managers/comments.py
@@ -0,0 +1,357 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.comments import Comments
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.comment_full import CommentFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateCommentItemTypeField(str, Enum):
+ FILE = 'file'
+ COMMENT = 'comment'
+
+
+class CreateCommentItem(BaseObject):
+ _discriminator = 'type', {'file', 'comment'}
+
+ 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: CreateCommentItemTypeField
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CommentsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_comments(
+ self,
+ file_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Comments:
+ """
+ Retrieves a list of comments for a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'limit': to_string(limit),
+ 'offset': to_string(offset),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/comments',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Comments)
+
+ def get_comment_by_id(
+ self,
+ comment_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CommentFull:
+ """
+ Retrieves the message and metadata for a specific comment, as well
+
+ as information on the user who created the comment.
+
+ :param comment_id: The ID of the comment.
+ Example: "12345"
+ :type comment_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/comments/',
+ to_string(comment_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CommentFull)
+
+ def update_comment_by_id(
+ self,
+ comment_id: str,
+ *,
+ message: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CommentFull:
+ """
+ Update the message of a comment.
+ :param comment_id: The ID of the comment.
+ Example: "12345"
+ :type comment_id: str
+ :param message: The text of the comment to update., defaults to None
+ :type message: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'message': message}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/comments/',
+ to_string(comment_id),
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CommentFull)
+
+ def delete_comment_by_id(
+ self,
+ comment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Permanently deletes a comment.
+ :param comment_id: The ID of the comment.
+ Example: "12345"
+ :type comment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/comments/',
+ to_string(comment_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def create_comment(
+ self,
+ message: str,
+ item: CreateCommentItem,
+ *,
+ tagged_message: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CommentFull:
+ """
+ Adds a comment by the user to a specific file, or
+
+ as a reply to an other comment.
+
+ :param message: The text of the comment.
+
+ To mention a user, use the `tagged_message`
+ parameter instead.
+ :type message: str
+ :param item: The item to attach the comment to.
+ :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
+ 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., defaults to None
+ :type tagged_message: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'message': message,
+ 'tagged_message': tagged_message,
+ 'item': item,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/comments']),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CommentFull)
diff --git a/box_sdk_gen/managers/device_pinners.py b/box_sdk_gen/managers/device_pinners.py
new file mode 100644
index 000000000..612289415
--- /dev/null
+++ b/box_sdk_gen/managers/device_pinners.py
@@ -0,0 +1,188 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.device_pinner import DevicePinner
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.device_pinners import DevicePinners
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetEnterpriseDevicePinnersDirection(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class DevicePinnersManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_device_pinner_by_id(
+ self,
+ device_pinner_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DevicePinner:
+ """
+ Retrieves information about an individual device pin.
+ :param device_pinner_id: The ID of the device pin.
+ Example: "2324234"
+ :type device_pinner_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/device_pinners/',
+ to_string(device_pinner_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DevicePinner)
+
+ def delete_device_pinner_by_id(
+ self,
+ device_pinner_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes an individual device pin.
+ :param device_pinner_id: The ID of the device pin.
+ Example: "2324234"
+ :type device_pinner_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/device_pinners/',
+ to_string(device_pinner_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_enterprise_device_pinners(
+ self,
+ enterprise_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ direction: Optional[GetEnterpriseDevicePinnersDirection] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DevicePinners:
+ """
+ Retrieves all the device pins within an enterprise.
+
+ The user must have admin privileges, and the application
+
+
+ needs the "manage enterprise" scope to make this call.
+
+ :param enterprise_id: The ID of the enterprise.
+ Example: "3442311"
+ :type enterprise_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :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., defaults to None
+ :type direction: Optional[GetEnterpriseDevicePinnersDirection], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ 'direction': to_string(direction),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/enterprises/',
+ to_string(enterprise_id),
+ '/device_pinners',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DevicePinners)
diff --git a/box_sdk_gen/managers/docgen.py b/box_sdk_gen/managers/docgen.py
new file mode 100644
index 000000000..b5aad98a2
--- /dev/null
+++ b/box_sdk_gen/managers/docgen.py
@@ -0,0 +1,297 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from typing import List
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.file_version_base_v2025_r0 import (
+ FileVersionBaseV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_document_generation_data_v2025_r0 import (
+ DocGenDocumentGenerationDataV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_v2025_r0 import DocGenJobV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0
+
+from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import (
+ BoxVersionHeaderV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_jobs_full_v2025_r0 import (
+ DocGenJobsFullV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_jobs_v2025_r0 import DocGenJobsV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_batch_base_v2025_r0 import (
+ DocGenBatchBaseV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_batch_create_request_v2025_r0 import (
+ DocGenBatchCreateRequestV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateDocgenBatchV2025R0DestinationFolderTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class CreateDocgenBatchV2025R0DestinationFolder(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CreateDocgenBatchV2025R0DestinationFolderTypeField = CreateDocgenBatchV2025R0DestinationFolderTypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: ID of the folder.
+ :type id: str
+ :param type: The value will always be `folder`., defaults to CreateDocgenBatchV2025R0DestinationFolderTypeField.FOLDER
+ :type type: CreateDocgenBatchV2025R0DestinationFolderTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class DocgenManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_docgen_job_by_id_v2025_r0(
+ self,
+ job_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenJobV2025R0:
+ """
+ Get details of the Box Doc Gen job.
+ :param job_id: Box Doc Gen job ID.
+ Example: 123
+ :type job_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/docgen_jobs/',
+ to_string(job_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenJobV2025R0)
+
+ def get_docgen_jobs_v2025_r0(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenJobsFullV2025R0:
+ """
+ Lists all Box Doc Gen jobs for a user.
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {'marker': to_string(marker), 'limit': to_string(limit)}
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/docgen_jobs']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenJobsFullV2025R0)
+
+ def get_docgen_batch_job_by_id_v2025_r0(
+ self,
+ batch_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenJobsV2025R0:
+ """
+ Lists Box Doc Gen jobs in a batch.
+ :param batch_id: Box Doc Gen batch ID.
+ Example: 123
+ :type batch_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {'marker': to_string(marker), 'limit': to_string(limit)}
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/docgen_batch_jobs/',
+ to_string(batch_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenJobsV2025R0)
+
+ def create_docgen_batch_v2025_r0(
+ self,
+ file: FileReferenceV2025R0,
+ input_source: str,
+ destination_folder: CreateDocgenBatchV2025R0DestinationFolder,
+ output_type: str,
+ document_generation_data: List[DocGenDocumentGenerationDataV2025R0],
+ *,
+ file_version: Optional[FileVersionBaseV2025R0] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenBatchBaseV2025R0:
+ """
+ Generates a document using a Box Doc Gen template.
+ :param input_source: Source of input. The value has to be `api` for all the API-based document generation requests.
+ :type input_source: str
+ :param output_type: Type of the output file.
+ :type output_type: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'file': file,
+ 'file_version': file_version,
+ 'input_source': input_source,
+ 'destination_folder': destination_folder,
+ 'output_type': output_type,
+ 'document_generation_data': document_generation_data,
+ }
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/docgen_batches']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenBatchBaseV2025R0)
diff --git a/box_sdk_gen/managers/docgen_template.py b/box_sdk_gen/managers/docgen_template.py
new file mode 100644
index 000000000..203f2b097
--- /dev/null
+++ b/box_sdk_gen/managers/docgen_template.py
@@ -0,0 +1,349 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_template_base_v2025_r0 import (
+ DocGenTemplateBaseV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0
+
+from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import (
+ BoxVersionHeaderV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_template_create_request_v2025_r0 import (
+ DocGenTemplateCreateRequestV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_templates_v2025_r0 import (
+ DocGenTemplatesV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_template_v2025_r0 import DocGenTemplateV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_tags_v2025_r0 import DocGenTagsV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_tags_processing_message_v2025_r0 import (
+ DocGenTagsProcessingMessageV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_jobs_v2025_r0 import DocGenJobsV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class DocgenTemplateManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def create_docgen_template_v2025_r0(
+ self,
+ file: FileReferenceV2025R0,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenTemplateBaseV2025R0:
+ """
+ Marks a file as a Box Doc Gen template.
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'file': file}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/docgen_templates']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenTemplateBaseV2025R0)
+
+ def get_docgen_templates_v2025_r0(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenTemplatesV2025R0:
+ """
+ Lists Box Doc Gen templates on which the user is a collaborator.
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {'marker': to_string(marker), 'limit': to_string(limit)}
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/docgen_templates']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenTemplatesV2025R0)
+
+ def delete_docgen_template_by_id_v2025_r0(
+ self,
+ template_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Unmarks file as Box Doc Gen template.
+ :param template_id: ID of the file which will no longer be marked as a Box Doc Gen template.
+ Example: "123"
+ :type template_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/docgen_templates/',
+ to_string(template_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_docgen_template_by_id_v2025_r0(
+ self,
+ template_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenTemplateV2025R0:
+ """
+ Lists details of a specific Box Doc Gen template.
+ :param template_id: The ID of a Box Doc Gen template.
+ Example: 123
+ :type template_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/docgen_templates/',
+ to_string(template_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenTemplateV2025R0)
+
+ def get_docgen_template_tags_v2025_r0(
+ self,
+ template_id: str,
+ *,
+ template_version_id: Optional[str] = None,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenTagsV2025R0:
+ """
+ Lists all tags in a Box Doc Gen template.
+ :param template_id: ID of template.
+ Example: 123
+ :type template_id: str
+ :param template_version_id: Id of template version., defaults to None
+ :type template_version_id: Optional[str], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'template_version_id': to_string(template_version_id),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/docgen_templates/',
+ to_string(template_id),
+ '/tags',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenTagsV2025R0)
+
+ def get_docgen_template_job_by_id_v2025_r0(
+ self,
+ template_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> DocGenJobsV2025R0:
+ """
+ Lists the users jobs which use this template.
+ :param template_id: Id of template to fetch jobs for.
+ Example: 123
+ :type template_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {'marker': to_string(marker), 'limit': to_string(limit)}
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/docgen_template_jobs/',
+ to_string(template_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, DocGenJobsV2025R0)
diff --git a/box_sdk_gen/managers/downloads.py b/box_sdk_gen/managers/downloads.py
new file mode 100644
index 000000000..c5bde893c
--- /dev/null
+++ b/box_sdk_gen/managers/downloads.py
@@ -0,0 +1,256 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.internal.utils import write_input_stream_to_output_stream
+
+from box_sdk_gen.internal.utils import OutputStream
+
+
+class DownloadsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_download_file_url(
+ self,
+ file_id: str,
+ *,
+ version: Optional[str] = None,
+ access_token: Optional[str] = None,
+ range: Optional[str] = None,
+ boxapi: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> str:
+ """
+ Returns the contents of a file in binary format.
+ :param 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"
+ :type file_id: str
+ :param version: The file version to download., defaults to None
+ :type version: Optional[str], optional
+ :param access_token: An optional access token that can be used to pre-authenticate this request, which means that a download link can be shared with a browser or a third party service without them needing to know how to handle the authentication.
+ When using this parameter, please make sure that the access token is sufficiently scoped down to only allow read access to that file and no other files or folders., defaults to None
+ :type access_token: Optional[str], optional
+ :param range: The byte range of the content to download.
+
+ The format `bytes={start_byte}-{end_byte}` can be used to specify
+ what section of the file to download., defaults to None
+ :type range: Optional[str], 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.
+
+ Use the format `shared_link=[link]` or if a password is required then
+ use `shared_link=[link]&shared_link_password=[password]`.
+
+ This header can be used on the file or folder shared, as well as on any files
+ or folders nested within the item., defaults to None
+ :type boxapi: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/content',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ follow_redirects=False,
+ )
+ )
+ if 'location' in response.headers:
+ return response.headers.get('location')
+ if 'Location' in response.headers:
+ return response.headers.get('Location')
+ raise BoxSDKError(message='No location header in response')
+
+ def download_file(
+ self,
+ file_id: str,
+ *,
+ version: Optional[str] = None,
+ access_token: Optional[str] = None,
+ range: Optional[str] = None,
+ boxapi: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Optional[ByteStream]:
+ """
+ Returns the contents of a file in binary format.
+ :param 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"
+ :type file_id: str
+ :param version: The file version to download., defaults to None
+ :type version: Optional[str], optional
+ :param access_token: An optional access token that can be used to pre-authenticate this request, which means that a download link can be shared with a browser or a third party service without them needing to know how to handle the authentication.
+ When using this parameter, please make sure that the access token is sufficiently scoped down to only allow read access to that file and no other files or folders., defaults to None
+ :type access_token: Optional[str], optional
+ :param range: The byte range of the content to download.
+
+ The format `bytes={start_byte}-{end_byte}` can be used to specify
+ what section of the file to download., defaults to None
+ :type range: Optional[str], 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.
+
+ Use the format `shared_link=[link]` or if a password is required then
+ use `shared_link=[link]&shared_link_password=[password]`.
+
+ This header can be used on the file or folder shared, as well as on any files
+ or folders nested within the item., defaults to None
+ :type boxapi: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/content',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.BINARY,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ if to_string(response.status) == '202':
+ return None
+ return response.content
+
+ def download_file_to_output_stream(
+ self,
+ file_id: str,
+ output_stream: OutputStream,
+ *,
+ version: Optional[str] = None,
+ access_token: Optional[str] = None,
+ range: Optional[str] = None,
+ boxapi: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ :param 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"
+ :type file_id: str
+ :param output_stream: Download file to a given output stream
+ :type output_stream: OutputStream
+ :param version: The file version to download., defaults to None
+ :type version: Optional[str], optional
+ :param access_token: An optional access token that can be used to pre-authenticate this request, which means that a download link can be shared with a browser or a third party service without them needing to know how to handle the authentication.
+ When using this parameter, please make sure that the access token is sufficiently scoped down to only allow read access to that file and no other files or folders., defaults to None
+ :type access_token: Optional[str], optional
+ :param range: The byte range of the content to download.
+
+ The format `bytes={start_byte}-{end_byte}` can be used to specify
+ what section of the file to download., defaults to None
+ :type range: Optional[str], 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.
+
+ Use the format `shared_link=[link]` or if a password is required then
+ use `shared_link=[link]&shared_link_password=[password]`.
+
+ This header can be used on the file or folder shared, as well as on any files
+ or folders nested within the item., defaults to None
+ :type boxapi: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ download_stream: ByteStream = self.download_file(
+ file_id,
+ version=version,
+ access_token=access_token,
+ range=range,
+ boxapi=boxapi,
+ extra_headers=extra_headers,
+ )
+ write_input_stream_to_output_stream(download_stream, output_stream)
diff --git a/box_sdk_gen/managers/email_aliases.py b/box_sdk_gen/managers/email_aliases.py
new file mode 100644
index 000000000..6d837b116
--- /dev/null
+++ b/box_sdk_gen/managers/email_aliases.py
@@ -0,0 +1,175 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.email_aliases import EmailAliases
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.email_alias import EmailAlias
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class EmailAliasesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_user_email_aliases(
+ self, user_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> EmailAliases:
+ """
+ Retrieves all email aliases for a user. The collection
+
+ does not include the primary login for the user.
+
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ '/email_aliases',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, EmailAliases)
+
+ def create_user_email_alias(
+ self,
+ user_id: str,
+ email: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> EmailAlias:
+ """
+ Adds a new email alias to a user account..
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param email: The email address to add to the account as an alias.
+
+ Note: The domain of the email alias needs to be registered
+ to your enterprise.
+ See the [domain verification guide](
+ https://support.box.com/hc/en-us/articles/4408619650579-Domain-Verification
+ ) for steps to add a new domain.
+ :type email: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'email': email}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ '/email_aliases',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, EmailAlias)
+
+ def delete_user_email_alias_by_id(
+ self,
+ user_id: str,
+ email_alias_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes an email alias from a user.
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param email_alias_id: The ID of the email alias.
+ Example: "23432"
+ :type email_alias_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ '/email_aliases/',
+ to_string(email_alias_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/events.py b/box_sdk_gen/managers/events.py
new file mode 100644
index 000000000..16460b95c
--- /dev/null
+++ b/box_sdk_gen/managers/events.py
@@ -0,0 +1,399 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.serialization.json import deserialize
+
+from typing import List
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.realtime_servers import RealtimeServers
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.events import Events
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+
+class GetEventsStreamType(str, Enum):
+ ALL = 'all'
+ CHANGES = 'changes'
+ SYNC = 'sync'
+ ADMIN_LOGS = 'admin_logs'
+ ADMIN_LOGS_STREAMING = 'admin_logs_streaming'
+
+
+class GetEventsEventType(str, Enum):
+ ACCESS_GRANTED = 'ACCESS_GRANTED'
+ ACCESS_REVOKED = 'ACCESS_REVOKED'
+ ADD_DEVICE_ASSOCIATION = 'ADD_DEVICE_ASSOCIATION'
+ ADD_LOGIN_ACTIVITY_DEVICE = 'ADD_LOGIN_ACTIVITY_DEVICE'
+ ADMIN_LOGIN = 'ADMIN_LOGIN'
+ APPLICATION_CREATED = 'APPLICATION_CREATED'
+ APPLICATION_PUBLIC_KEY_ADDED = 'APPLICATION_PUBLIC_KEY_ADDED'
+ APPLICATION_PUBLIC_KEY_DELETED = 'APPLICATION_PUBLIC_KEY_DELETED'
+ CHANGE_ADMIN_ROLE = 'CHANGE_ADMIN_ROLE'
+ CHANGE_FOLDER_PERMISSION = 'CHANGE_FOLDER_PERMISSION'
+ COLLABORATION_ACCEPT = 'COLLABORATION_ACCEPT'
+ COLLABORATION_EXPIRATION = 'COLLABORATION_EXPIRATION'
+ COLLABORATION_INVITE = 'COLLABORATION_INVITE'
+ COLLABORATION_REMOVE = 'COLLABORATION_REMOVE'
+ COLLABORATION_ROLE_CHANGE = 'COLLABORATION_ROLE_CHANGE'
+ COMMENT_CREATE = 'COMMENT_CREATE'
+ COMMENT_DELETE = 'COMMENT_DELETE'
+ CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY = (
+ 'CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY'
+ )
+ CONTENT_WORKFLOW_AUTOMATION_ADD = 'CONTENT_WORKFLOW_AUTOMATION_ADD'
+ CONTENT_WORKFLOW_AUTOMATION_DELETE = 'CONTENT_WORKFLOW_AUTOMATION_DELETE'
+ CONTENT_WORKFLOW_POLICY_ADD = 'CONTENT_WORKFLOW_POLICY_ADD'
+ CONTENT_WORKFLOW_SHARING_POLICY_VIOLATION = (
+ 'CONTENT_WORKFLOW_SHARING_POLICY_VIOLATION'
+ )
+ CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION = (
+ 'CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION'
+ )
+ COPY = 'COPY'
+ DATA_RETENTION_CREATE_RETENTION = 'DATA_RETENTION_CREATE_RETENTION'
+ DATA_RETENTION_REMOVE_RETENTION = 'DATA_RETENTION_REMOVE_RETENTION'
+ DELETE = 'DELETE'
+ DELETE_USER = 'DELETE_USER'
+ DEVICE_TRUST_CHECK_FAILED = 'DEVICE_TRUST_CHECK_FAILED'
+ DOWNLOAD = 'DOWNLOAD'
+ EDIT = 'EDIT'
+ EDIT_USER = 'EDIT_USER'
+ EMAIL_ALIAS_CONFIRM = 'EMAIL_ALIAS_CONFIRM'
+ EMAIL_ALIAS_REMOVE = 'EMAIL_ALIAS_REMOVE'
+ ENTERPRISE_APP_AUTHORIZATION_UPDATE = 'ENTERPRISE_APP_AUTHORIZATION_UPDATE'
+ EXTERNAL_COLLAB_SECURITY_SETTINGS = 'EXTERNAL_COLLAB_SECURITY_SETTINGS'
+ FAILED_LOGIN = 'FAILED_LOGIN'
+ FILE_MARKED_MALICIOUS = 'FILE_MARKED_MALICIOUS'
+ FILE_WATERMARKED_DOWNLOAD = 'FILE_WATERMARKED_DOWNLOAD'
+ GROUP_ADD_ITEM = 'GROUP_ADD_ITEM'
+ GROUP_ADD_USER = 'GROUP_ADD_USER'
+ GROUP_CREATION = 'GROUP_CREATION'
+ GROUP_DELETION = 'GROUP_DELETION'
+ GROUP_EDITED = 'GROUP_EDITED'
+ GROUP_REMOVE_ITEM = 'GROUP_REMOVE_ITEM'
+ GROUP_REMOVE_USER = 'GROUP_REMOVE_USER'
+ ITEM_EMAIL_SEND = 'ITEM_EMAIL_SEND'
+ ITEM_MODIFY = 'ITEM_MODIFY'
+ ITEM_OPEN = 'ITEM_OPEN'
+ ITEM_SHARED_UPDATE = 'ITEM_SHARED_UPDATE'
+ ITEM_SYNC = 'ITEM_SYNC'
+ ITEM_UNSYNC = 'ITEM_UNSYNC'
+ LEGAL_HOLD_ASSIGNMENT_CREATE = 'LEGAL_HOLD_ASSIGNMENT_CREATE'
+ LEGAL_HOLD_ASSIGNMENT_DELETE = 'LEGAL_HOLD_ASSIGNMENT_DELETE'
+ LEGAL_HOLD_POLICY_CREATE = 'LEGAL_HOLD_POLICY_CREATE'
+ LEGAL_HOLD_POLICY_DELETE = 'LEGAL_HOLD_POLICY_DELETE'
+ LEGAL_HOLD_POLICY_UPDATE = 'LEGAL_HOLD_POLICY_UPDATE'
+ LOCK = 'LOCK'
+ LOGIN = 'LOGIN'
+ METADATA_INSTANCE_CREATE = 'METADATA_INSTANCE_CREATE'
+ METADATA_INSTANCE_DELETE = 'METADATA_INSTANCE_DELETE'
+ METADATA_INSTANCE_UPDATE = 'METADATA_INSTANCE_UPDATE'
+ METADATA_TEMPLATE_CREATE = 'METADATA_TEMPLATE_CREATE'
+ METADATA_TEMPLATE_DELETE = 'METADATA_TEMPLATE_DELETE'
+ METADATA_TEMPLATE_UPDATE = 'METADATA_TEMPLATE_UPDATE'
+ MOVE = 'MOVE'
+ NEW_USER = 'NEW_USER'
+ OAUTH2_ACCESS_TOKEN_REVOKE = 'OAUTH2_ACCESS_TOKEN_REVOKE'
+ PREVIEW = 'PREVIEW'
+ REMOVE_DEVICE_ASSOCIATION = 'REMOVE_DEVICE_ASSOCIATION'
+ REMOVE_LOGIN_ACTIVITY_DEVICE = 'REMOVE_LOGIN_ACTIVITY_DEVICE'
+ RENAME = 'RENAME'
+ RETENTION_POLICY_ASSIGNMENT_ADD = 'RETENTION_POLICY_ASSIGNMENT_ADD'
+ SHARE = 'SHARE'
+ SHARED_LINK_SEND = 'SHARED_LINK_SEND'
+ SHARE_EXPIRATION = 'SHARE_EXPIRATION'
+ SHIELD_ALERT = 'SHIELD_ALERT'
+ SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED = 'SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED'
+ SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED_MISSING_JUSTIFICATION = (
+ 'SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED_MISSING_JUSTIFICATION'
+ )
+ SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED = 'SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED'
+ SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED_MISSING_JUSTIFICATION = (
+ 'SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED_MISSING_JUSTIFICATION'
+ )
+ SHIELD_JUSTIFICATION_APPROVAL = 'SHIELD_JUSTIFICATION_APPROVAL'
+ SHIELD_SHARED_LINK_ACCESS_BLOCKED = 'SHIELD_SHARED_LINK_ACCESS_BLOCKED'
+ SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_CREATE = (
+ 'SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_CREATE'
+ )
+ SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_UPDATE = (
+ 'SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_UPDATE'
+ )
+ SIGN_DOCUMENT_ASSIGNED = 'SIGN_DOCUMENT_ASSIGNED'
+ SIGN_DOCUMENT_CANCELLED = 'SIGN_DOCUMENT_CANCELLED'
+ SIGN_DOCUMENT_COMPLETED = 'SIGN_DOCUMENT_COMPLETED'
+ SIGN_DOCUMENT_CONVERTED = 'SIGN_DOCUMENT_CONVERTED'
+ SIGN_DOCUMENT_CREATED = 'SIGN_DOCUMENT_CREATED'
+ SIGN_DOCUMENT_DECLINED = 'SIGN_DOCUMENT_DECLINED'
+ SIGN_DOCUMENT_EXPIRED = 'SIGN_DOCUMENT_EXPIRED'
+ SIGN_DOCUMENT_SIGNED = 'SIGN_DOCUMENT_SIGNED'
+ SIGN_DOCUMENT_VIEWED_BY_SIGNED = 'SIGN_DOCUMENT_VIEWED_BY_SIGNED'
+ SIGNER_DOWNLOADED = 'SIGNER_DOWNLOADED'
+ SIGNER_FORWARDED = 'SIGNER_FORWARDED'
+ STORAGE_EXPIRATION = 'STORAGE_EXPIRATION'
+ TASK_ASSIGNMENT_CREATE = 'TASK_ASSIGNMENT_CREATE'
+ TASK_ASSIGNMENT_DELETE = 'TASK_ASSIGNMENT_DELETE'
+ TASK_ASSIGNMENT_UPDATE = 'TASK_ASSIGNMENT_UPDATE'
+ TASK_CREATE = 'TASK_CREATE'
+ TASK_UPDATE = 'TASK_UPDATE'
+ TERMS_OF_SERVICE_ACCEPT = 'TERMS_OF_SERVICE_ACCEPT'
+ TERMS_OF_SERVICE_REJECT = 'TERMS_OF_SERVICE_REJECT'
+ UNDELETE = 'UNDELETE'
+ UNLOCK = 'UNLOCK'
+ UNSHARE = 'UNSHARE'
+ UPDATE_COLLABORATION_EXPIRATION = 'UPDATE_COLLABORATION_EXPIRATION'
+ UPDATE_SHARE_EXPIRATION = 'UPDATE_SHARE_EXPIRATION'
+ UPLOAD = 'UPLOAD'
+ USER_AUTHENTICATE_OAUTH2_ACCESS_TOKEN_CREATE = (
+ 'USER_AUTHENTICATE_OAUTH2_ACCESS_TOKEN_CREATE'
+ )
+ WATERMARK_LABEL_CREATE = 'WATERMARK_LABEL_CREATE'
+ WATERMARK_LABEL_DELETE = 'WATERMARK_LABEL_DELETE'
+
+
+class EventsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_events_with_long_polling(
+ self, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RealtimeServers:
+ """
+ Returns a list of real-time servers that can be used for long-polling updates
+
+ to the [event stream](#get-events).
+
+
+ Long polling is the concept where a HTTP request is kept open until the
+
+
+ server sends a response, then repeating the process over and over to receive
+
+
+ updated responses.
+
+
+ Long polling the event stream can only be used for user events, not for
+
+
+ enterprise events.
+
+
+ To use long polling, first use this endpoint to retrieve a list of long poll
+
+
+ URLs. Next, make a long poll request to any of the provided URLs.
+
+
+ When an event occurs in monitored account a response with the value
+
+
+ `new_change` will be sent. The response contains no other details as
+
+
+ it only serves as a prompt to take further action such as sending a
+
+
+ request to the [events endpoint](#get-events) with the last known
+
+
+ `stream_position`.
+
+
+ After the server sends this response it closes the connection. You must now
+
+
+ repeat the long poll process to begin listening for events again.
+
+
+ If no events occur for a while and the connection times out you will
+
+
+ receive a response with the value `reconnect`. When you receive this response
+
+
+ you’ll make another call to this endpoint to restart the process.
+
+
+ If you receive no events in `retry_timeout` seconds then you will need to
+
+
+ make another request to the real-time server (one of the URLs in the response
+
+
+ for this endpoint). This might be necessary due to network errors.
+
+
+ Finally, if you receive a `max_retries` error when making a request to the
+
+
+ real-time server, you should start over by making a call to this endpoint
+
+
+ first.
+
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/events']),
+ method='OPTIONS',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RealtimeServers)
+
+ def get_events(
+ self,
+ *,
+ stream_type: Optional[GetEventsStreamType] = None,
+ stream_position: Optional[str] = None,
+ limit: Optional[int] = None,
+ event_type: Optional[List[GetEventsEventType]] = None,
+ created_after: Optional[DateTime] = None,
+ created_before: Optional[DateTime] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Events:
+ """
+ Returns up to a year of past events for a given user
+
+ or for the entire enterprise.
+
+
+ By default this returns events for the authenticated user. To retrieve events
+
+
+ for the entire enterprise, set the `stream_type` to `admin_logs_streaming`
+
+
+ for live monitoring of new events, or `admin_logs` for querying across
+
+
+ historical events. The user making the API call will
+
+
+ need to have admin privileges, and the application will need to have the
+
+
+ scope `manage enterprise properties` checked.
+
+ :param stream_type: Defines the type of events that are returned
+
+ * `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., defaults to None
+ :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.
+ * `0` or `null` will return all events., defaults to None
+ :type stream_position: Optional[str], optional
+ :param limit: 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., defaults to None
+ :type limit: Optional[int], optional
+ :param event_type: 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., defaults to None
+ :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., defaults to None
+ :type created_after: Optional[DateTime], optional
+ :param created_before: The upper 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., defaults to None
+ :type created_before: Optional[DateTime], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'stream_type': to_string(stream_type),
+ 'stream_position': to_string(stream_position),
+ 'limit': to_string(limit),
+ 'event_type': to_string(event_type),
+ 'created_after': to_string(created_after),
+ 'created_before': to_string(created_before),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/events']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Events)
diff --git a/box_sdk_gen/managers/file_classifications.py b/box_sdk_gen/managers/file_classifications.py
new file mode 100644
index 000000000..c38a2bbff
--- /dev/null
+++ b/box_sdk_gen/managers/file_classifications.py
@@ -0,0 +1,313 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from typing import List
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.classification import Classification
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class UpdateClassificationOnFileRequestBodyOpField(str, Enum):
+ REPLACE = 'replace'
+
+
+class UpdateClassificationOnFileRequestBodyPathField(str, Enum):
+ _BOX__SECURITY__CLASSIFICATION__KEY = '/Box__Security__Classification__Key'
+
+
+class UpdateClassificationOnFileRequestBody(BaseObject):
+ def __init__(
+ self,
+ value: str,
+ *,
+ op: UpdateClassificationOnFileRequestBodyOpField = UpdateClassificationOnFileRequestBodyOpField.REPLACE,
+ path: UpdateClassificationOnFileRequestBodyPathField = UpdateClassificationOnFileRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY,
+ **kwargs
+ ):
+ """
+ :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: str
+ :param op: The value will always be `replace`., defaults to UpdateClassificationOnFileRequestBodyOpField.REPLACE
+ :type op: UpdateClassificationOnFileRequestBodyOpField, optional
+ :param path: Defines classifications
+ available in the enterprise., defaults to UpdateClassificationOnFileRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY
+ :type path: UpdateClassificationOnFileRequestBodyPathField, optional
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.op = op
+ self.path = path
+
+
+class FileClassificationsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_classification_on_file(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Classification:
+ """
+ Retrieves the classification metadata instance that
+
+ has been applied to a file.
+
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/enterprise/securityClassification-6VMVochwUWo',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Classification)
+
+ def add_classification_to_file(
+ self,
+ file_id: str,
+ *,
+ box_security_classification_key: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Classification:
+ """
+ Adds a classification to a file by specifying the label of the
+
+ classification to add.
+
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param box_security_classification_key: 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., defaults to None
+ :type box_security_classification_key: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'Box__Security__Classification__Key': box_security_classification_key
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/enterprise/securityClassification-6VMVochwUWo',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Classification)
+
+ def update_classification_on_file(
+ self,
+ file_id: str,
+ request_body: List[UpdateClassificationOnFileRequestBody],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Classification:
+ """
+ Updates a classification on a file.
+
+ The classification can only be updated if a classification has already been
+
+
+ applied to the file before. When editing classifications, only values are
+
+
+ defined for the enterprise will be accepted.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :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., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/enterprise/securityClassification-6VMVochwUWo',
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json-patch+json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Classification)
+
+ def delete_classification_from_file(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes any classifications from a file.
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/enterprise/securityClassification-6VMVochwUWo',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/file_metadata.py b/box_sdk_gen/managers/file_metadata.py
new file mode 100644
index 000000000..8dc0577f2
--- /dev/null
+++ b/box_sdk_gen/managers/file_metadata.py
@@ -0,0 +1,420 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from typing import List
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.metadatas import Metadatas
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.metadata_full import MetadataFull
+
+from box_sdk_gen.schemas.metadata_error import MetadataError
+
+from box_sdk_gen.schemas.metadata_instance_value import MetadataInstanceValue
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetFileMetadataByIdScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class CreateFileMetadataByIdScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class UpdateFileMetadataByIdScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class UpdateFileMetadataByIdRequestBodyOpField(str, Enum):
+ ADD = 'add'
+ REPLACE = 'replace'
+ REMOVE = 'remove'
+ TEST = 'test'
+ MOVE = 'move'
+ COPY = 'copy'
+
+
+class UpdateFileMetadataByIdRequestBody(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'from_': 'from',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'from': 'from_',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ op: Optional[UpdateFileMetadataByIdRequestBodyOpField] = None,
+ path: Optional[str] = None,
+ value: Optional[MetadataInstanceValue] = None,
+ from_: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param op: The type of change to perform on the template. Some
+ of these are hazardous as they will change existing templates., defaults to None
+ :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).
+
+ The path must always be prefixed with a `/` to represent the root
+ of the template. The characters `~` and `/` are reserved
+ characters and must be escaped in the key., defaults to None
+ :type path: Optional[str], optional
+ :param from_: The location in the metadata JSON object to move or copy a value
+ from. Required for `move` or `copy` operations and must be in the
+ format of a [JSON-Pointer](https://tools.ietf.org/html/rfc6901)., defaults to None
+ :type from_: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.op = op
+ self.path = path
+ self.value = value
+ self.from_ = from_
+
+
+class DeleteFileMetadataByIdScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class FileMetadataManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_metadata(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Metadatas:
+ """
+ Retrieves all metadata for a given file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Metadatas)
+
+ def get_file_metadata_by_id(
+ self,
+ file_id: str,
+ scope: GetFileMetadataByIdScope,
+ template_key: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataFull:
+ """
+ Retrieves the instance of a metadata template that has been applied to a
+
+ file.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :type scope: GetFileMetadataByIdScope
+ :param template_key: The name of the metadata template.
+ Example: "properties"
+ :type template_key: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataFull)
+
+ def create_file_metadata_by_id(
+ self,
+ file_id: str,
+ scope: CreateFileMetadataByIdScope,
+ template_key: str,
+ request_body: Dict,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataFull:
+ """
+ Applies an instance of a metadata template to a file.
+
+ In most cases only values that are present in the metadata template
+
+
+ will be accepted, except for the `global.properties` template which accepts
+
+
+ any key-value pair.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :type scope: CreateFileMetadataByIdScope
+ :param template_key: The name of the metadata template.
+ Example: "properties"
+ :type template_key: str
+ :param request_body: Request body of createFileMetadataById method
+ :type request_body: Dict
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataFull)
+
+ def update_file_metadata_by_id(
+ self,
+ file_id: str,
+ scope: UpdateFileMetadataByIdScope,
+ template_key: str,
+ request_body: List[UpdateFileMetadataByIdRequestBody],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataFull:
+ """
+ Updates a piece of metadata on a file.
+
+ The metadata instance can only be updated if the template has already been
+
+
+ applied to the file before. When editing metadata, only values that match
+
+
+ the metadata template schema will be accepted.
+
+
+ The update is applied atomically. If any errors occur during the
+
+
+ application of the operations, the metadata instance will not be changed.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :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[UpdateFileMetadataByIdRequestBody]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json-patch+json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataFull)
+
+ def delete_file_metadata_by_id(
+ self,
+ file_id: str,
+ scope: DeleteFileMetadataByIdScope,
+ template_key: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a piece of file metadata.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :type scope: DeleteFileMetadataByIdScope
+ :param template_key: The name of the metadata template.
+ Example: "properties"
+ :type template_key: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/file_requests.py b/box_sdk_gen/managers/file_requests.py
new file mode 100644
index 000000000..594365858
--- /dev/null
+++ b/box_sdk_gen/managers/file_requests.py
@@ -0,0 +1,398 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.file_request import FileRequest
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.file_request_update_request import FileRequestUpdateRequest
+
+from box_sdk_gen.schemas.file_request_copy_request import FileRequestCopyRequest
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class UpdateFileRequestByIdStatus(str, Enum):
+ ACTIVE = 'active'
+ INACTIVE = 'inactive'
+
+
+class CreateFileRequestCopyFolderTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class CreateFileRequestCopyFolder(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: Optional[CreateFileRequestCopyFolderTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the folder to associate the new
+ file request to.
+ :type id: str
+ :param type: The value will always be `folder`., defaults to None
+ :type type: Optional[CreateFileRequestCopyFolderTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CreateFileRequestCopyStatus(str, Enum):
+ ACTIVE = 'active'
+ INACTIVE = 'inactive'
+
+
+class FileRequestsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_request_by_id(
+ self,
+ file_request_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileRequest:
+ """
+ Retrieves the information about a file request.
+ :param file_request_id: The unique identifier that represent a file request.
+
+ 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"
+ :type file_request_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/file_requests/',
+ to_string(file_request_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileRequest)
+
+ def update_file_request_by_id(
+ self,
+ file_request_id: str,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ status: Optional[UpdateFileRequestByIdStatus] = None,
+ is_email_required: Optional[bool] = None,
+ is_description_required: Optional[bool] = None,
+ expires_at: Optional[DateTime] = None,
+ if_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileRequest:
+ """
+ Updates a file request. This can be used to activate or
+
+ deactivate a file request.
+
+ :param file_request_id: The unique identifier that represent a file request.
+
+ 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"
+ :type file_request_id: str
+ :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., defaults to None
+ :type title: Optional[str], optional
+ :param description: 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., defaults to None
+ :type description: Optional[str], optional
+ :param status: 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., defaults to None
+ :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
+ an email field on the file request form.
+
+ This will default to the value on the existing file request., defaults to None
+ :type is_email_required: Optional[bool], optional
+ :param is_description_required: Whether a file request submitter is required to provide
+ a description of the files they are submitting.
+
+ When this setting is set to true, the Box UI will show
+ a description field on the file request form.
+
+ This will default to the value on the existing file request., defaults to None
+ :type is_description_required: Optional[bool], optional
+ :param expires_at: The date after which a file request will no longer accept new
+ submissions.
+
+ After this date, the `status` will automatically be set to
+ `inactive`.
+
+ This will default to the value on the existing file request., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'title': title,
+ 'description': description,
+ 'status': status,
+ 'is_email_required': is_email_required,
+ 'is_description_required': is_description_required,
+ 'expires_at': expires_at,
+ }
+ headers_map: Dict[str, str] = prepare_params(
+ {'if-match': to_string(if_match), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/file_requests/',
+ to_string(file_request_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileRequest)
+
+ def delete_file_request_by_id(
+ self,
+ file_request_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a file request permanently.
+ :param file_request_id: The unique identifier that represent a file request.
+
+ 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"
+ :type file_request_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/file_requests/',
+ to_string(file_request_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def create_file_request_copy(
+ self,
+ file_request_id: str,
+ folder: CreateFileRequestCopyFolder,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ status: Optional[CreateFileRequestCopyStatus] = None,
+ is_email_required: Optional[bool] = None,
+ is_description_required: Optional[bool] = None,
+ expires_at: Optional[DateTime] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileRequest:
+ """
+ Copies an existing file request that is already present on one folder,
+
+ and applies it to another folder.
+
+ :param file_request_id: The unique identifier that represent a file request.
+
+ 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"
+ :type file_request_id: str
+ :param folder: The folder to associate the new file request to.
+ :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., defaults to None
+ :type title: Optional[str], optional
+ :param description: 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., defaults to None
+ :type description: Optional[str], optional
+ :param status: 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., defaults to None
+ :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
+ an email field on the file request form.
+
+ This will default to the value on the existing file request., defaults to None
+ :type is_email_required: Optional[bool], optional
+ :param is_description_required: Whether a file request submitter is required to provide
+ a description of the files they are submitting.
+
+ When this setting is set to true, the Box UI will show
+ a description field on the file request form.
+
+ This will default to the value on the existing file request., defaults to None
+ :type is_description_required: Optional[bool], optional
+ :param expires_at: The date after which a file request will no longer accept new
+ submissions.
+
+ After this date, the `status` will automatically be set to
+ `inactive`.
+
+ This will default to the value on the existing file request., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'folder': folder,
+ 'title': title,
+ 'description': description,
+ 'status': status,
+ 'is_email_required': is_email_required,
+ 'is_description_required': is_description_required,
+ 'expires_at': expires_at,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/file_requests/',
+ to_string(file_request_id),
+ '/copy',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileRequest)
diff --git a/box_sdk_gen/managers/file_version_legal_holds.py b/box_sdk_gen/managers/file_version_legal_holds.py
new file mode 100644
index 000000000..2dc2451de
--- /dev/null
+++ b/box_sdk_gen/managers/file_version_legal_holds.py
@@ -0,0 +1,179 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.file_version_legal_hold import FileVersionLegalHold
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.file_version_legal_holds import FileVersionLegalHolds
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class FileVersionLegalHoldsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_version_legal_hold_by_id(
+ self,
+ file_version_legal_hold_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileVersionLegalHold:
+ """
+ Retrieves information about the legal hold policies
+
+ assigned to a file version.
+
+ :param file_version_legal_hold_id: The ID of the file version legal hold.
+ Example: "2348213"
+ :type file_version_legal_hold_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/file_version_legal_holds/',
+ to_string(file_version_legal_hold_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileVersionLegalHold)
+
+ def get_file_version_legal_holds(
+ self,
+ policy_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileVersionLegalHolds:
+ """
+ Get a list of file versions on legal hold for a legal hold
+
+ assignment.
+
+
+ Due to ongoing re-architecture efforts this API might not return all file
+
+
+ versions for this policy ID.
+
+
+ Instead, this API will only return file versions held in the legacy
+
+
+ architecture. Two new endpoints will available to request any file versions
+
+
+ held in the new architecture.
+
+
+ For file versions held in the new architecture, the `GET
+
+
+ /legal_hold_policy_assignments/:id/file_versions_on_hold` API can be used to
+
+
+ return all past file versions available for this policy assignment, and the
+
+
+ `GET /legal_hold_policy_assignments/:id/files_on_hold` API can be used to
+
+
+ return any current (latest) versions of a file under legal hold.
+
+
+ The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to
+
+
+ find a list of policy assignments for a given policy ID.
+
+
+ Once the re-architecture is completed this API will be deprecated.
+
+ :param policy_id: The ID of the legal hold policy to get the file version legal
+ holds for.
+ :type policy_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'policy_id': to_string(policy_id),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/file_version_legal_holds',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileVersionLegalHolds)
diff --git a/box_sdk_gen/managers/file_version_retentions.py b/box_sdk_gen/managers/file_version_retentions.py
new file mode 100644
index 000000000..8c2ddf75c
--- /dev/null
+++ b/box_sdk_gen/managers/file_version_retentions.py
@@ -0,0 +1,187 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.file_version_retentions import FileVersionRetentions
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.file_version_retention import FileVersionRetention
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetFileVersionRetentionsDispositionAction(str, Enum):
+ PERMANENTLY_DELETE = 'permanently_delete'
+ REMOVE_RETENTION = 'remove_retention'
+
+
+class FileVersionRetentionsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_version_retentions(
+ self,
+ *,
+ file_id: Optional[str] = None,
+ file_version_id: Optional[str] = None,
+ policy_id: Optional[str] = None,
+ disposition_action: Optional[GetFileVersionRetentionsDispositionAction] = None,
+ disposition_before: Optional[str] = None,
+ disposition_after: Optional[str] = None,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileVersionRetentions:
+ """
+ Retrieves all file version retentions for the given enterprise.
+
+ **Note**:
+
+
+ File retention API is now **deprecated**.
+
+
+ To get information about files and file versions under retention,
+
+
+ see [files under retention](e://get-retention-policy-assignments-id-files-under-retention) or [file versions under retention](e://get-retention-policy-assignments-id-file-versions-under-retention) endpoints.
+
+ :param file_id: Filters results by files with this ID., defaults to None
+ :type file_id: Optional[str], optional
+ :param file_version_id: Filters results by file versions with this ID., defaults to None
+ :type file_version_id: Optional[str], optional
+ :param policy_id: Filters results by the retention policy with this ID., defaults to None
+ :type policy_id: Optional[str], optional
+ :param disposition_action: Filters results by the retention policy with this disposition
+ action., defaults to None
+ :type disposition_action: Optional[GetFileVersionRetentionsDispositionAction], optional
+ :param disposition_before: Filters results by files that will have their disposition
+ come into effect before this date., defaults to None
+ :type disposition_before: Optional[str], optional
+ :param disposition_after: Filters results by files that will have their disposition
+ come into effect after this date., defaults to None
+ :type disposition_after: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'file_id': to_string(file_id),
+ 'file_version_id': to_string(file_version_id),
+ 'policy_id': to_string(policy_id),
+ 'disposition_action': to_string(disposition_action),
+ 'disposition_before': to_string(disposition_before),
+ 'disposition_after': to_string(disposition_after),
+ 'limit': to_string(limit),
+ 'marker': to_string(marker),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/file_version_retentions',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileVersionRetentions)
+
+ def get_file_version_retention_by_id(
+ self,
+ file_version_retention_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileVersionRetention:
+ """
+ Returns information about a file version retention.
+
+ **Note**:
+
+
+ File retention API is now **deprecated**.
+
+
+ To get information about files and file versions under retention,
+
+
+ see [files under retention](e://get-retention-policy-assignments-id-files-under-retention) or [file versions under retention](e://get-retention-policy-assignments-id-file-versions-under-retention) endpoints.
+
+ :param file_version_retention_id: The ID of the file version retention.
+ Example: "3424234"
+ :type file_version_retention_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/file_version_retentions/',
+ to_string(file_version_retention_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileVersionRetention)
diff --git a/box_sdk_gen/managers/file_versions.py b/box_sdk_gen/managers/file_versions.py
new file mode 100644
index 000000000..5f79b0122
--- /dev/null
+++ b/box_sdk_gen/managers/file_versions.py
@@ -0,0 +1,423 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.file_versions import FileVersions
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.file_version_full import FileVersionFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class PromoteFileVersionType(str, Enum):
+ FILE_VERSION = 'file_version'
+
+
+class FileVersionsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_versions(
+ self,
+ file_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileVersions:
+ """
+ Retrieve a list of the past versions for a file.
+
+ Versions are only tracked by Box users with premium accounts. To fetch the ID
+
+
+ of the current version of a file, use the `GET /file/:id` API.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'limit': to_string(limit),
+ 'offset': to_string(offset),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/versions',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileVersions)
+
+ def get_file_version_by_id(
+ self,
+ file_id: str,
+ file_version_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileVersionFull:
+ """
+ Retrieve a specific version of a file.
+
+ Versions are only tracked for Box users with premium accounts.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param file_version_id: The ID of the file version.
+ Example: "1234"
+ :type file_version_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/versions/',
+ to_string(file_version_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileVersionFull)
+
+ def delete_file_version_by_id(
+ self,
+ file_id: str,
+ file_version_id: str,
+ *,
+ if_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Move a file version to the trash.
+
+ Versions are only tracked for Box users with premium accounts.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param file_version_id: The ID of the file version.
+ Example: "1234"
+ :type file_version_id: str
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'if-match': to_string(if_match), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/versions/',
+ to_string(file_version_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def update_file_version_by_id(
+ self,
+ file_id: str,
+ file_version_id: str,
+ *,
+ trashed_at: Union[Optional[str], NullValue] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileVersionFull:
+ """
+ Restores a specific version of a file after it was deleted.
+
+ Don't use this endpoint to restore Box Notes,
+
+
+ as it works with file formats such as PDF, DOC,
+
+
+ PPTX or similar.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param file_version_id: The ID of the file version.
+ Example: "1234"
+ :type file_version_id: str
+ :param trashed_at: Set this to `null` to clear
+ the date and restore the file., defaults to None
+ :type trashed_at: Union[Optional[str], NullValue], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'trashed_at': trashed_at}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/versions/',
+ to_string(file_version_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileVersionFull)
+
+ def promote_file_version(
+ self,
+ file_id: str,
+ *,
+ id: Optional[str] = None,
+ type: Optional[PromoteFileVersionType] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileVersionFull:
+ """
+ Promote a specific version of a file.
+
+ If previous versions exist, this method can be used to
+
+
+ promote one of the older versions to the top of the version history.
+
+
+ This creates a new copy of the old version and puts it at the
+
+
+ top of the versions history. The file will have the exact same contents
+
+
+ as the older version, with the the same hash digest, `etag`, and
+
+
+ name as the original.
+
+
+ Other properties such as comments do not get updated to their
+
+
+ former values.
+
+
+ Don't use this endpoint to restore Box Notes,
+
+
+ as it works with file formats such as PDF, DOC,
+
+
+ PPTX or similar.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param id: The file version ID., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type to promote., defaults to None
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'id': id, 'type': type}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/versions/current',
+ ]
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileVersionFull)
diff --git a/box_sdk_gen/managers/file_watermarks.py b/box_sdk_gen/managers/file_watermarks.py
new file mode 100644
index 000000000..c82eeb42d
--- /dev/null
+++ b/box_sdk_gen/managers/file_watermarks.py
@@ -0,0 +1,199 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.watermark import Watermark
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class UpdateFileWatermarkWatermarkImprintField(str, Enum):
+ DEFAULT = 'default'
+
+
+class UpdateFileWatermarkWatermark(BaseObject):
+ def __init__(
+ self,
+ *,
+ imprint: UpdateFileWatermarkWatermarkImprintField = UpdateFileWatermarkWatermarkImprintField.DEFAULT,
+ **kwargs
+ ):
+ """
+ :param imprint: The type of watermark to apply.
+
+ Currently only supports one option., defaults to UpdateFileWatermarkWatermarkImprintField.DEFAULT
+ :type imprint: UpdateFileWatermarkWatermarkImprintField, optional
+ """
+ super().__init__(**kwargs)
+ self.imprint = imprint
+
+
+class FileWatermarksManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_watermark(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Watermark:
+ """
+ Retrieve the watermark for a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/watermark',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Watermark)
+
+ def update_file_watermark(
+ self,
+ file_id: str,
+ watermark: UpdateFileWatermarkWatermark,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Watermark:
+ """
+ Applies or update a watermark on a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param watermark: The watermark to imprint on the file.
+ :type watermark: UpdateFileWatermarkWatermark
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'watermark': watermark}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/watermark',
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Watermark)
+
+ def delete_file_watermark(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes the watermark from a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/watermark',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/files.py b/box_sdk_gen/managers/files.py
new file mode 100644
index 000000000..6b975d358
--- /dev/null
+++ b/box_sdk_gen/managers/files.py
@@ -0,0 +1,786 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from enum import Enum
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class UpdateFileByIdParent(BaseObject):
+ def __init__(
+ self, *, id: Optional[str] = None, user_id: Optional[str] = None, **kwargs
+ ):
+ """
+ :param id: The ID of parent item., defaults to None
+ :type id: Optional[str], optional
+ :param user_id: The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided., defaults to None
+ :type user_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.user_id = user_id
+
+
+class UpdateFileByIdSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class UpdateFileByIdSharedLinkPermissionsField(BaseObject):
+ def __init__(self, *, can_download: Optional[bool] = None, **kwargs):
+ """
+ :param can_download: If the shared link allows for downloading of files.
+ This can only be set when `access` is set to
+ `open` or `company`., defaults to None
+ :type can_download: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+
+
+class UpdateFileByIdSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[UpdateFileByIdSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[UpdateFileByIdSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the folder (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class UpdateFileByIdLockAccessField(str, Enum):
+ LOCK = 'lock'
+
+
+class UpdateFileByIdLock(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[UpdateFileByIdLockAccessField] = None,
+ expires_at: Optional[DateTime] = None,
+ is_download_prevented: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param access: The type of this object., defaults to None
+ :type access: Optional[UpdateFileByIdLockAccessField], optional
+ :param expires_at: Defines the time at which the lock expires., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ :param is_download_prevented: Defines if the file can be downloaded while it is locked., defaults to None
+ :type is_download_prevented: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.expires_at = expires_at
+ self.is_download_prevented = is_download_prevented
+
+
+class UpdateFileByIdPermissionsCanDownloadField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+
+
+class UpdateFileByIdPermissions(BaseObject):
+ def __init__(
+ self,
+ *,
+ can_download: Optional[UpdateFileByIdPermissionsCanDownloadField] = None,
+ **kwargs
+ ):
+ """
+ :param can_download: Defines who is allowed to download this file. The possible
+ values are either `open` for everyone or `company` for
+ the other members of the user's enterprise.
+
+ This setting overrides the download permissions that are
+ 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., defaults to None
+ :type can_download: Optional[UpdateFileByIdPermissionsCanDownloadField], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+
+
+class UpdateFileByIdCollections(BaseObject):
+ def __init__(
+ self, *, id: Optional[str] = None, type: Optional[str] = None, **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type for this object., defaults to None
+ :type type: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CopyFileParent(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of folder to copy the file to.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class GetFileThumbnailUrlExtension(str, Enum):
+ PNG = 'png'
+ JPG = 'jpg'
+
+
+class GetFileThumbnailByIdExtension(str, Enum):
+ PNG = 'png'
+ JPG = 'jpg'
+
+
+class FilesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_by_id(
+ self,
+ file_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ if_none_match: Optional[str] = None,
+ boxapi: Optional[str] = None,
+ x_rep_hints: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileFull:
+ """
+ Retrieves the details about a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :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.
+
+ 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.
+
+ Additionally this field can be used to query any metadata
+ applied to the file by specifying the `metadata` field as well
+ as the scope and key of the template to retrieve, for example
+ `?fields=metadata.enterprise_12345.contractTemplate`., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param if_none_match: Ensures an item is only returned if it has changed.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `304 Not Modified` if the item has not
+ changed since., defaults to None
+ :type if_none_match: Optional[str], 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.
+
+ Use the format `shared_link=[link]` or if a password is required then
+ use `shared_link=[link]&shared_link_password=[password]`.
+
+ This header can be used on the file or folder shared, as well as on any files
+ or folders nested within the item., defaults to None
+ :type boxapi: Optional[str], optional
+ :param x_rep_hints: A header required to request specific `representations`
+ of a file. Use this in combination with the `fields` query
+ parameter to request a specific file representation.
+
+ The general format for these representations is
+ `X-Rep-Hints: [...]` where `[...]` is one or many
+ hints in the format `[fileType?query]`.
+
+ For example, to request a `png` representation in `32x32`
+ as well as `64x64` pixel dimensions provide the following
+ hints.
+
+ `x-rep-hints: [jpg?dimensions=32x32][jpg?dimensions=64x64]`
+
+ Additionally, a `text` representation is available for all
+ document file types in Box using the `[extracted_text]`
+ representation.
+
+ `x-rep-hints: [extracted_text]`., defaults to None
+ :type x_rep_hints: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'if-none-match': to_string(if_none_match),
+ 'boxapi': to_string(boxapi),
+ 'x-rep-hints': to_string(x_rep_hints),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileFull)
+
+ def update_file_by_id(
+ self,
+ file_id: str,
+ *,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ parent: Optional[UpdateFileByIdParent] = None,
+ shared_link: Union[Optional[UpdateFileByIdSharedLink], NullValue] = None,
+ lock: Union[Optional[UpdateFileByIdLock], NullValue] = None,
+ disposition_at: Optional[DateTime] = None,
+ permissions: Optional[UpdateFileByIdPermissions] = None,
+ collections: Union[Optional[List[UpdateFileByIdCollections]], NullValue] = None,
+ tags: Optional[List[str]] = None,
+ fields: Optional[List[str]] = None,
+ if_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileFull:
+ """
+ Updates a file. This can be used to rename or move a file,
+
+ create a shared link, or lock a file.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param name: An optional different name for the file. This can be used to
+ rename the file.
+
+ File names must be unique within their parent folder. The name check is case-insensitive, so a file
+ named `New File` cannot be created in a parent folder that already contains a folder named `new file`., defaults to None
+ :type name: Optional[str], optional
+ :param description: The description for a file. This can be seen in the right-hand sidebar panel
+ when viewing a file in the Box web app. Additionally, this index is used in
+ the search index of the file, allowing users to find the file by the content
+ in the description., defaults to None
+ :type description: Optional[str], optional
+ :param lock: Defines a lock on an item. This prevents the item from being
+ moved, renamed, or otherwise changed by anyone other than the user
+ who created the lock.
+
+ Set this to `null` to remove the lock., defaults to None
+ :type lock: Union[Optional[UpdateFileByIdLock], NullValue], optional
+ :param disposition_at: The retention expiration timestamp for the given file. This
+ date cannot be shortened once set on a file., defaults to None
+ :type disposition_at: Optional[DateTime], optional
+ :param permissions: Defines who can download a file., defaults to None
+ :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.
+
+ To get the ID for a collection, use the
+ [List all collections][1] endpoint.
+
+ Passing an empty array `[]` or `null` will remove
+ the file from all collections.
+
+ [1]: e://get-collections, defaults to None
+ :type collections: Union[Optional[List[UpdateFileByIdCollections]], NullValue], 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,
+ modify them, and then update this field.
+
+ There is a limit of 100 tags per item, and 10,000
+ unique tags per enterprise., defaults to None
+ :type tags: Optional[List[str]], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'name': name,
+ 'description': description,
+ 'parent': parent,
+ 'shared_link': shared_link,
+ 'lock': lock,
+ 'disposition_at': disposition_at,
+ 'permissions': permissions,
+ 'collections': collections,
+ 'tags': tags,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {'if-match': to_string(if_match), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileFull)
+
+ def delete_file_by_id(
+ self,
+ file_id: str,
+ *,
+ if_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a file, either permanently or by moving it to
+
+ the trash.
+
+
+ The the enterprise settings determine whether the item will
+
+
+ be permanently deleted from Box or moved to the trash.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'if-match': to_string(if_match), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def copy_file(
+ self,
+ file_id: str,
+ parent: CopyFileParent,
+ *,
+ name: Optional[str] = None,
+ version: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileFull:
+ r"""
+ Creates a copy of a file.
+ :param 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"
+ :type file_id: str
+ :param parent: The destination folder to copy the file to.
+ :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
+ (`/`, `\`), and protected names like `.` and `..` are
+ automatically sanitized by removing the non-allowed
+ characters., defaults to None
+ :type name: Optional[str], optional
+ :param version: An optional ID of the specific file version to copy., defaults to None
+ :type version: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'name': name, 'version': version, 'parent': parent}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/copy',
+ ]
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileFull)
+
+ def get_file_thumbnail_url(
+ self,
+ file_id: str,
+ extension: GetFileThumbnailUrlExtension,
+ *,
+ min_height: Optional[int] = None,
+ min_width: Optional[int] = None,
+ max_height: Optional[int] = None,
+ max_width: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> str:
+ """
+ Retrieves a thumbnail, or smaller image representation, of a file.
+
+ Sizes of `32x32`,`64x64`, `128x128`, and `256x256` can be returned in
+
+
+ the `.png` format and sizes of `32x32`, `160x160`, and `320x320`
+
+
+ can be returned in the `.jpg` format.
+
+
+ Thumbnails can be generated for the image and video file formats listed
+
+
+ [found on our community site][1].
+
+
+ [1]: https://community.box.com/t5/Migrating-and-Previewing-Content/File-Types-and-Fonts-Supported-in-Box-Content-Preview/ta-p/327
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extension: The file format for the thumbnail.
+ Example: "png"
+ :type extension: GetFileThumbnailUrlExtension
+ :param min_height: The minimum height of the thumbnail., defaults to None
+ :type min_height: Optional[int], optional
+ :param min_width: The minimum width of the thumbnail., defaults to None
+ :type min_width: Optional[int], optional
+ :param max_height: The maximum height of the thumbnail., defaults to None
+ :type max_height: Optional[int], optional
+ :param max_width: The maximum width of the thumbnail., defaults to None
+ :type max_width: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'min_height': to_string(min_height),
+ 'min_width': to_string(min_width),
+ 'max_height': to_string(max_height),
+ 'max_width': to_string(max_width),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/thumbnail.',
+ to_string(extension),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ follow_redirects=False,
+ )
+ )
+ if 'location' in response.headers:
+ return response.headers.get('location')
+ if 'Location' in response.headers:
+ return response.headers.get('Location')
+ raise BoxSDKError(message='No location header in response')
+
+ def get_file_thumbnail_by_id(
+ self,
+ file_id: str,
+ extension: GetFileThumbnailByIdExtension,
+ *,
+ min_height: Optional[int] = None,
+ min_width: Optional[int] = None,
+ max_height: Optional[int] = None,
+ max_width: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Optional[ByteStream]:
+ """
+ Retrieves a thumbnail, or smaller image representation, of a file.
+
+ Sizes of `32x32`,`64x64`, `128x128`, and `256x256` can be returned in
+
+
+ the `.png` format and sizes of `32x32`, `160x160`, and `320x320`
+
+
+ can be returned in the `.jpg` format.
+
+
+ Thumbnails can be generated for the image and video file formats listed
+
+
+ [found on our community site][1].
+
+
+ [1]: https://community.box.com/t5/Migrating-and-Previewing-Content/File-Types-and-Fonts-Supported-in-Box-Content-Preview/ta-p/327
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extension: The file format for the thumbnail.
+ Example: "png"
+ :type extension: GetFileThumbnailByIdExtension
+ :param min_height: The minimum height of the thumbnail., defaults to None
+ :type min_height: Optional[int], optional
+ :param min_width: The minimum width of the thumbnail., defaults to None
+ :type min_width: Optional[int], optional
+ :param max_height: The maximum height of the thumbnail., defaults to None
+ :type max_height: Optional[int], optional
+ :param max_width: The maximum width of the thumbnail., defaults to None
+ :type max_width: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'min_height': to_string(min_height),
+ 'min_width': to_string(min_width),
+ 'max_height': to_string(max_height),
+ 'max_width': to_string(max_width),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/thumbnail.',
+ to_string(extension),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.BINARY,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ if to_string(response.status) == '202':
+ return None
+ return response.content
diff --git a/box_sdk_gen/managers/folder_classifications.py b/box_sdk_gen/managers/folder_classifications.py
new file mode 100644
index 000000000..4192936a7
--- /dev/null
+++ b/box_sdk_gen/managers/folder_classifications.py
@@ -0,0 +1,331 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from typing import List
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.classification import Classification
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class UpdateClassificationOnFolderRequestBodyOpField(str, Enum):
+ REPLACE = 'replace'
+
+
+class UpdateClassificationOnFolderRequestBodyPathField(str, Enum):
+ _BOX__SECURITY__CLASSIFICATION__KEY = '/Box__Security__Classification__Key'
+
+
+class UpdateClassificationOnFolderRequestBody(BaseObject):
+ def __init__(
+ self,
+ value: str,
+ *,
+ op: UpdateClassificationOnFolderRequestBodyOpField = UpdateClassificationOnFolderRequestBodyOpField.REPLACE,
+ path: UpdateClassificationOnFolderRequestBodyPathField = UpdateClassificationOnFolderRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY,
+ **kwargs
+ ):
+ """
+ :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: str
+ :param op: The value will always be `replace`., defaults to UpdateClassificationOnFolderRequestBodyOpField.REPLACE
+ :type op: UpdateClassificationOnFolderRequestBodyOpField, optional
+ :param path: Defines classifications
+ available in the enterprise., defaults to UpdateClassificationOnFolderRequestBodyPathField._BOX__SECURITY__CLASSIFICATION__KEY
+ :type path: UpdateClassificationOnFolderRequestBodyPathField, optional
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.op = op
+ self.path = path
+
+
+class FolderClassificationsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_classification_on_folder(
+ self,
+ folder_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Classification:
+ """
+ Retrieves the classification metadata instance that
+
+ has been applied to a folder.
+
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata/enterprise/securityClassification-6VMVochwUWo',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Classification)
+
+ def add_classification_to_folder(
+ self,
+ folder_id: str,
+ *,
+ box_security_classification_key: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Classification:
+ """
+ Adds a classification to a folder by specifying the label of the
+
+ classification to add.
+
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param box_security_classification_key: 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., defaults to None
+ :type box_security_classification_key: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'Box__Security__Classification__Key': box_security_classification_key
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata/enterprise/securityClassification-6VMVochwUWo',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Classification)
+
+ def update_classification_on_folder(
+ self,
+ folder_id: str,
+ request_body: List[UpdateClassificationOnFolderRequestBody],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Classification:
+ """
+ Updates a classification on a folder.
+
+ The classification can only be updated if a classification has already been
+
+
+ applied to the folder before. When editing classifications, only values are
+
+
+ defined for the enterprise will be accepted.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :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., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata/enterprise/securityClassification-6VMVochwUWo',
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json-patch+json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Classification)
+
+ def delete_classification_from_folder(
+ self,
+ folder_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes any classifications from a folder.
+
+ This API can also be called by including the enterprise ID in the
+
+
+ URL explicitly, for example
+
+
+ `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata/enterprise/securityClassification-6VMVochwUWo',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/folder_locks.py b/box_sdk_gen/managers/folder_locks.py
new file mode 100644
index 000000000..c7c7e8e39
--- /dev/null
+++ b/box_sdk_gen/managers/folder_locks.py
@@ -0,0 +1,216 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.folder_locks import FolderLocks
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.folder_lock import FolderLock
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateFolderLockLockedOperations(BaseObject):
+ def __init__(self, move: bool, delete: bool, **kwargs):
+ """
+ :param move: Whether moving the folder should be locked.
+ :type move: bool
+ :param delete: Whether deleting the folder should be locked.
+ :type delete: bool
+ """
+ super().__init__(**kwargs)
+ self.move = move
+ self.delete = delete
+
+
+class CreateFolderLockFolder(BaseObject):
+ def __init__(self, type: str, id: str, **kwargs):
+ """
+ :param type: The content type the lock is being applied to. Only `folder`
+ is supported.
+ :type type: str
+ :param id: The ID of the folder.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class FolderLocksManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_folder_locks(
+ self,
+ folder_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderLocks:
+ """
+ Retrieves folder lock details for a given folder.
+
+ You must be authenticated as the owner or co-owner of the folder to
+
+
+ use this endpoint.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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`.
+ :type folder_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/folder_locks']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderLocks)
+
+ def create_folder_lock(
+ self,
+ folder: CreateFolderLockFolder,
+ *,
+ locked_operations: Optional[CreateFolderLockLockedOperations] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderLock:
+ """
+ Creates a folder lock on a folder, preventing it from being moved and/or
+
+ deleted.
+
+
+ You must be authenticated as the owner or co-owner of the folder to
+
+
+ use this endpoint.
+
+ :param folder: The folder to apply the lock to.
+ :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`., defaults to None
+ :type locked_operations: Optional[CreateFolderLockLockedOperations], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'locked_operations': locked_operations, 'folder': folder}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/folder_locks']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderLock)
+
+ def delete_folder_lock_by_id(
+ self,
+ folder_lock_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a folder lock on a given folder.
+
+ You must be authenticated as the owner or co-owner of the folder to
+
+
+ use this endpoint.
+
+ :param folder_lock_id: The ID of the folder lock.
+ Example: "12345"
+ :type folder_lock_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folder_locks/',
+ to_string(folder_lock_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/folder_metadata.py b/box_sdk_gen/managers/folder_metadata.py
new file mode 100644
index 000000000..602effef4
--- /dev/null
+++ b/box_sdk_gen/managers/folder_metadata.py
@@ -0,0 +1,450 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from typing import List
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.metadatas import Metadatas
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.metadata_full import MetadataFull
+
+from box_sdk_gen.schemas.metadata_error import MetadataError
+
+from box_sdk_gen.schemas.metadata_instance_value import MetadataInstanceValue
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetFolderMetadataByIdScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class CreateFolderMetadataByIdScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class UpdateFolderMetadataByIdScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class UpdateFolderMetadataByIdRequestBodyOpField(str, Enum):
+ ADD = 'add'
+ REPLACE = 'replace'
+ REMOVE = 'remove'
+ TEST = 'test'
+ MOVE = 'move'
+ COPY = 'copy'
+
+
+class UpdateFolderMetadataByIdRequestBody(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'from_': 'from',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'from': 'from_',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ op: Optional[UpdateFolderMetadataByIdRequestBodyOpField] = None,
+ path: Optional[str] = None,
+ value: Optional[MetadataInstanceValue] = None,
+ from_: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param op: The type of change to perform on the template. Some
+ of these are hazardous as they will change existing templates., defaults to None
+ :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).
+
+ The path must always be prefixed with a `/` to represent the root
+ of the template. The characters `~` and `/` are reserved
+ characters and must be escaped in the key., defaults to None
+ :type path: Optional[str], optional
+ :param from_: The location in the metadata JSON object to move or copy a value
+ from. Required for `move` or `copy` operations and must be in the
+ format of a [JSON-Pointer](https://tools.ietf.org/html/rfc6901)., defaults to None
+ :type from_: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.op = op
+ self.path = path
+ self.value = value
+ self.from_ = from_
+
+
+class DeleteFolderMetadataByIdScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class FolderMetadataManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_folder_metadata(
+ self,
+ folder_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Metadatas:
+ """
+ Retrieves all metadata for a given folder. This can not be used on the root
+
+ folder with ID `0`.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Metadatas)
+
+ def get_folder_metadata_by_id(
+ self,
+ folder_id: str,
+ scope: GetFolderMetadataByIdScope,
+ template_key: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataFull:
+ """
+ Retrieves the instance of a metadata template that has been applied to a
+
+ folder. This can not be used on the root folder with ID `0`.
+
+ :param 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"
+ :type folder_id: str
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :type scope: GetFolderMetadataByIdScope
+ :param template_key: The name of the metadata template.
+ Example: "properties"
+ :type template_key: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataFull)
+
+ def create_folder_metadata_by_id(
+ self,
+ folder_id: str,
+ scope: CreateFolderMetadataByIdScope,
+ template_key: str,
+ request_body: Dict,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataFull:
+ """
+ Applies an instance of a metadata template to a folder.
+
+ In most cases only values that are present in the metadata template
+
+
+ will be accepted, except for the `global.properties` template which accepts
+
+
+ any key-value pair.
+
+
+ To display the metadata template in the Box web app the enterprise needs to be
+
+
+ configured to enable **Cascading Folder Level Metadata** for the user in the
+
+
+ admin console.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :type scope: CreateFolderMetadataByIdScope
+ :param template_key: The name of the metadata template.
+ Example: "properties"
+ :type template_key: str
+ :param request_body: Request body of createFolderMetadataById method
+ :type request_body: Dict
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataFull)
+
+ def update_folder_metadata_by_id(
+ self,
+ folder_id: str,
+ scope: UpdateFolderMetadataByIdScope,
+ template_key: str,
+ request_body: List[UpdateFolderMetadataByIdRequestBody],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataFull:
+ """
+ Updates a piece of metadata on a folder.
+
+ The metadata instance can only be updated if the template has already been
+
+
+ applied to the folder before. When editing metadata, only values that match
+
+
+ the metadata template schema will be accepted.
+
+
+ The update is applied atomically. If any errors occur during the
+
+
+ application of the operations, the metadata instance will not be changed.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :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[UpdateFolderMetadataByIdRequestBody]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json-patch+json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataFull)
+
+ def delete_folder_metadata_by_id(
+ self,
+ folder_id: str,
+ scope: DeleteFolderMetadataByIdScope,
+ template_key: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a piece of folder metadata.
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :type scope: DeleteFolderMetadataByIdScope
+ :param template_key: The name of the metadata template.
+ Example: "properties"
+ :type template_key: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/metadata/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/folder_watermarks.py b/box_sdk_gen/managers/folder_watermarks.py
new file mode 100644
index 000000000..56ac61a99
--- /dev/null
+++ b/box_sdk_gen/managers/folder_watermarks.py
@@ -0,0 +1,214 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.watermark import Watermark
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class UpdateFolderWatermarkWatermarkImprintField(str, Enum):
+ DEFAULT = 'default'
+
+
+class UpdateFolderWatermarkWatermark(BaseObject):
+ def __init__(
+ self,
+ *,
+ imprint: UpdateFolderWatermarkWatermarkImprintField = UpdateFolderWatermarkWatermarkImprintField.DEFAULT,
+ **kwargs
+ ):
+ """
+ :param imprint: The type of watermark to apply.
+
+ Currently only supports one option., defaults to UpdateFolderWatermarkWatermarkImprintField.DEFAULT
+ :type imprint: UpdateFolderWatermarkWatermarkImprintField, optional
+ """
+ super().__init__(**kwargs)
+ self.imprint = imprint
+
+
+class FolderWatermarksManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_folder_watermark(
+ self,
+ folder_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Watermark:
+ """
+ Retrieve the watermark for a folder.
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/watermark',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Watermark)
+
+ def update_folder_watermark(
+ self,
+ folder_id: str,
+ watermark: UpdateFolderWatermarkWatermark,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Watermark:
+ """
+ Applies or update a watermark on a folder.
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param watermark: The watermark to imprint on the folder.
+ :type watermark: UpdateFolderWatermarkWatermark
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'watermark': watermark}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/watermark',
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Watermark)
+
+ def delete_folder_watermark(
+ self,
+ folder_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes the watermark from a folder.
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/watermark',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/folders.py b/box_sdk_gen/managers/folders.py
new file mode 100644
index 000000000..50772507b
--- /dev/null
+++ b/box_sdk_gen/managers/folders.py
@@ -0,0 +1,966 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.folder_full import FolderFull
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.items import Items
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class GetFolderByIdSort(str, Enum):
+ ID = 'id'
+ NAME = 'name'
+ DATE = 'date'
+ SIZE = 'size'
+
+
+class GetFolderByIdDirection(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class UpdateFolderByIdSyncState(str, Enum):
+ SYNCED = 'synced'
+ NOT_SYNCED = 'not_synced'
+ PARTIALLY_SYNCED = 'partially_synced'
+
+
+class UpdateFolderByIdParent(BaseObject):
+ def __init__(
+ self, *, id: Optional[str] = None, user_id: Optional[str] = None, **kwargs
+ ):
+ """
+ :param id: The ID of parent item., defaults to None
+ :type id: Optional[str], optional
+ :param user_id: The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided., defaults to None
+ :type user_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.user_id = user_id
+
+
+class UpdateFolderByIdSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class UpdateFolderByIdSharedLinkPermissionsField(BaseObject):
+ def __init__(self, *, can_download: Optional[bool] = None, **kwargs):
+ """
+ :param can_download: If the shared link allows for downloading of files.
+ This can only be set when `access` is set to
+ `open` or `company`., defaults to None
+ :type can_download: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+
+
+class UpdateFolderByIdSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[UpdateFolderByIdSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[UpdateFolderByIdSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the folder (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class UpdateFolderByIdFolderUploadEmailAccessField(str, Enum):
+ OPEN = 'open'
+ COLLABORATORS = 'collaborators'
+
+
+class UpdateFolderByIdFolderUploadEmail(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[UpdateFolderByIdFolderUploadEmailAccessField] = None,
+ **kwargs
+ ):
+ """
+ :param access: When this parameter has been set, users can email files
+ to the email address that has been automatically
+ created for this folder.
+
+ To create an email address, set this property either when
+ creating or updating the folder.
+
+ When set to `collaborators`, only emails from registered email
+ addresses for collaborators will be accepted. This includes
+ any email aliases a user might have registered.
+
+ When set to `open` it will accept emails from any email
+ address., defaults to None
+ :type access: Optional[UpdateFolderByIdFolderUploadEmailAccessField], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+
+
+class UpdateFolderByIdCollections(BaseObject):
+ def __init__(
+ self, *, id: Optional[str] = None, type: Optional[str] = None, **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type for this object., defaults to None
+ :type type: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class GetFolderItemsSort(str, Enum):
+ ID = 'id'
+ NAME = 'name'
+ DATE = 'date'
+ SIZE = 'size'
+
+
+class GetFolderItemsDirection(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class CreateFolderParent(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of parent folder.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class CreateFolderFolderUploadEmailAccessField(str, Enum):
+ OPEN = 'open'
+ COLLABORATORS = 'collaborators'
+
+
+class CreateFolderFolderUploadEmail(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[CreateFolderFolderUploadEmailAccessField] = None,
+ **kwargs
+ ):
+ """
+ :param access: When this parameter has been set, users can email files
+ to the email address that has been automatically
+ created for this folder.
+
+ To create an email address, set this property either when
+ creating or updating the folder.
+
+ When set to `collaborators`, only emails from registered email
+ addresses for collaborators will be accepted. This includes
+ any email aliases a user might have registered.
+
+ When set to `open` it will accept emails from any email
+ address., defaults to None
+ :type access: Optional[CreateFolderFolderUploadEmailAccessField], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+
+
+class CreateFolderSyncState(str, Enum):
+ SYNCED = 'synced'
+ NOT_SYNCED = 'not_synced'
+ PARTIALLY_SYNCED = 'partially_synced'
+
+
+class CopyFolderParent(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of parent folder.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class FoldersManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_folder_by_id(
+ self,
+ folder_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ sort: Optional[GetFolderByIdSort] = None,
+ direction: Optional[GetFolderByIdDirection] = None,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ if_none_match: Optional[str] = None,
+ boxapi: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ """
+ Retrieves details for a folder, including the first 100 entries
+
+ in the folder.
+
+
+ Passing `sort`, `direction`, `offset`, and `limit`
+
+
+ parameters in query allows you to manage the
+
+
+ list of returned
+
+
+ [folder items](r://folder--full#param-item-collection).
+
+
+ To fetch more items within the folder, use the
+
+
+ [Get items in a folder](e://get-folders-id-items) endpoint.
+
+ :param 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"
+ :type folder_id: str
+ :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.
+
+ 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.
+
+ Additionally this field can be used to query any metadata
+ applied to the file by specifying the `metadata` field as well
+ as the scope and key of the template to retrieve, for example
+ `?fields=metadata.enterprise_12345.contractTemplate`., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param sort: Defines the **second** attribute by which items
+ are sorted.
+
+ The folder type affects the way the items
+ are sorted:
+
+ * **Standard folder**:
+ Items are always sorted by
+ their `type` first, with
+ folders listed before files,
+ and files listed
+ before web links.
+
+ * **Root folder**:
+ This parameter is not supported
+ for marker-based pagination
+ on the root folder
+
+ (the folder with an `id` of `0`).
+
+ * **Shared folder with parent path
+ to the associated folder visible to
+ the collaborator**:
+ Items are always sorted by
+ their `type` first, with
+ folders listed before files,
+ and files listed
+ before web links., defaults to None
+ :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., defaults to None
+ :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
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param if_none_match: Ensures an item is only returned if it has changed.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `304 Not Modified` if the item has not
+ changed since., defaults to None
+ :type if_none_match: Optional[str], 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.
+
+ Use the format `shared_link=[link]` or if a password is required then
+ use `shared_link=[link]&shared_link_password=[password]`.
+
+ This header can be used on the file or folder shared, as well as on any files
+ or folders nested within the item., defaults to None
+ :type boxapi: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'sort': to_string(sort),
+ 'direction': to_string(direction),
+ 'offset': to_string(offset),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'if-none-match': to_string(if_none_match),
+ 'boxapi': to_string(boxapi),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
+
+ def update_folder_by_id(
+ self,
+ folder_id: str,
+ *,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ sync_state: Optional[UpdateFolderByIdSyncState] = None,
+ can_non_owners_invite: Optional[bool] = None,
+ parent: Optional[UpdateFolderByIdParent] = None,
+ shared_link: Optional[UpdateFolderByIdSharedLink] = None,
+ folder_upload_email: Union[
+ Optional[UpdateFolderByIdFolderUploadEmail], NullValue
+ ] = None,
+ tags: Optional[List[str]] = None,
+ is_collaboration_restricted_to_enterprise: Optional[bool] = None,
+ collections: Union[
+ Optional[List[UpdateFolderByIdCollections]], NullValue
+ ] = None,
+ can_non_owners_view_collaborators: Optional[bool] = None,
+ fields: Optional[List[str]] = None,
+ if_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ r"""
+ Updates a folder. This can be also be used to move the folder,
+
+ create shared links, update collaborations, and more.
+
+ :param 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"
+ :type folder_id: str
+ :param name: The optional new name for this folder.
+
+ The following restrictions to folder names apply: names containing
+ non-printable ASCII characters, forward and backward slashes
+ (`/`, `\`), names with trailing spaces, and names `.` and `..` are
+ not allowed.
+
+ Folder names must be unique within their parent folder. The name check is case-insensitive,
+ so a folder named `New Folder` cannot be created in a parent folder that already contains
+ a folder named `new folder`., defaults to None
+ :type name: Optional[str], optional
+ :param description: The optional description of this folder., defaults to None
+ :type description: Optional[str], optional
+ :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., defaults to None
+ :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., defaults to None
+ :type can_non_owners_invite: Optional[bool], 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,
+ modify them, and then update this field.
+
+ There is a limit of 100 tags per item, and 10,000
+ unique tags per enterprise., defaults to None
+ :type tags: Optional[List[str]], optional
+ :param is_collaboration_restricted_to_enterprise: Specifies if new invites to this folder are restricted to users
+ within the enterprise. This does not affect existing
+ collaborations., defaults to None
+ :type is_collaboration_restricted_to_enterprise: Optional[bool], optional
+ :param collections: An array of collections to make this folder
+ a member of. Currently
+ we only support the `favorites` collection.
+
+ To get the ID for a collection, use the
+ [List all collections][1] endpoint.
+
+ Passing an empty array `[]` or `null` will remove
+ the folder from all collections.
+
+ [1]: e://get-collections, defaults to None
+ :type collections: Union[Optional[List[UpdateFolderByIdCollections]], NullValue], optional
+ :param can_non_owners_view_collaborators: Restricts collaborators who are not the owner of
+ this folder from viewing other collaborations on
+ this folder.
+
+ It also restricts non-owners from inviting new
+ collaborators.
+
+ When setting this field to `false`, it is required
+ to also set `can_non_owners_invite_collaborators` to
+ `false` if it has not already been set., defaults to None
+ :type can_non_owners_view_collaborators: Optional[bool], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'name': name,
+ 'description': description,
+ 'sync_state': sync_state,
+ 'can_non_owners_invite': can_non_owners_invite,
+ 'parent': parent,
+ 'shared_link': shared_link,
+ 'folder_upload_email': folder_upload_email,
+ 'tags': tags,
+ 'is_collaboration_restricted_to_enterprise': (
+ is_collaboration_restricted_to_enterprise
+ ),
+ 'collections': collections,
+ 'can_non_owners_view_collaborators': can_non_owners_view_collaborators,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {'if-match': to_string(if_match), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
+
+ def delete_folder_by_id(
+ self,
+ folder_id: str,
+ *,
+ recursive: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a folder, either permanently or by moving it to
+
+ the trash.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param recursive: Delete a folder that is not empty by recursively deleting the
+ folder and all of its content., defaults to None
+ :type recursive: Optional[bool], optional
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ ]
+ ),
+ method='DELETE',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_folder_items(
+ self,
+ folder_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ usemarker: Optional[bool] = None,
+ marker: Optional[str] = None,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ sort: Optional[GetFolderItemsSort] = None,
+ direction: Optional[GetFolderItemsDirection] = None,
+ boxapi: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Items:
+ """
+ Retrieves a page of items in a folder. These items can be files,
+
+ folders, and web links.
+
+
+ To request more information about the folder itself, like its size,
+
+
+ use the [Get a folder](#get-folders-id) endpoint instead.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :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.
+
+ 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.
+
+ Additionally this field can be used to query any metadata
+ applied to the file by specifying the `metadata` field as well
+ as the scope and key of the template to retrieve, for example
+ `?fields=metadata.enterprise_12345.contractTemplate`., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param usemarker: 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., defaults to None
+ :type usemarker: Optional[bool], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param sort: Defines the **second** attribute by which items
+ are sorted.
+
+ The folder type affects the way the items
+ are sorted:
+
+ * **Standard folder**:
+ Items are always sorted by
+ their `type` first, with
+ folders listed before files,
+ and files listed
+ before web links.
+
+ * **Root folder**:
+ This parameter is not supported
+ for marker-based pagination
+ on the root folder
+
+ (the folder with an `id` of `0`).
+
+ * **Shared folder with parent path
+ to the associated folder visible to
+ the collaborator**:
+ Items are always sorted by
+ their `type` first, with
+ folders listed before files,
+ and files listed
+ before web links., defaults to None
+ :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., defaults to None
+ :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.
+
+ Use the format `shared_link=[link]` or if a password is required then
+ use `shared_link=[link]&shared_link_password=[password]`.
+
+ This header can be used on the file or folder shared, as well as on any files
+ or folders nested within the item., defaults to None
+ :type boxapi: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'usemarker': to_string(usemarker),
+ 'marker': to_string(marker),
+ 'offset': to_string(offset),
+ 'limit': to_string(limit),
+ 'sort': to_string(sort),
+ 'direction': to_string(direction),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'boxapi': to_string(boxapi), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/items',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Items)
+
+ def create_folder(
+ self,
+ name: str,
+ 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:
+ r"""
+ Creates a new empty folder within the specified parent folder.
+ :param name: The name for the new folder.
+
+ The following restrictions to folder names apply: names containing
+ non-printable ASCII characters, forward and backward slashes
+ (`/`, `\`), names with trailing spaces, and names `.` and `..` are
+ not allowed.
+
+ Folder names must be unique within their parent folder. The name check is case-insensitive,
+ so a folder named `New Folder` cannot be created in a parent folder that already contains
+ a folder named `new folder`.
+ :type name: str
+ :param parent: The parent folder to create the new folder within.
+ :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., defaults to None
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'name': name,
+ 'parent': parent,
+ 'folder_upload_email': folder_upload_email,
+ 'sync_state': sync_state,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/folders']),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
+
+ def copy_folder(
+ self,
+ folder_id: str,
+ parent: CopyFolderParent,
+ *,
+ name: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ r"""
+ Creates a copy of a folder within a destination folder.
+
+ The original folder will not be changed.
+
+ :param folder_id: The unique identifier of the folder to copy.
+
+ 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 with the ID `0` can not be copied.
+ Example: "0"
+ :type folder_id: str
+ :param parent: The destination folder to copy the folder to.
+ :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
+ (`/`, `\`), as well as names with trailing spaces are
+ prohibited.
+
+ Additionally, the names `.` and `..` are
+ not allowed either., defaults to None
+ :type name: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'name': name, 'parent': parent}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/copy',
+ ]
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
diff --git a/box_sdk_gen/managers/groups.py b/box_sdk_gen/managers/groups.py
new file mode 100644
index 000000000..200116ba6
--- /dev/null
+++ b/box_sdk_gen/managers/groups.py
@@ -0,0 +1,450 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.groups import Groups
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.group_full import GroupFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateGroupInvitabilityLevel(str, Enum):
+ ADMINS_ONLY = 'admins_only'
+ ADMINS_AND_MEMBERS = 'admins_and_members'
+ ALL_MANAGED_USERS = 'all_managed_users'
+
+
+class CreateGroupMemberViewabilityLevel(str, Enum):
+ ADMINS_ONLY = 'admins_only'
+ ADMINS_AND_MEMBERS = 'admins_and_members'
+ ALL_MANAGED_USERS = 'all_managed_users'
+
+
+class UpdateGroupByIdInvitabilityLevel(str, Enum):
+ ADMINS_ONLY = 'admins_only'
+ ADMINS_AND_MEMBERS = 'admins_and_members'
+ ALL_MANAGED_USERS = 'all_managed_users'
+
+
+class UpdateGroupByIdMemberViewabilityLevel(str, Enum):
+ ADMINS_ONLY = 'admins_only'
+ ADMINS_AND_MEMBERS = 'admins_and_members'
+ ALL_MANAGED_USERS = 'all_managed_users'
+
+
+class GroupsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_groups(
+ self,
+ *,
+ filter_term: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Groups:
+ """
+ Retrieves all of the groups for a given enterprise. The user
+
+ must have admin permissions to inspect enterprise's groups.
+
+ :param filter_term: Limits the results to only groups whose `name` starts
+ with the search term., defaults to None
+ :type filter_term: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'filter_term': to_string(filter_term),
+ 'fields': to_string(fields),
+ 'limit': to_string(limit),
+ 'offset': to_string(offset),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/groups']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Groups)
+
+ def create_group(
+ self,
+ name: str,
+ *,
+ provenance: Optional[str] = None,
+ external_sync_identifier: Optional[str] = None,
+ description: Optional[str] = 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:
+ """
+ Creates a new group of users in an enterprise. Only users with admin
+
+ permissions can create new groups.
+
+ :param name: The name of the new group to be created. This name must be unique
+ within the enterprise.
+ :type name: str
+ :param provenance: Keeps track of which external source this group is
+ coming, for example `Active Directory`, or `Okta`.
+
+ Setting this will also prevent Box admins from editing
+ the group name and its members directly via the Box
+ web application.
+
+ This is desirable for one-way syncing of groups., defaults to None
+ :type provenance: Optional[str], optional
+ :param external_sync_identifier: 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., defaults to None
+ :type external_sync_identifier: Optional[str], optional
+ :param description: A human readable description of the group., defaults to None
+ :type description: Optional[str], optional
+ :param invitability_level: 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., defaults to None
+ :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., defaults to None
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'name': name,
+ 'provenance': provenance,
+ 'external_sync_identifier': external_sync_identifier,
+ 'description': description,
+ 'invitability_level': invitability_level,
+ 'member_viewability_level': member_viewability_level,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/groups']),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, GroupFull)
+
+ def get_group_by_id(
+ self,
+ group_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> GroupFull:
+ """
+ Retrieves information about a group. Only members of this
+
+ group or users with admin-level permissions will be able to
+
+
+ use this API.
+
+ :param group_id: The ID of the group.
+ Example: "57645"
+ :type group_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/groups/',
+ to_string(group_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, GroupFull)
+
+ def update_group_by_id(
+ self,
+ group_id: str,
+ *,
+ name: Optional[str] = None,
+ provenance: Optional[str] = None,
+ external_sync_identifier: Optional[str] = None,
+ description: Optional[str] = None,
+ invitability_level: Optional[UpdateGroupByIdInvitabilityLevel] = None,
+ member_viewability_level: Optional[
+ UpdateGroupByIdMemberViewabilityLevel
+ ] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> GroupFull:
+ """
+ Updates a specific group. Only admins of this
+
+ group or users with admin-level permissions will be able to
+
+
+ use this API.
+
+ :param group_id: The ID of the group.
+ Example: "57645"
+ :type group_id: str
+ :param name: The name of the new group to be created. Must be unique within the
+ enterprise., defaults to None
+ :type name: Optional[str], optional
+ :param provenance: Keeps track of which external source this group is
+ coming, for example `Active Directory`, or `Okta`.
+
+ Setting this will also prevent Box admins from editing
+ the group name and its members directly via the Box
+ web application.
+
+ This is desirable for one-way syncing of groups., defaults to None
+ :type provenance: Optional[str], optional
+ :param external_sync_identifier: 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., defaults to None
+ :type external_sync_identifier: Optional[str], optional
+ :param description: A human readable description of the group., defaults to None
+ :type description: Optional[str], optional
+ :param invitability_level: 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., defaults to None
+ :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., defaults to None
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'name': name,
+ 'provenance': provenance,
+ 'external_sync_identifier': external_sync_identifier,
+ 'description': description,
+ 'invitability_level': invitability_level,
+ 'member_viewability_level': member_viewability_level,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/groups/',
+ to_string(group_id),
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, GroupFull)
+
+ def delete_group_by_id(
+ self, group_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Permanently deletes a group. Only users with
+
+ admin-level permissions will be able to use this API.
+
+ :param group_id: The ID of the group.
+ Example: "57645"
+ :type group_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/groups/',
+ to_string(group_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/hub_collaborations.py b/box_sdk_gen/managers/hub_collaborations.py
new file mode 100644
index 000000000..7950575f9
--- /dev/null
+++ b/box_sdk_gen/managers/hub_collaborations.py
@@ -0,0 +1,360 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaborations_v2025_r0 import (
+ HubCollaborationsV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0
+
+from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import (
+ BoxVersionHeaderV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_v2025_r0 import (
+ HubCollaborationV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_create_request_v2025_r0 import (
+ HubCollaborationCreateRequestV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_update_request_v2025_r0 import (
+ HubCollaborationUpdateRequestV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateHubCollaborationV2025R0HubTypeField(str, Enum):
+ HUBS = 'hubs'
+
+
+class CreateHubCollaborationV2025R0Hub(BaseObject):
+ _discriminator = 'type', {'hubs'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CreateHubCollaborationV2025R0HubTypeField = CreateHubCollaborationV2025R0HubTypeField.HUBS,
+ **kwargs
+ ):
+ """
+ :param id: ID of the object.
+ :type id: str
+ :param type: The value will always be `hubs`., defaults to CreateHubCollaborationV2025R0HubTypeField.HUBS
+ :type type: CreateHubCollaborationV2025R0HubTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CreateHubCollaborationV2025R0AccessibleBy(BaseObject):
+ def __init__(
+ self,
+ type: str,
+ *,
+ id: Optional[str] = None,
+ login: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of collaborator to invite.
+ Possible values are `user` or `group`.
+ :type type: str
+ :param id: The ID of the user or group.
+
+ Alternatively, use `login` to specify a user by email
+ address., defaults to None
+ :type id: Optional[str], optional
+ :param login: The email address of the user who gets access to the item.
+
+ Alternatively, use `id` to specify a user by user ID., defaults to None
+ :type login: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.login = login
+
+
+class HubCollaborationsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_hub_collaborations_v2025_r0(
+ self,
+ hub_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubCollaborationsV2025R0:
+ """
+ Retrieves all collaborations for a hub.
+ :param hub_id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting this hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ :type hub_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'hub_id': to_string(hub_id),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/hub_collaborations']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubCollaborationsV2025R0)
+
+ def create_hub_collaboration_v2025_r0(
+ self,
+ hub: CreateHubCollaborationV2025R0Hub,
+ accessible_by: CreateHubCollaborationV2025R0AccessibleBy,
+ role: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubCollaborationV2025R0:
+ """
+ Adds a collaboration for a single user or a single group to a hub.
+
+ Collaborations can be created using email address, user IDs, or group IDs.
+
+ :param hub: Hubs reference.
+ :type hub: CreateHubCollaborationV2025R0Hub
+ :param accessible_by: The user or group who gets access to the item.
+ :type accessible_by: CreateHubCollaborationV2025R0AccessibleBy
+ :param role: The level of access granted to hub.
+ Possible values are `editor`, `viewer`, and `co-owner`.
+ :type role: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'hub': hub, 'accessible_by': accessible_by, 'role': role}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/hub_collaborations']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubCollaborationV2025R0)
+
+ def get_hub_collaboration_by_id_v2025_r0(
+ self,
+ hub_collaboration_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubCollaborationV2025R0:
+ """
+ Retrieves details for a hub collaboration by collaboration ID.
+ :param hub_collaboration_id: The ID of the hub collaboration.
+ Example: "1234"
+ :type hub_collaboration_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/hub_collaborations/',
+ to_string(hub_collaboration_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubCollaborationV2025R0)
+
+ def update_hub_collaboration_by_id_v2025_r0(
+ self,
+ hub_collaboration_id: str,
+ *,
+ role: Optional[str] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubCollaborationV2025R0:
+ """
+ Updates a hub collaboration.
+
+ Can be used to change the hub role.
+
+ :param hub_collaboration_id: The ID of the hub collaboration.
+ Example: "1234"
+ :type hub_collaboration_id: str
+ :param role: The level of access granted to hub.
+ Possible values are `editor`, `viewer`, and `co-owner`., defaults to None
+ :type role: Optional[str], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'role': role}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/hub_collaborations/',
+ to_string(hub_collaboration_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubCollaborationV2025R0)
+
+ def delete_hub_collaboration_by_id_v2025_r0(
+ self,
+ hub_collaboration_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a single hub collaboration.
+ :param hub_collaboration_id: The ID of the hub collaboration.
+ Example: "1234"
+ :type hub_collaboration_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/hub_collaborations/',
+ to_string(hub_collaboration_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/hub_items.py b/box_sdk_gen/managers/hub_items.py
new file mode 100644
index 000000000..4ad4e448f
--- /dev/null
+++ b/box_sdk_gen/managers/hub_items.py
@@ -0,0 +1,177 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from typing import List
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_operation_v2025_r0 import (
+ HubItemOperationV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_items_v2025_r0 import HubItemsV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0
+
+from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import (
+ BoxVersionHeaderV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_items_manage_response_v2025_r0 import (
+ HubItemsManageResponseV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_items_manage_request_v2025_r0 import (
+ HubItemsManageRequestV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class HubItemsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_hub_items_v2025_r0(
+ self,
+ hub_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubItemsV2025R0:
+ """
+ Retrieves all items associated with a Hub.
+ :param hub_id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting this hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ :type hub_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'hub_id': to_string(hub_id),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/hub_items']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubItemsV2025R0)
+
+ def manage_hub_items_v2025_r0(
+ self,
+ hub_id: str,
+ *,
+ operations: Optional[List[HubItemOperationV2025R0]] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubItemsManageResponseV2025R0:
+ """
+ Adds and/or removes Hub items from a Hub.
+ :param hub_id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting this hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ Example: "12345"
+ :type hub_id: str
+ :param operations: List of operations to perform on Hub items., defaults to None
+ :type operations: Optional[List[HubItemOperationV2025R0]], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'operations': operations}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/hubs/',
+ to_string(hub_id),
+ '/manage_items',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubItemsManageResponseV2025R0)
diff --git a/box_sdk_gen/managers/hubs.py b/box_sdk_gen/managers/hubs.py
new file mode 100644
index 000000000..549ad3566
--- /dev/null
+++ b/box_sdk_gen/managers/hubs.py
@@ -0,0 +1,475 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.v2025_r0.hubs_v2025_r0 import HubsV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0
+
+from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import (
+ BoxVersionHeaderV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_v2025_r0 import HubV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.hub_create_request_v2025_r0 import (
+ HubCreateRequestV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_update_request_v2025_r0 import (
+ HubUpdateRequestV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_copy_request_v2025_r0 import HubCopyRequestV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetHubsV2025R0Direction(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class GetEnterpriseHubsV2025R0Direction(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class HubsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_hubs_v2025_r0(
+ self,
+ *,
+ query: Optional[str] = None,
+ scope: Optional[str] = None,
+ sort: Optional[str] = None,
+ direction: Optional[GetHubsV2025R0Direction] = None,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubsV2025R0:
+ """
+ Retrieves all hubs for requesting user.
+ :param query: The query string to search for hubs., defaults to None
+ :type query: Optional[str], optional
+ :param scope: The scope of the hubs to retrieve. Possible values include `editable`,
+ `view_only`, and `all`. Default is `all`., defaults to None
+ :type scope: Optional[str], optional
+ :param sort: The field to sort results by.
+ Possible values include `name`, `updated_at`,
+ `last_accessed_at`, `view_count`, and `relevance`.
+ Default is `relevance`., defaults to None
+ :type sort: Optional[str], optional
+ :param direction: The direction to sort results in. This can be either in alphabetical ascending
+ (`ASC`) or descending (`DESC`) order., defaults to None
+ :type direction: Optional[GetHubsV2025R0Direction], optional
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'query': to_string(query),
+ 'scope': to_string(scope),
+ 'sort': to_string(sort),
+ 'direction': to_string(direction),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/hubs']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubsV2025R0)
+
+ def create_hub_v2025_r0(
+ self,
+ title: str,
+ *,
+ description: Optional[str] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubV2025R0:
+ """
+ Creates a new Hub.
+ :param title: Title of the Hub. It cannot be empty and should be less than 50 characters.
+ :type title: str
+ :param description: Description of the Hub., defaults to None
+ :type description: Optional[str], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'title': title, 'description': description}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/hubs']),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubV2025R0)
+
+ def get_enterprise_hubs_v2025_r0(
+ self,
+ *,
+ query: Optional[str] = None,
+ sort: Optional[str] = None,
+ direction: Optional[GetEnterpriseHubsV2025R0Direction] = None,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubsV2025R0:
+ """
+ Retrieves all hubs for a given enterprise.
+
+ Admins or Hub Co-admins of an enterprise
+
+
+ with GCM scope can make this call.
+
+ :param query: The query string to search for hubs., defaults to None
+ :type query: Optional[str], optional
+ :param sort: The field to sort results by.
+ Possible values include `name`, `updated_at`,
+ `last_accessed_at`, `view_count`, and `relevance`.
+ Default is `relevance`., defaults to None
+ :type sort: Optional[str], optional
+ :param direction: The direction to sort results in. This can be either in alphabetical ascending
+ (`ASC`) or descending (`DESC`) order., defaults to None
+ :type direction: Optional[GetEnterpriseHubsV2025R0Direction], optional
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'query': to_string(query),
+ 'sort': to_string(sort),
+ 'direction': to_string(direction),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/enterprise_hubs']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubsV2025R0)
+
+ def get_hub_by_id_v2025_r0(
+ self,
+ hub_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubV2025R0:
+ """
+ Retrieves details for a hub by its ID.
+ :param hub_id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting this hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ Example: "12345"
+ :type hub_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/hubs/',
+ to_string(hub_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubV2025R0)
+
+ def update_hub_by_id_v2025_r0(
+ self,
+ hub_id: str,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ is_ai_enabled: Optional[bool] = None,
+ is_collaboration_restricted_to_enterprise: Optional[bool] = None,
+ can_non_owners_invite: Optional[bool] = None,
+ can_shared_link_be_created: Optional[bool] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubV2025R0:
+ """
+ Updates a Hub. Can be used to change title, description, or Hub settings.
+ :param hub_id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting this hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ Example: "12345"
+ :type hub_id: str
+ :param title: Title of the Hub. It cannot be empty and should be less than 50 characters., defaults to None
+ :type title: Optional[str], optional
+ :param description: Description of the Hub., defaults to None
+ :type description: Optional[str], optional
+ :param is_ai_enabled: Indicates if AI features are enabled for the Hub., defaults to None
+ :type is_ai_enabled: Optional[bool], optional
+ :param is_collaboration_restricted_to_enterprise: Indicates if collaboration is restricted to the enterprise., defaults to None
+ :type is_collaboration_restricted_to_enterprise: Optional[bool], optional
+ :param can_non_owners_invite: Indicates if non-owners can invite others to the Hub., defaults to None
+ :type can_non_owners_invite: Optional[bool], optional
+ :param can_shared_link_be_created: Indicates if a shared link can be created for the Hub., defaults to None
+ :type can_shared_link_be_created: Optional[bool], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'title': title,
+ 'description': description,
+ 'is_ai_enabled': is_ai_enabled,
+ 'is_collaboration_restricted_to_enterprise': (
+ is_collaboration_restricted_to_enterprise
+ ),
+ 'can_non_owners_invite': can_non_owners_invite,
+ 'can_shared_link_be_created': can_shared_link_be_created,
+ }
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/hubs/',
+ to_string(hub_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubV2025R0)
+
+ def delete_hub_by_id_v2025_r0(
+ self,
+ hub_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a single hub.
+ :param hub_id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting this hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ Example: "12345"
+ :type hub_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/hubs/',
+ to_string(hub_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def copy_hub_v2025_r0(
+ self,
+ hub_id: str,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> HubV2025R0:
+ """
+ Creates a copy of a Hub.
+
+ The original Hub will not be modified.
+
+ :param hub_id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting this hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ Example: "12345"
+ :type hub_id: str
+ :param title: Title of the Hub. It cannot be empty and should be less than 50 characters., defaults to None
+ :type title: Optional[str], optional
+ :param description: Description of the Hub., defaults to None
+ :type description: Optional[str], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'title': title, 'description': description}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/hubs/',
+ to_string(hub_id),
+ '/copy',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, HubV2025R0)
diff --git a/box_sdk_gen/managers/integration_mappings.py b/box_sdk_gen/managers/integration_mappings.py
new file mode 100644
index 000000000..49245b679
--- /dev/null
+++ b/box_sdk_gen/managers/integration_mappings.py
@@ -0,0 +1,504 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_slack import (
+ IntegrationMappingPartnerItemSlack,
+)
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_teams_create_request import (
+ IntegrationMappingPartnerItemTeamsCreateRequest,
+)
+
+from box_sdk_gen.schemas.integration_mappings import IntegrationMappings
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.integration_mapping import IntegrationMapping
+
+from box_sdk_gen.schemas.integration_mapping_slack_create_request import (
+ IntegrationMappingSlackCreateRequest,
+)
+
+from box_sdk_gen.schemas.integration_mapping_box_item_slack import (
+ IntegrationMappingBoxItemSlack,
+)
+
+from box_sdk_gen.schemas.integration_mapping_slack_options import (
+ IntegrationMappingSlackOptions,
+)
+
+from box_sdk_gen.schemas.integration_mappings_teams import IntegrationMappingsTeams
+
+from box_sdk_gen.schemas.integration_mapping_teams import IntegrationMappingTeams
+
+from box_sdk_gen.schemas.integration_mapping_teams_create_request import (
+ IntegrationMappingTeamsCreateRequest,
+)
+
+from box_sdk_gen.schemas.folder_reference import FolderReference
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetSlackIntegrationMappingPartnerItemType(str, Enum):
+ CHANNEL = 'channel'
+
+
+class GetSlackIntegrationMappingBoxItemType(str, Enum):
+ FOLDER = 'folder'
+
+
+class GetTeamsIntegrationMappingPartnerItemType(str, Enum):
+ CHANNEL = 'channel'
+ TEAM = 'team'
+
+
+class GetTeamsIntegrationMappingBoxItemType(str, Enum):
+ FOLDER = 'folder'
+
+
+class IntegrationMappingsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_slack_integration_mapping(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ partner_item_type: Optional[GetSlackIntegrationMappingPartnerItemType] = None,
+ partner_item_id: Optional[str] = None,
+ box_item_id: Optional[str] = None,
+ box_item_type: Optional[GetSlackIntegrationMappingBoxItemType] = None,
+ is_manually_created: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> IntegrationMappings:
+ """
+ Lists [Slack integration mappings](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack) in a users' enterprise.
+
+ You need Admin or Co-Admin role to
+
+
+ use this endpoint.
+
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination.
+
+ This requires `usemarker` to be set to `true`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param partner_item_type: Mapped item type, for which the mapping should be returned., defaults to None
+ :type partner_item_type: Optional[GetSlackIntegrationMappingPartnerItemType], optional
+ :param partner_item_id: ID of the mapped item,
+ for which the mapping should be returned., defaults to None
+ :type partner_item_id: Optional[str], optional
+ :param box_item_id: Box item ID, for which the mappings should be returned., defaults to None
+ :type box_item_id: Optional[str], optional
+ :param box_item_type: Box item type, for
+ which the mappings should be returned., defaults to None
+ :type box_item_type: Optional[GetSlackIntegrationMappingBoxItemType], optional
+ :param is_manually_created: Whether the mapping has been manually created., defaults to None
+ :type is_manually_created: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ 'partner_item_type': to_string(partner_item_type),
+ 'partner_item_id': to_string(partner_item_id),
+ 'box_item_id': to_string(box_item_id),
+ 'box_item_type': to_string(box_item_type),
+ 'is_manually_created': to_string(is_manually_created),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/integration_mappings/slack',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, IntegrationMappings)
+
+ def create_slack_integration_mapping(
+ self,
+ partner_item: IntegrationMappingPartnerItemSlack,
+ box_item: IntegrationMappingBoxItemSlack,
+ *,
+ options: Optional[IntegrationMappingSlackOptions] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> IntegrationMapping:
+ """
+ Creates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack)
+
+ by mapping a Slack channel to a Box item.
+
+
+ You need Admin or Co-Admin role to
+
+
+ use this endpoint.
+
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'partner_item': partner_item,
+ 'box_item': box_item,
+ 'options': options,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/integration_mappings/slack',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, IntegrationMapping)
+
+ def update_slack_integration_mapping_by_id(
+ self,
+ integration_mapping_id: str,
+ *,
+ box_item: Optional[IntegrationMappingBoxItemSlack] = None,
+ options: Optional[IntegrationMappingSlackOptions] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> IntegrationMapping:
+ """
+ Updates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack).
+
+ Supports updating the Box folder ID and options.
+
+
+ You need Admin or Co-Admin role to
+
+
+ use this endpoint.
+
+ :param integration_mapping_id: An ID of an integration mapping.
+ Example: "11235432"
+ :type integration_mapping_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'box_item': box_item, 'options': options}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/integration_mappings/slack/',
+ to_string(integration_mapping_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, IntegrationMapping)
+
+ def delete_slack_integration_mapping_by_id(
+ self,
+ integration_mapping_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack).
+
+ You need Admin or Co-Admin role to
+
+
+ use this endpoint.
+
+ :param integration_mapping_id: An ID of an integration mapping.
+ Example: "11235432"
+ :type integration_mapping_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/integration_mappings/slack/',
+ to_string(integration_mapping_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_teams_integration_mapping(
+ self,
+ *,
+ partner_item_type: Optional[GetTeamsIntegrationMappingPartnerItemType] = None,
+ partner_item_id: Optional[str] = None,
+ box_item_id: Optional[str] = None,
+ box_item_type: Optional[GetTeamsIntegrationMappingBoxItemType] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> IntegrationMappingsTeams:
+ """
+ Lists [Teams integration mappings](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams) in a users' enterprise.
+
+ You need Admin or Co-Admin role to
+
+
+ use this endpoint.
+
+ :param partner_item_type: Mapped item type, for which the mapping should be returned., defaults to None
+ :type partner_item_type: Optional[GetTeamsIntegrationMappingPartnerItemType], optional
+ :param partner_item_id: ID of the mapped item,
+ for which the mapping should be returned., defaults to None
+ :type partner_item_id: Optional[str], optional
+ :param box_item_id: Box item ID, for which the mappings should be returned., defaults to None
+ :type box_item_id: Optional[str], optional
+ :param box_item_type: Box item type, for
+ which the mappings should be returned., defaults to None
+ :type box_item_type: Optional[GetTeamsIntegrationMappingBoxItemType], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'partner_item_type': to_string(partner_item_type),
+ 'partner_item_id': to_string(partner_item_id),
+ 'box_item_id': to_string(box_item_id),
+ 'box_item_type': to_string(box_item_type),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/integration_mappings/teams',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, IntegrationMappingsTeams)
+
+ def create_teams_integration_mapping(
+ self,
+ partner_item: IntegrationMappingPartnerItemTeamsCreateRequest,
+ box_item: FolderReference,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> IntegrationMappingTeams:
+ """
+ Creates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams)
+
+ by mapping a Teams channel to a Box item.
+
+
+ You need Admin or Co-Admin role to
+
+
+ use this endpoint.
+
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'partner_item': partner_item, 'box_item': box_item}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/integration_mappings/teams',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, IntegrationMappingTeams)
+
+ def update_teams_integration_mapping_by_id(
+ self,
+ integration_mapping_id: str,
+ *,
+ box_item: Optional[FolderReference] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> IntegrationMappingTeams:
+ """
+ Updates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams).
+
+ Supports updating the Box folder ID and options.
+
+
+ You need Admin or Co-Admin role to
+
+
+ use this endpoint.
+
+ :param integration_mapping_id: An ID of an integration mapping.
+ Example: "11235432"
+ :type integration_mapping_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'box_item': box_item}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/integration_mappings/teams/',
+ to_string(integration_mapping_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, IntegrationMappingTeams)
+
+ def delete_teams_integration_mapping_by_id(
+ self,
+ integration_mapping_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams).
+
+ You need Admin or Co-Admin role to
+
+
+ use this endpoint.
+
+ :param integration_mapping_id: An ID of an integration mapping.
+ Example: "11235432"
+ :type integration_mapping_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/integration_mappings/teams/',
+ to_string(integration_mapping_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/invites.py b/box_sdk_gen/managers/invites.py
new file mode 100644
index 000000000..e143df6fd
--- /dev/null
+++ b/box_sdk_gen/managers/invites.py
@@ -0,0 +1,185 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.invite import Invite
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateInviteEnterprise(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of the enterprise.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class CreateInviteActionableBy(BaseObject):
+ def __init__(self, *, login: Optional[str] = None, **kwargs):
+ """
+ :param login: The login of the invited user., defaults to None
+ :type login: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.login = login
+
+
+class InvitesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def create_invite(
+ self,
+ enterprise: CreateInviteEnterprise,
+ actionable_by: CreateInviteActionableBy,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Invite:
+ """
+ Invites an existing external user to join an enterprise.
+
+ The existing user can not be part of another enterprise and
+
+
+ must already have a Box account. Once invited, the user will receive an
+
+
+ email and are prompted to accept the invitation within the
+
+
+ Box web application.
+
+
+ This method requires the "Manage An Enterprise" scope enabled for
+
+
+ the application, which can be enabled within the developer console.
+
+ :param enterprise: The enterprise to invite the user to.
+ :type enterprise: CreateInviteEnterprise
+ :param actionable_by: The user to invite.
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'enterprise': enterprise, 'actionable_by': actionable_by}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/invites']),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Invite)
+
+ def get_invite_by_id(
+ self,
+ invite_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Invite:
+ """
+ Returns the status of a user invite.
+ :param invite_id: The ID of an invite.
+ Example: "213723"
+ :type invite_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/invites/',
+ to_string(invite_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Invite)
diff --git a/box_sdk_gen/managers/legal_hold_policies.py b/box_sdk_gen/managers/legal_hold_policies.py
new file mode 100644
index 000000000..014b75ac3
--- /dev/null
+++ b/box_sdk_gen/managers/legal_hold_policies.py
@@ -0,0 +1,328 @@
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.legal_hold_policies import LegalHoldPolicies
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.legal_hold_policy import LegalHoldPolicy
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class LegalHoldPoliciesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_legal_hold_policies(
+ self,
+ *,
+ policy_name: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> LegalHoldPolicies:
+ """
+ Retrieves a list of legal hold policies that belong to
+
+ an enterprise.
+
+ :param policy_name: Limits results to policies for which the names start with
+ this search term. This is a case-insensitive prefix., defaults to None
+ :type policy_name: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'policy_name': to_string(policy_name),
+ 'fields': to_string(fields),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policies',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, LegalHoldPolicies)
+
+ def create_legal_hold_policy(
+ self,
+ policy_name: str,
+ *,
+ description: Optional[str] = None,
+ filter_started_at: Optional[DateTime] = None,
+ filter_ended_at: Optional[DateTime] = None,
+ is_ongoing: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> LegalHoldPolicy:
+ """
+ Create a new legal hold policy.
+ :param policy_name: The name of the policy.
+ :type policy_name: str
+ :param description: A description for the policy., defaults to None
+ :type description: Optional[str], optional
+ :param filter_started_at: The filter start date.
+
+ When this policy is applied using a `custodian` legal
+ hold assignments, it will only apply to file versions
+ created or uploaded inside of the
+ date range. Other assignment types, such as folders and
+ files, will ignore the date filter.
+
+ Required if `is_ongoing` is set to `false`., defaults to None
+ :type filter_started_at: Optional[DateTime], optional
+ :param filter_ended_at: The filter end date.
+
+ When this policy is applied using a `custodian` legal
+ hold assignments, it will only apply to file versions
+ created or uploaded inside of the
+ date range. Other assignment types, such as folders and
+ files, will ignore the date filter.
+
+ Required if `is_ongoing` is set to `false`., defaults to None
+ :type filter_ended_at: Optional[DateTime], optional
+ :param is_ongoing: Whether new assignments under this policy should
+ continue applying to files even after initialization.
+
+ When this policy is applied using a legal hold assignment,
+ it will continue applying the policy to any new file versions
+ even after it has been applied.
+
+ For example, if a legal hold assignment is placed on a user
+ today, and that user uploads a file tomorrow, that file will
+ get held. This will continue until the policy is retired.
+
+ Required if no filter dates are set., defaults to None
+ :type is_ongoing: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'policy_name': policy_name,
+ 'description': description,
+ 'filter_started_at': filter_started_at,
+ 'filter_ended_at': filter_ended_at,
+ 'is_ongoing': is_ongoing,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policies',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, LegalHoldPolicy)
+
+ def get_legal_hold_policy_by_id(
+ self,
+ legal_hold_policy_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> LegalHoldPolicy:
+ """
+ Retrieve a legal hold policy.
+ :param legal_hold_policy_id: The ID of the legal hold policy.
+ Example: "324432"
+ :type legal_hold_policy_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policies/',
+ to_string(legal_hold_policy_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, LegalHoldPolicy)
+
+ def update_legal_hold_policy_by_id(
+ self,
+ legal_hold_policy_id: str,
+ *,
+ policy_name: Optional[str] = None,
+ description: Optional[str] = None,
+ release_notes: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> LegalHoldPolicy:
+ """
+ Update legal hold policy.
+ :param legal_hold_policy_id: The ID of the legal hold policy.
+ Example: "324432"
+ :type legal_hold_policy_id: str
+ :param policy_name: The name of the policy., defaults to None
+ :type policy_name: Optional[str], optional
+ :param description: A description for the policy., defaults to None
+ :type description: Optional[str], optional
+ :param release_notes: Notes around why the policy was released., defaults to None
+ :type release_notes: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'policy_name': policy_name,
+ 'description': description,
+ 'release_notes': release_notes,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policies/',
+ to_string(legal_hold_policy_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, LegalHoldPolicy)
+
+ def delete_legal_hold_policy_by_id(
+ self,
+ legal_hold_policy_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Delete an existing legal hold policy.
+
+ This is an asynchronous process. The policy will not be
+
+
+ fully deleted yet when the response returns.
+
+ :param legal_hold_policy_id: The ID of the legal hold policy.
+ Example: "324432"
+ :type legal_hold_policy_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policies/',
+ to_string(legal_hold_policy_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/legal_hold_policy_assignments.py b/box_sdk_gen/managers/legal_hold_policy_assignments.py
new file mode 100644
index 000000000..3e6812726
--- /dev/null
+++ b/box_sdk_gen/managers/legal_hold_policy_assignments.py
@@ -0,0 +1,393 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.legal_hold_policy_assignments import LegalHoldPolicyAssignments
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.legal_hold_policy_assignment import LegalHoldPolicyAssignment
+
+from box_sdk_gen.schemas.files_on_hold import FilesOnHold
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetLegalHoldPolicyAssignmentsAssignToType(str, Enum):
+ FILE = 'file'
+ FILE_VERSION = 'file_version'
+ FOLDER = 'folder'
+ USER = 'user'
+ OWNERSHIP = 'ownership'
+ INTERACTIONS = 'interactions'
+
+
+class CreateLegalHoldPolicyAssignmentAssignToTypeField(str, Enum):
+ FILE = 'file'
+ FILE_VERSION = 'file_version'
+ FOLDER = 'folder'
+ USER = 'user'
+ OWNERSHIP = 'ownership'
+ INTERACTION = 'interaction'
+
+
+class CreateLegalHoldPolicyAssignmentAssignTo(BaseObject):
+ _discriminator = 'type', {
+ 'file',
+ 'file_version',
+ 'folder',
+ 'user',
+ 'ownership',
+ 'interaction',
+ }
+
+ def __init__(
+ self, type: CreateLegalHoldPolicyAssignmentAssignToTypeField, id: str, **kwargs
+ ):
+ """
+ :param type: The type of item to assign the policy to.
+ :type type: CreateLegalHoldPolicyAssignmentAssignToTypeField
+ :param id: The ID of item to assign the policy to.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class LegalHoldPolicyAssignmentsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_legal_hold_policy_assignments(
+ self,
+ policy_id: str,
+ *,
+ assign_to_type: Optional[GetLegalHoldPolicyAssignmentsAssignToType] = None,
+ assign_to_id: Optional[str] = None,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> LegalHoldPolicyAssignments:
+ """
+ Retrieves a list of items a legal hold policy has been assigned to.
+ :param policy_id: The ID of the legal hold policy.
+ :type policy_id: str
+ :param assign_to_type: Filters the results by the type of item the
+ policy was applied to., defaults to None
+ :type assign_to_type: Optional[GetLegalHoldPolicyAssignmentsAssignToType], optional
+ :param assign_to_id: Filters the results by the ID of item the
+ policy was applied to., defaults to None
+ :type assign_to_id: Optional[str], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'policy_id': to_string(policy_id),
+ 'assign_to_type': to_string(assign_to_type),
+ 'assign_to_id': to_string(assign_to_id),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ 'fields': to_string(fields),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policy_assignments',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, LegalHoldPolicyAssignments)
+
+ def create_legal_hold_policy_assignment(
+ self,
+ policy_id: str,
+ assign_to: CreateLegalHoldPolicyAssignmentAssignTo,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> LegalHoldPolicyAssignment:
+ """
+ Assign a legal hold to a file, file version, folder, or user.
+ :param policy_id: The ID of the policy to assign.
+ :type policy_id: str
+ :param assign_to: The item to assign the policy to.
+ :type assign_to: CreateLegalHoldPolicyAssignmentAssignTo
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'policy_id': policy_id, 'assign_to': assign_to}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policy_assignments',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, LegalHoldPolicyAssignment)
+
+ def get_legal_hold_policy_assignment_by_id(
+ self,
+ legal_hold_policy_assignment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> LegalHoldPolicyAssignment:
+ """
+ Retrieve a legal hold policy assignment.
+ :param legal_hold_policy_assignment_id: The ID of the legal hold policy assignment.
+ Example: "753465"
+ :type legal_hold_policy_assignment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policy_assignments/',
+ to_string(legal_hold_policy_assignment_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, LegalHoldPolicyAssignment)
+
+ def delete_legal_hold_policy_assignment_by_id(
+ self,
+ legal_hold_policy_assignment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Remove a legal hold from an item.
+
+ This is an asynchronous process. The policy will not be
+
+
+ fully removed yet when the response returns.
+
+ :param legal_hold_policy_assignment_id: The ID of the legal hold policy assignment.
+ Example: "753465"
+ :type legal_hold_policy_assignment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policy_assignments/',
+ to_string(legal_hold_policy_assignment_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_legal_hold_policy_assignment_file_on_hold(
+ self,
+ legal_hold_policy_assignment_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FilesOnHold:
+ """
+ Get a list of files with current file versions for a legal hold
+
+ assignment.
+
+
+ In some cases you may want to get previous file versions instead. In these
+
+
+ cases, use the `GET /legal_hold_policy_assignments/:id/file_versions_on_hold`
+
+
+ API instead to return any previous versions of a file for this legal hold
+
+
+ policy assignment.
+
+
+ Due to ongoing re-architecture efforts this API might not return all file
+
+
+ versions held for this policy ID. Instead, this API will only return the
+
+
+ latest file version held in the newly developed architecture. The `GET
+
+
+ /file_version_legal_holds` API can be used to fetch current and past versions
+
+
+ of files held within the legacy architecture.
+
+
+ This endpoint does not support returning any content that is on hold due to
+
+
+ a Custodian collaborating on a Hub.
+
+
+ The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to
+
+
+ find a list of policy assignments for a given policy ID.
+
+ :param legal_hold_policy_assignment_id: The ID of the legal hold policy assignment.
+ Example: "753465"
+ :type legal_hold_policy_assignment_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ 'fields': to_string(fields),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/legal_hold_policy_assignments/',
+ to_string(legal_hold_policy_assignment_id),
+ '/files_on_hold',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FilesOnHold)
diff --git a/box_sdk_gen/managers/list_collaborations.py b/box_sdk_gen/managers/list_collaborations.py
new file mode 100644
index 000000000..b30238ad5
--- /dev/null
+++ b/box_sdk_gen/managers/list_collaborations.py
@@ -0,0 +1,329 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.collaborations import Collaborations
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.collaborations_offset_paginated import (
+ CollaborationsOffsetPaginated,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetCollaborationsStatus(str, Enum):
+ PENDING = 'pending'
+
+
+class ListCollaborationsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_collaborations(
+ self,
+ file_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Collaborations:
+ """
+ Retrieves a list of pending and active collaborations for a
+
+ file. This returns all the users that have access to the file
+
+
+ or have been invited to the file.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'limit': to_string(limit),
+ 'marker': to_string(marker),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/collaborations',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Collaborations)
+
+ def get_folder_collaborations(
+ self,
+ folder_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Collaborations:
+ """
+ Retrieves a list of pending and active collaborations for a
+
+ folder. This returns all the users that have access to the folder
+
+
+ or have been invited to the folder.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ The ID for any folder can be determined
+ by visiting this folder in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/folder/123`
+ the `folder_id` is `123`.
+ Example: "12345"
+ :type folder_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'limit': to_string(limit),
+ 'marker': to_string(marker),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/collaborations',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Collaborations)
+
+ def get_collaborations(
+ self,
+ status: GetCollaborationsStatus,
+ *,
+ fields: Optional[List[str]] = None,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CollaborationsOffsetPaginated:
+ """
+ Retrieves all pending collaboration invites for this user.
+ :param status: The status of the collaborations to retrieve.
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'status': to_string(status),
+ 'fields': to_string(fields),
+ 'offset': to_string(offset),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/collaborations']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CollaborationsOffsetPaginated)
+
+ def get_group_collaborations(
+ self,
+ group_id: str,
+ *,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> CollaborationsOffsetPaginated:
+ """
+ Retrieves all the collaborations for a group. The user
+
+ must have admin permissions to inspect enterprise's groups.
+
+
+ Each collaboration object has details on which files or
+
+
+ folders the group has access to and with what role.
+
+ :param group_id: The ID of the group.
+ Example: "57645"
+ :type group_id: str
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/groups/',
+ to_string(group_id),
+ '/collaborations',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, CollaborationsOffsetPaginated)
diff --git a/box_sdk_gen/managers/memberships.py b/box_sdk_gen/managers/memberships.py
new file mode 100644
index 000000000..7719acbc6
--- /dev/null
+++ b/box_sdk_gen/managers/memberships.py
@@ -0,0 +1,444 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from typing import List
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.group_memberships import GroupMemberships
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.group_membership import GroupMembership
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateGroupMembershipUser(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of the user to add to the group.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class CreateGroupMembershipGroup(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of the group to add the user to.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class CreateGroupMembershipRole(str, Enum):
+ MEMBER = 'member'
+ ADMIN = 'admin'
+
+
+class UpdateGroupMembershipByIdRole(str, Enum):
+ MEMBER = 'member'
+ ADMIN = 'admin'
+
+
+class MembershipsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_user_memberships(
+ self,
+ user_id: str,
+ *,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> GroupMemberships:
+ """
+ Retrieves all the groups for a user. Only members of this
+
+ group or users with admin-level permissions will be able to
+
+
+ use this API.
+
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ '/memberships',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, GroupMemberships)
+
+ def get_group_memberships(
+ self,
+ group_id: str,
+ *,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> GroupMemberships:
+ """
+ Retrieves all the members for a group. Only members of this
+
+ group or users with admin-level permissions will be able to
+
+
+ use this API.
+
+ :param group_id: The ID of the group.
+ Example: "57645"
+ :type group_id: str
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/groups/',
+ to_string(group_id),
+ '/memberships',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, GroupMemberships)
+
+ def create_group_membership(
+ self,
+ user: CreateGroupMembershipUser,
+ group: CreateGroupMembershipGroup,
+ *,
+ role: Optional[CreateGroupMembershipRole] = None,
+ configurable_permissions: Union[Optional[Dict[str, bool]], NullValue] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> GroupMembership:
+ """
+ Creates a group membership. Only users with
+
+ admin-level permissions will be able to use this API.
+
+ :param user: The user to add to the group.
+ :type user: CreateGroupMembershipUser
+ :param group: The group to add the user to.
+ :type group: CreateGroupMembershipGroup
+ :param role: The role of the user in the group., defaults to None
+ :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`.
+
+ 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., defaults to None
+ :type configurable_permissions: Union[Optional[Dict[str, bool]], NullValue], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'user': user,
+ 'group': group,
+ 'role': role,
+ 'configurable_permissions': configurable_permissions,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/group_memberships']
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, GroupMembership)
+
+ def get_group_membership_by_id(
+ self,
+ group_membership_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> GroupMembership:
+ """
+ Retrieves a specific group membership. Only admins of this
+
+ group or users with admin-level permissions will be able to
+
+
+ use this API.
+
+ :param group_membership_id: The ID of the group membership.
+ Example: "434534"
+ :type group_membership_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/group_memberships/',
+ to_string(group_membership_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, GroupMembership)
+
+ def update_group_membership_by_id(
+ self,
+ group_membership_id: str,
+ *,
+ role: Optional[UpdateGroupMembershipByIdRole] = None,
+ configurable_permissions: Union[Optional[Dict[str, bool]], NullValue] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> GroupMembership:
+ """
+ Updates a user's group membership. Only admins of this
+
+ group or users with admin-level permissions will be able to
+
+
+ use this API.
+
+ :param group_membership_id: The ID of the group membership.
+ Example: "434534"
+ :type group_membership_id: str
+ :param role: The role of the user in the group., defaults to None
+ :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`.
+
+ 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., defaults to None
+ :type configurable_permissions: Union[Optional[Dict[str, bool]], NullValue], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'role': role,
+ 'configurable_permissions': configurable_permissions,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/group_memberships/',
+ to_string(group_membership_id),
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, GroupMembership)
+
+ def delete_group_membership_by_id(
+ self,
+ group_membership_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a specific group membership. Only admins of this
+
+ group or users with admin-level permissions will be able to
+
+
+ use this API.
+
+ :param group_membership_id: The ID of the group membership.
+ Example: "434534"
+ :type group_membership_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/group_memberships/',
+ to_string(group_membership_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/metadata_cascade_policies.py b/box_sdk_gen/managers/metadata_cascade_policies.py
new file mode 100644
index 000000000..2d254c871
--- /dev/null
+++ b/box_sdk_gen/managers/metadata_cascade_policies.py
@@ -0,0 +1,333 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.metadata_cascade_policies import MetadataCascadePolicies
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.metadata_cascade_policy import MetadataCascadePolicy
+
+from box_sdk_gen.schemas.conflict_error import ConflictError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateMetadataCascadePolicyScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class ApplyMetadataCascadePolicyConflictResolution(str, Enum):
+ NONE = 'none'
+ OVERWRITE = 'overwrite'
+
+
+class MetadataCascadePoliciesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_metadata_cascade_policies(
+ self,
+ folder_id: str,
+ *,
+ owner_enterprise_id: Optional[str] = None,
+ marker: Optional[str] = None,
+ offset: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataCascadePolicies:
+ """
+ Retrieves a list of all the metadata cascade policies
+
+ that are applied to a given folder. This can not be used on the root
+
+
+ folder with ID `0`.
+
+ :param folder_id: Specifies which folder to return policies for. This can not be used on the
+ root folder with ID `0`.
+ :type folder_id: str
+ :param owner_enterprise_id: The ID of the enterprise ID for which to find metadata
+ cascade policies. If not specified, it defaults to the
+ current enterprise., defaults to None
+ :type owner_enterprise_id: Optional[str], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'folder_id': to_string(folder_id),
+ 'owner_enterprise_id': to_string(owner_enterprise_id),
+ 'marker': to_string(marker),
+ 'offset': to_string(offset),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_cascade_policies',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataCascadePolicies)
+
+ def create_metadata_cascade_policy(
+ self,
+ folder_id: str,
+ scope: CreateMetadataCascadePolicyScope,
+ template_key: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataCascadePolicy:
+ """
+ Creates a new metadata cascade policy that applies a given
+
+ metadata template to a given folder and automatically
+
+
+ cascades it down to any files within that folder.
+
+
+ In order for the policy to be applied a metadata instance must first
+
+
+ be applied to the folder the policy is to be applied to.
+
+ :param folder_id: The ID of the folder to apply the policy to. This folder will
+ need to already have an instance of the targeted metadata
+ template applied to it.
+ :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: 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
+ 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
+ :type template_key: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'folder_id': folder_id,
+ 'scope': scope,
+ 'templateKey': template_key,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_cascade_policies',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataCascadePolicy)
+
+ def get_metadata_cascade_policy_by_id(
+ self,
+ metadata_cascade_policy_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataCascadePolicy:
+ """
+ Retrieve a specific metadata cascade policy assigned to a folder.
+ :param metadata_cascade_policy_id: The ID of the metadata cascade policy.
+ Example: "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7"
+ :type metadata_cascade_policy_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_cascade_policies/',
+ to_string(metadata_cascade_policy_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataCascadePolicy)
+
+ def delete_metadata_cascade_policy_by_id(
+ self,
+ metadata_cascade_policy_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a metadata cascade policy.
+ :param metadata_cascade_policy_id: The ID of the metadata cascade policy.
+ Example: "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7"
+ :type metadata_cascade_policy_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_cascade_policies/',
+ to_string(metadata_cascade_policy_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def apply_metadata_cascade_policy(
+ self,
+ metadata_cascade_policy_id: str,
+ conflict_resolution: ApplyMetadataCascadePolicyConflictResolution,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Force the metadata on a folder with a metadata cascade policy to be applied to
+
+ all of its children. This can be used after creating a new cascade policy to
+
+
+ enforce the metadata to be cascaded down to all existing files within that
+
+
+ folder.
+
+ :param metadata_cascade_policy_id: The ID of the cascade policy to force-apply.
+ Example: "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7"
+ :type metadata_cascade_policy_id: str
+ :param conflict_resolution: 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.
+ :type conflict_resolution: ApplyMetadataCascadePolicyConflictResolution
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'conflict_resolution': conflict_resolution}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_cascade_policies/',
+ to_string(metadata_cascade_policy_id),
+ '/apply',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/metadata_templates.py b/box_sdk_gen/managers/metadata_templates.py
new file mode 100644
index 000000000..445c66a57
--- /dev/null
+++ b/box_sdk_gen/managers/metadata_templates.py
@@ -0,0 +1,636 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.metadata_templates import MetadataTemplates
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.metadata_template import MetadataTemplate
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetMetadataTemplateScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class UpdateMetadataTemplateScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class UpdateMetadataTemplateRequestBodyOpField(str, Enum):
+ EDITTEMPLATE = 'editTemplate'
+ ADDFIELD = 'addField'
+ REORDERFIELDS = 'reorderFields'
+ ADDENUMOPTION = 'addEnumOption'
+ REORDERENUMOPTIONS = 'reorderEnumOptions'
+ REORDERMULTISELECTOPTIONS = 'reorderMultiSelectOptions'
+ ADDMULTISELECTOPTION = 'addMultiSelectOption'
+ EDITFIELD = 'editField'
+ REMOVEFIELD = 'removeField'
+ EDITENUMOPTION = 'editEnumOption'
+ REMOVEENUMOPTION = 'removeEnumOption'
+ EDITMULTISELECTOPTION = 'editMultiSelectOption'
+ REMOVEMULTISELECTOPTION = 'removeMultiSelectOption'
+
+
+class UpdateMetadataTemplateRequestBody(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'field_key': 'fieldKey',
+ 'field_keys': 'fieldKeys',
+ 'enum_option_key': 'enumOptionKey',
+ 'enum_option_keys': 'enumOptionKeys',
+ 'multi_select_option_key': 'multiSelectOptionKey',
+ 'multi_select_option_keys': 'multiSelectOptionKeys',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'fieldKey': 'field_key',
+ 'fieldKeys': 'field_keys',
+ 'enumOptionKey': 'enum_option_key',
+ 'enumOptionKeys': 'enum_option_keys',
+ 'multiSelectOptionKey': 'multi_select_option_key',
+ 'multiSelectOptionKeys': 'multi_select_option_keys',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ op: UpdateMetadataTemplateRequestBodyOpField,
+ *,
+ data: Optional[Dict] = None,
+ field_key: Optional[str] = None,
+ field_keys: Optional[List[str]] = None,
+ enum_option_key: Optional[str] = None,
+ enum_option_keys: Optional[List[str]] = None,
+ multi_select_option_key: Optional[str] = None,
+ multi_select_option_keys: Optional[List[str]] = None,
+ **kwargs
+ ):
+ """
+ :param op: The type of change to perform on the template. Some
+ of these are hazardous as they will change existing templates.
+ :type op: UpdateMetadataTemplateRequestBodyOpField
+ :param data: The data for the operation. This will vary depending on the
+ operation being performed., defaults to None
+ :type data: Optional[Dict], optional
+ :param field_key: For operations that affect a single field this defines the key of
+ the field that is affected., defaults to None
+ :type field_key: Optional[str], optional
+ :param field_keys: For operations that affect multiple fields this defines the keys
+ of the fields that are affected., defaults to None
+ :type field_keys: Optional[List[str]], optional
+ :param enum_option_key: For operations that affect a single `enum` option this defines
+ the key of the option that is affected., defaults to None
+ :type enum_option_key: Optional[str], optional
+ :param enum_option_keys: For operations that affect multiple `enum` options this defines
+ the keys of the options that are affected., defaults to None
+ :type enum_option_keys: Optional[List[str]], optional
+ :param multi_select_option_key: For operations that affect a single multi select option this
+ defines the key of the option that is affected., defaults to None
+ :type multi_select_option_key: Optional[str], optional
+ :param multi_select_option_keys: For operations that affect multiple multi select options this
+ defines the keys of the options that are affected., defaults to None
+ :type multi_select_option_keys: Optional[List[str]], optional
+ """
+ super().__init__(**kwargs)
+ self.op = op
+ self.data = data
+ self.field_key = field_key
+ self.field_keys = field_keys
+ self.enum_option_key = enum_option_key
+ self.enum_option_keys = enum_option_keys
+ self.multi_select_option_key = multi_select_option_key
+ self.multi_select_option_keys = multi_select_option_keys
+
+
+class DeleteMetadataTemplateScope(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+
+
+class CreateMetadataTemplateFieldsTypeField(str, Enum):
+ STRING = 'string'
+ FLOAT = 'float'
+ DATE = 'date'
+ ENUM = 'enum'
+ MULTISELECT = 'multiSelect'
+
+
+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
+ option and the internal key used when updating templates.
+ :type key: str
+ """
+ super().__init__(**kwargs)
+ self.key = key
+
+
+class CreateMetadataTemplateFields(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'display_name': 'displayName',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'displayName': 'display_name',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {'string', 'float', 'date', 'enum', 'multiSelect'}
+
+ def __init__(
+ self,
+ type: CreateMetadataTemplateFieldsTypeField,
+ key: str,
+ display_name: str,
+ *,
+ description: Optional[str] = None,
+ hidden: Optional[bool] = None,
+ options: Optional[List[CreateMetadataTemplateFieldsOptionsField]] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of field. The basic fields are a `string` field for text, a
+ `float` field for numbers, and a `date` fields to present the user with a
+ date-time picker.
+
+ 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: CreateMetadataTemplateFieldsTypeField
+ :param key: A unique identifier for the field. The identifier must
+ be unique within the template to which it belongs.
+ :type key: str
+ :param display_name: The display name of the field as it is shown to the user in the web and
+ mobile apps.
+ :type display_name: str
+ :param description: A description of the field. This is not shown to the user., defaults to None
+ :type description: Optional[str], optional
+ :param hidden: Whether this field is hidden in the UI for the user and can only be set
+ through the API instead., defaults to None
+ :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., defaults to None
+ :type options: Optional[List[CreateMetadataTemplateFieldsOptionsField]], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.key = key
+ self.display_name = display_name
+ self.description = description
+ self.hidden = hidden
+ self.options = options
+
+
+class MetadataTemplatesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_metadata_templates_by_instance_id(
+ self,
+ metadata_instance_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataTemplates:
+ """
+ Finds a metadata template by searching for the ID of an instance of the
+
+ template.
+
+ :param metadata_instance_id: The ID of an instance of the metadata template to find.
+ :type metadata_instance_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'metadata_instance_id': to_string(metadata_instance_id),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/metadata_templates']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataTemplates)
+
+ def get_metadata_template(
+ self,
+ scope: GetMetadataTemplateScope,
+ template_key: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataTemplate:
+ """
+ Retrieves a metadata template by its `scope` and `templateKey` values.
+
+ To find the `scope` and `templateKey` for a template, list all templates for
+
+
+ an enterprise or globally, or list all templates applied to a file or folder.
+
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :type scope: GetMetadataTemplateScope
+ :param template_key: The name of the metadata template.
+ Example: "properties"
+ :type template_key: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ '/schema',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataTemplate)
+
+ def update_metadata_template(
+ self,
+ scope: UpdateMetadataTemplateScope,
+ template_key: str,
+ request_body: List[UpdateMetadataTemplateRequestBody],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataTemplate:
+ """
+ Updates a metadata template.
+
+ The metadata template can only be updated if the template
+
+
+ already exists.
+
+
+ The update is applied atomically. If any errors occur during the
+
+
+ application of the operations, the metadata template will not be changed.
+
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :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[UpdateMetadataTemplateRequestBody]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ '/schema',
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json-patch+json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataTemplate)
+
+ def delete_metadata_template(
+ self,
+ scope: DeleteMetadataTemplateScope,
+ template_key: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Delete a metadata template and its instances.
+
+ This deletion is permanent and can not be reversed.
+
+ :param scope: The scope of the metadata template.
+ Example: "global"
+ :type scope: DeleteMetadataTemplateScope
+ :param template_key: The name of the metadata template.
+ Example: "properties"
+ :type template_key: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/',
+ to_string(scope),
+ '/',
+ to_string(template_key),
+ '/schema',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_metadata_template_by_id(
+ self,
+ template_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataTemplate:
+ """
+ Retrieves a metadata template by its ID.
+ :param template_id: The ID of the template.
+ Example: "f7a9891f"
+ :type template_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/',
+ to_string(template_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataTemplate)
+
+ def get_global_metadata_templates(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataTemplates:
+ """
+ Used to retrieve all generic, global metadata templates available to all
+
+ enterprises using Box.
+
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination.
+
+ This requires `usemarker` to be set to `true`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/global',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataTemplates)
+
+ def get_enterprise_metadata_templates(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataTemplates:
+ """
+ Used to retrieve all metadata templates created to be used specifically within
+
+ the user's enterprise.
+
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination.
+
+ This requires `usemarker` to be set to `true`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/enterprise',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataTemplates)
+
+ def create_metadata_template(
+ self,
+ scope: str,
+ display_name: str,
+ *,
+ template_key: Optional[str] = None,
+ hidden: Optional[bool] = None,
+ fields: Optional[List[CreateMetadataTemplateFields]] = None,
+ copy_instance_on_item_copy: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataTemplate:
+ """
+ Creates a new metadata template that can be applied to
+
+ files and folders.
+
+ :param scope: The scope of the metadata template to create. Applications can
+ only create templates for use within the authenticated user's
+ enterprise.
+
+ This value needs to be set to `enterprise`, as `global` scopes can
+ not be created by applications.
+ :type scope: str
+ :param display_name: The display name of the template.
+ :type display_name: str
+ :param template_key: A unique identifier for the template. This identifier needs to be
+ unique across the enterprise for which the metadata template is
+ being created.
+
+ When not provided, the API will create a unique `templateKey`
+ based on the value of the `displayName`., defaults to None
+ :type template_key: Optional[str], optional
+ :param hidden: Defines if this template is visible in the Box web app UI, or if
+ it is purely intended for usage through the API., defaults to None
+ :type hidden: Optional[bool], optional
+ :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., defaults to None
+ :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., defaults to None
+ :type copy_instance_on_item_copy: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'scope': scope,
+ 'templateKey': template_key,
+ 'displayName': display_name,
+ 'hidden': hidden,
+ 'fields': fields,
+ 'copyInstanceOnItemCopy': copy_instance_on_item_copy,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_templates/schema',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataTemplate)
diff --git a/box_sdk_gen/managers/recent_items.py b/box_sdk_gen/managers/recent_items.py
new file mode 100644
index 000000000..83313a980
--- /dev/null
+++ b/box_sdk_gen/managers/recent_items.py
@@ -0,0 +1,109 @@
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.recent_items import RecentItems
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class RecentItemsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_recent_items(
+ self,
+ *,
+ fields: Optional[List[str]] = None,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RecentItems:
+ """
+ Returns information about the recent items accessed
+
+ by a user, either in the last 90 days or up to the last
+
+
+ 1000 items accessed.
+
+ :param fields: A comma-separated list of attributes to include in the
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'limit': to_string(limit),
+ 'marker': to_string(marker),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/recent_items']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RecentItems)
diff --git a/box_sdk_gen/managers/retention_policies.py b/box_sdk_gen/managers/retention_policies.py
new file mode 100644
index 000000000..9f5f5f723
--- /dev/null
+++ b/box_sdk_gen/managers/retention_policies.py
@@ -0,0 +1,443 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.retention_policies import RetentionPolicies
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.retention_policy import RetentionPolicy
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetRetentionPoliciesPolicyType(str, Enum):
+ FINITE = 'finite'
+ INDEFINITE = 'indefinite'
+
+
+class CreateRetentionPolicyPolicyType(str, Enum):
+ FINITE = 'finite'
+ INDEFINITE = 'indefinite'
+
+
+class CreateRetentionPolicyDispositionAction(str, Enum):
+ PERMANENTLY_DELETE = 'permanently_delete'
+ REMOVE_RETENTION = 'remove_retention'
+
+
+class CreateRetentionPolicyRetentionType(str, Enum):
+ MODIFIABLE = 'modifiable'
+ NON_MODIFIABLE = 'non_modifiable'
+
+
+class RetentionPoliciesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_retention_policies(
+ self,
+ *,
+ policy_name: Optional[str] = None,
+ policy_type: Optional[GetRetentionPoliciesPolicyType] = None,
+ created_by_user_id: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RetentionPolicies:
+ """
+ Retrieves all of the retention policies for an enterprise.
+ :param policy_name: Filters results by a case sensitive prefix of the name of
+ retention policies., defaults to None
+ :type policy_name: Optional[str], optional
+ :param policy_type: Filters results by the type of retention policy., defaults to None
+ :type policy_type: Optional[GetRetentionPoliciesPolicyType], optional
+ :param created_by_user_id: Filters results by the ID of the user who created policy., defaults to None
+ :type created_by_user_id: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination., defaults to None
+ :type marker: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'policy_name': to_string(policy_name),
+ 'policy_type': to_string(policy_type),
+ 'created_by_user_id': to_string(created_by_user_id),
+ 'fields': to_string(fields),
+ 'limit': to_string(limit),
+ 'marker': to_string(marker),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/retention_policies']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RetentionPolicies)
+
+ def create_retention_policy(
+ self,
+ policy_name: str,
+ policy_type: CreateRetentionPolicyPolicyType,
+ disposition_action: CreateRetentionPolicyDispositionAction,
+ *,
+ description: Optional[str] = None,
+ retention_length: Optional[str] = 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,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RetentionPolicy:
+ """
+ Creates a retention policy.
+ :param policy_name: The name for the retention policy.
+ :type policy_name: str
+ :param policy_type: 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.
+ :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: CreateRetentionPolicyDispositionAction
+ :param description: The additional text description of the retention policy., defaults to None
+ :type description: Optional[str], optional
+ :param retention_length: 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`., defaults to None
+ :type retention_length: Optional[str], optional
+ :param retention_type: 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., defaults to None
+ :type retention_type: Optional[CreateRetentionPolicyRetentionType], optional
+ :param can_owner_extend_retention: Whether the owner of a file will be allowed to
+ extend the retention., defaults to None
+ :type can_owner_extend_retention: Optional[bool], optional
+ :param are_owners_notified: Whether owner and co-owners of a file are notified
+ when the policy nears expiration., defaults to None
+ :type are_owners_notified: Optional[bool], optional
+ :param custom_notification_recipients: A list of users notified when
+ the retention policy duration is about to end., defaults to None
+ :type custom_notification_recipients: Optional[List[UserMini]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'policy_name': policy_name,
+ 'description': description,
+ 'policy_type': policy_type,
+ 'disposition_action': disposition_action,
+ 'retention_length': retention_length,
+ 'retention_type': retention_type,
+ 'can_owner_extend_retention': can_owner_extend_retention,
+ 'are_owners_notified': are_owners_notified,
+ 'custom_notification_recipients': custom_notification_recipients,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/retention_policies']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RetentionPolicy)
+
+ def get_retention_policy_by_id(
+ self,
+ retention_policy_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RetentionPolicy:
+ """
+ Retrieves a retention policy.
+ :param retention_policy_id: The ID of the retention policy.
+ Example: "982312"
+ :type retention_policy_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/retention_policies/',
+ to_string(retention_policy_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RetentionPolicy)
+
+ def update_retention_policy_by_id(
+ self,
+ retention_policy_id: str,
+ *,
+ policy_name: Union[Optional[str], NullValue] = None,
+ description: Union[Optional[str], NullValue] = None,
+ disposition_action: Optional[str] = None,
+ retention_type: Union[Optional[str], NullValue] = None,
+ retention_length: Optional[str] = None,
+ status: Union[Optional[str], NullValue] = None,
+ can_owner_extend_retention: Union[Optional[bool], NullValue] = None,
+ are_owners_notified: Union[Optional[bool], NullValue] = None,
+ custom_notification_recipients: Union[
+ Optional[List[UserBase]], NullValue
+ ] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RetentionPolicy:
+ """
+ Updates a retention policy.
+ :param retention_policy_id: The ID of the retention policy.
+ Example: "982312"
+ :type retention_policy_id: str
+ :param policy_name: The name for the retention policy., defaults to None
+ :type policy_name: Union[Optional[str], NullValue], optional
+ :param description: The additional text description of the retention policy., defaults to None
+ :type description: Union[Optional[str], NullValue], optional
+ :param disposition_action: The disposition action of the retention policy.
+ This action can be `permanently_delete`, which
+ will cause the content retained by the policy
+ to be permanently deleted, or `remove_retention`,
+ which will lift the retention policy from the content,
+ allowing it to be deleted by users,
+ once the retention policy has expired.
+ You can use `null` if you don't want to change `disposition_action`., defaults to None
+ :type disposition_action: Optional[str], optional
+ :param retention_type: Specifies the retention type:
+
+ * `modifiable`: You can modify the retention policy. For example,
+ you can add or remove folders, shorten or lengthen
+ the policy duration, or delete the assignment.
+ Use this type if your retention policy
+ is not related to any regulatory purposes.
+ * `non-modifiable`: You can modify the retention policy
+ only in a limited way: add a folder, lengthen the duration,
+ retire the policy, change the disposition action
+ or notification settings. You cannot perform other actions,
+ such as deleting the assignment or shortening the
+ policy duration. Use this type to ensure
+ compliance with regulatory retention policies.
+
+ When updating a retention policy, you can use
+ `non-modifiable` type only. You can convert a
+ `modifiable` policy to `non-modifiable`, but
+ not the other way around., defaults to None
+ :type retention_type: Union[Optional[str], NullValue], optional
+ :param retention_length: 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`., defaults to None
+ :type retention_length: Optional[str], optional
+ :param status: Used to retire a retention policy.
+
+ If not retiring a policy, do not include this parameter
+ or set it to `null`., defaults to None
+ :type status: Union[Optional[str], NullValue], optional
+ :param can_owner_extend_retention: Determines if the owner of items under the policy
+ can extend the retention when the original retention
+ duration is about to end., defaults to None
+ :type can_owner_extend_retention: Union[Optional[bool], NullValue], optional
+ :param are_owners_notified: Determines if owners and co-owners of items
+ under the policy are notified when
+ the retention duration is about to end., defaults to None
+ :type are_owners_notified: Union[Optional[bool], NullValue], optional
+ :param custom_notification_recipients: A list of users notified when the retention duration is about to end., defaults to None
+ :type custom_notification_recipients: Union[Optional[List[UserBase]], NullValue], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'policy_name': policy_name,
+ 'description': description,
+ 'disposition_action': disposition_action,
+ 'retention_type': retention_type,
+ 'retention_length': retention_length,
+ 'status': status,
+ 'can_owner_extend_retention': can_owner_extend_retention,
+ 'are_owners_notified': are_owners_notified,
+ 'custom_notification_recipients': custom_notification_recipients,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/retention_policies/',
+ to_string(retention_policy_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RetentionPolicy)
+
+ def delete_retention_policy_by_id(
+ self,
+ retention_policy_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Permanently deletes a retention policy.
+ :param retention_policy_id: The ID of the retention policy.
+ Example: "982312"
+ :type retention_policy_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/retention_policies/',
+ to_string(retention_policy_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/retention_policy_assignments.py b/box_sdk_gen/managers/retention_policy_assignments.py
new file mode 100644
index 000000000..fd612d1ec
--- /dev/null
+++ b/box_sdk_gen/managers/retention_policy_assignments.py
@@ -0,0 +1,371 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.retention_policy_assignments import RetentionPolicyAssignments
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.retention_policy_assignment import RetentionPolicyAssignment
+
+from box_sdk_gen.schemas.files_under_retention import FilesUnderRetention
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetRetentionPolicyAssignmentsType(str, Enum):
+ FOLDER = 'folder'
+ ENTERPRISE = 'enterprise'
+ METADATA_TEMPLATE = 'metadata_template'
+
+
+class CreateRetentionPolicyAssignmentAssignToTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+ FOLDER = 'folder'
+ METADATA_TEMPLATE = 'metadata_template'
+
+
+class CreateRetentionPolicyAssignmentAssignTo(BaseObject):
+ _discriminator = 'type', {'enterprise', 'folder', 'metadata_template'}
+
+ def __init__(
+ self,
+ type: CreateRetentionPolicyAssignmentAssignToTypeField,
+ *,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of item to assign the policy to.
+ :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`., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class CreateRetentionPolicyAssignmentFilterFields(BaseObject):
+ def __init__(
+ self, *, field: Optional[str] = None, value: Optional[str] = None, **kwargs
+ ):
+ """
+ :param field: The metadata attribute key id., defaults to None
+ :type field: Optional[str], optional
+ :param value: The metadata attribute field id. For value, only
+ enum and multiselect types are supported., defaults to None
+ :type value: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.field = field
+ self.value = value
+
+
+class RetentionPolicyAssignmentsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_retention_policy_assignments(
+ self,
+ retention_policy_id: str,
+ *,
+ type: Optional[GetRetentionPolicyAssignmentsType] = None,
+ fields: Optional[List[str]] = None,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RetentionPolicyAssignments:
+ """
+ Returns a list of all retention policy assignments associated with a specified
+
+ retention policy.
+
+ :param retention_policy_id: The ID of the retention policy.
+ Example: "982312"
+ :type retention_policy_id: str
+ :param type: The type of the retention policy assignment to retrieve., defaults to None
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'type': to_string(type),
+ 'fields': to_string(fields),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/retention_policies/',
+ to_string(retention_policy_id),
+ '/assignments',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RetentionPolicyAssignments)
+
+ def create_retention_policy_assignment(
+ self,
+ policy_id: str,
+ assign_to: CreateRetentionPolicyAssignmentAssignTo,
+ *,
+ filter_fields: Optional[
+ List[CreateRetentionPolicyAssignmentFilterFields]
+ ] = None,
+ start_date_field: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RetentionPolicyAssignment:
+ """
+ Assigns a retention policy to an item.
+ :param policy_id: The ID of the retention policy to assign.
+ :type policy_id: str
+ :param assign_to: The item to assign the policy to.
+ :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., defaults to None
+ :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., defaults to None
+ :type start_date_field: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'policy_id': policy_id,
+ 'assign_to': assign_to,
+ 'filter_fields': filter_fields,
+ 'start_date_field': start_date_field,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/retention_policy_assignments',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RetentionPolicyAssignment)
+
+ def get_retention_policy_assignment_by_id(
+ self,
+ retention_policy_assignment_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> RetentionPolicyAssignment:
+ """
+ Retrieves a retention policy assignment.
+ :param retention_policy_assignment_id: The ID of the retention policy assignment.
+ Example: "1233123"
+ :type retention_policy_assignment_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/retention_policy_assignments/',
+ to_string(retention_policy_assignment_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, RetentionPolicyAssignment)
+
+ def delete_retention_policy_assignment_by_id(
+ self,
+ retention_policy_assignment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes a retention policy assignment
+
+ applied to content.
+
+ :param retention_policy_assignment_id: The ID of the retention policy assignment.
+ Example: "1233123"
+ :type retention_policy_assignment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/retention_policy_assignments/',
+ to_string(retention_policy_assignment_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_files_under_retention_policy_assignment(
+ self,
+ retention_policy_assignment_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FilesUnderRetention:
+ """
+ Returns a list of files under retention for a retention policy assignment.
+ :param retention_policy_assignment_id: The ID of the retention policy assignment.
+ Example: "1233123"
+ :type retention_policy_assignment_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/retention_policy_assignments/',
+ to_string(retention_policy_assignment_id),
+ '/files_under_retention',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FilesUnderRetention)
diff --git a/box_sdk_gen/managers/search.py b/box_sdk_gen/managers/search.py
new file mode 100644
index 000000000..1d6ec33ed
--- /dev/null
+++ b/box_sdk_gen/managers/search.py
@@ -0,0 +1,560 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from typing import List
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.internal.utils import to_string
+
+from typing import Union
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.metadata_query_results import MetadataQueryResults
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.metadata_query import MetadataQuery
+
+from box_sdk_gen.schemas.search_results import SearchResults
+
+from box_sdk_gen.schemas.search_results_with_shared_links import (
+ SearchResultsWithSharedLinks,
+)
+
+from box_sdk_gen.schemas.metadata_filter import MetadataFilter
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+
+class SearchByMetadataQueryOrderByDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class SearchByMetadataQueryOrderBy(BaseObject):
+ def __init__(
+ self,
+ *,
+ field_key: Optional[str] = None,
+ direction: Optional[SearchByMetadataQueryOrderByDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param field_key: The metadata template field to order by.
+
+ The `field_key` represents the `key` value of a field from the
+ metadata template being searched for., defaults to None
+ :type field_key: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending.
+
+ The `ordering` direction must be the same for each item in the
+ array., defaults to None
+ :type direction: Optional[SearchByMetadataQueryOrderByDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.field_key = field_key
+ self.direction = direction
+
+
+class SearchForContentScope(str, Enum):
+ USER_CONTENT = 'user_content'
+ ENTERPRISE_CONTENT = 'enterprise_content'
+
+
+class SearchForContentContentTypes(str, Enum):
+ NAME = 'name'
+ DESCRIPTION = 'description'
+ FILE_CONTENT = 'file_content'
+ COMMENTS = 'comments'
+ TAG = 'tag'
+
+
+class SearchForContentType(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+ WEB_LINK = 'web_link'
+
+
+class SearchForContentTrashContent(str, Enum):
+ NON_TRASHED_ONLY = 'non_trashed_only'
+ TRASHED_ONLY = 'trashed_only'
+ ALL_ITEMS = 'all_items'
+
+
+class SearchForContentSort(str, Enum):
+ MODIFIED_AT = 'modified_at'
+ RELEVANCE = 'relevance'
+
+
+class SearchForContentDirection(str, Enum):
+ DESC = 'DESC'
+ ASC = 'ASC'
+
+
+class SearchManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def search_by_metadata_query(
+ self,
+ from_: str,
+ ancestor_folder_id: str,
+ *,
+ query: Optional[str] = None,
+ query_params: Optional[Dict] = None,
+ order_by: Optional[List[SearchByMetadataQueryOrderBy]] = None,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> MetadataQueryResults:
+ """
+ Create a search using SQL-like syntax to return items that match specific
+
+ metadata.
+
+
+ By default, this endpoint returns only the most basic info about the items for
+
+
+ which the query matches. To get additional fields for each item, including any
+
+
+ of the metadata, use the `fields` attribute in the query.
+
+ :param from_: Specifies the template used in the query. Must be in the form
+ `scope.templateKey`. Not all templates can be used in this field,
+ most notably the built-in, Box-provided classification templates
+ can not be used in a query.
+ :type from_: str
+ :param ancestor_folder_id: 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.
+ :type ancestor_folder_id: str
+ :param query: The query to perform. A query is a logical expression that is very similar
+ to a SQL `SELECT` statement. Values in the search query can be turned into
+ parameters specified in the `query_param` arguments list to prevent having
+ to manually insert search values into the query string.
+
+ For example, a value of `:amount` would represent the `amount` value in
+ `query_params` object., defaults to None
+ :type query: Optional[str], optional
+ :param query_params: 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., defaults to None
+ :type query_params: Optional[Dict], optional
+ :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., defaults to None
+ :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
+ returned., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: Marker to use for requesting the next page., defaults to None
+ :type marker: Optional[str], optional
+ :param fields: By default, this endpoint returns only the most basic info about the items for
+ which the query matches. This attribute can be used to specify a list of
+ additional attributes to return for any item, including its metadata.
+
+ This attribute takes a list of item fields, metadata template identifiers,
+ or metadata template field identifiers.
+
+ For example:
+
+ * `created_by` will add the details of the user who created the item to
+ the response.
+ * `metadata..` will return the mini-representation
+ of the metadata instance identified by the `scope` and `templateKey`.
+ * `metadata...` will return all the mini-representation
+ of the metadata instance identified by the `scope` and `templateKey` plus
+ the field specified by the `field` name. Multiple fields for the same
+ `scope` and `templateKey` can be defined., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'from': from_,
+ 'query': query,
+ 'query_params': query_params,
+ 'ancestor_folder_id': ancestor_folder_id,
+ 'order_by': order_by,
+ 'limit': limit,
+ 'marker': marker,
+ 'fields': fields,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/metadata_queries/execute_read',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, MetadataQueryResults)
+
+ def search_for_content(
+ self,
+ *,
+ query: Optional[str] = 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,
+ size_range: Optional[List[int]] = None,
+ 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[SearchForContentContentTypes]] = None,
+ type: Optional[SearchForContentType] = None,
+ trash_content: Optional[SearchForContentTrashContent] = None,
+ mdfilters: Optional[List[MetadataFilter]] = 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,
+ offset: Optional[int] = None,
+ deleted_user_ids: Optional[List[str]] = None,
+ deleted_at_range: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Union[SearchResults, SearchResultsWithSharedLinks]:
+ """
+ Searches for files, folders, web links, and shared files across the
+
+ users content or across the entire enterprise.
+
+ :param query: The string to search for. This query is matched against item names,
+ 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., defaults to None
+ :type query: Optional[str], optional
+ :param scope: 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., defaults to None
+ :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., defaults to None
+ :type file_extensions: Optional[List[str]], optional
+ :param created_at_range: Limits the search results to any items created within
+ a given date range.
+
+ Date ranges are defined as comma separated RFC3339
+ timestamps.
+
+ If the the start date is omitted (`,2014-05-17T13:35:01-07:00`)
+ anything created before the end date will be returned.
+
+ If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the
+ current date will be used as the end date instead., defaults to None
+ :type created_at_range: Optional[List[str]], optional
+ :param updated_at_range: Limits the search results to any items updated within
+ a given date range.
+
+ Date ranges are defined as comma separated RFC3339
+ timestamps.
+
+ If the start date is omitted (`,2014-05-17T13:35:01-07:00`)
+ anything updated before the end date will be returned.
+
+ If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the
+ current date will be used as the end date instead., defaults to None
+ :type updated_at_range: Optional[List[str]], optional
+ :param size_range: Limits the search results to any items with a size within
+ a given file size range. This applied to files and folders.
+
+ Size ranges are defined as comma separated list of a lower
+ and upper byte size limit (inclusive).
+
+ The upper and lower bound can be omitted to create open ranges., defaults to None
+ :type size_range: Optional[List[int]], optional
+ :param owner_user_ids: Limits the search results to any items that are owned
+ by the given list of owners, defined as a list of comma separated
+ user IDs.
+
+ The items still need to be owned or shared with
+ the currently authenticated user for them to show up in the search
+ results. If the user does not have access to any files owned by any of
+ the users an empty result set will be returned.
+
+ To search across an entire enterprise, we recommend using the
+ `enterprise_content` scope parameter which can be requested with our
+ support team., defaults to None
+ :type owner_user_ids: Optional[List[str]], optional
+ :param recent_updater_user_ids: 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., defaults to None
+ :type recent_updater_user_ids: Optional[List[str]], optional
+ :param ancestor_folder_ids: 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., defaults to None
+ :type ancestor_folder_ids: Optional[List[str]], optional
+ :param content_types: 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., defaults to None
+ :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.
+
+ * `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., defaults to None
+ :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`).
+
+ * `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., defaults to None
+ :type trash_content: Optional[SearchForContentTrashContent], optional
+ :param mdfilters: Limits the search results to any items for which the metadata matches the provided filter.
+ This parameter is a list that specifies exactly **one** metadata template used to filter the search results.
+ The parameter is required unless the `query` parameter is provided., defaults to None
+ :type mdfilters: Optional[List[MetadataFilter]], optional
+ :param sort: Defines the order in which search results are returned. This API
+ defaults to returning items by relevance unless this parameter is
+ 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., defaults to None
+ :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., defaults to None
+ :type direction: Optional[SearchForContentDirection], optional
+ :param limit: Defines the maximum number of items to return as part of a page of
+ results., defaults to None
+ :type limit: Optional[int], optional
+ :param include_recent_shared_links: Defines whether the search results should include any items
+ that the user recently accessed through a shared link.
+
+ When this parameter has been set to true,
+ the format of the response of this API changes to return
+ a list of [Search Results with
+ Shared Links](r://search_results_with_shared_links)., defaults to None
+ :type include_recent_shared_links: Optional[bool], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param deleted_user_ids: Limits the search results to items that were deleted by the given
+ list of users, defined as a list of comma separated user IDs.
+
+ The `trash_content` parameter needs to be set to `trashed_only`.
+
+ If searching in trash is not performed, an empty result set
+ is returned. The items need to be owned or shared with
+ the currently authenticated user for them to show up in the search
+ results.
+
+ If the user does not have access to any files owned by
+ any of the users, an empty result set is returned.
+
+ Data available from 2023-02-01 onwards., defaults to None
+ :type deleted_user_ids: Optional[List[str]], optional
+ :param deleted_at_range: Limits the search results to any items deleted within a given
+ date range.
+
+ Date ranges are defined as comma separated RFC3339 timestamps.
+
+ If the the start date is omitted (`2014-05-17T13:35:01-07:00`),
+ anything deleted before the end date will be returned.
+
+ If the end date is omitted (`2014-05-15T13:35:01-07:00`),
+ the current date will be used as the end date instead.
+
+ The `trash_content` parameter needs to be set to `trashed_only`.
+
+ If searching in trash is not performed, then an empty result
+ is returned.
+
+ Data available from 2023-02-01 onwards., defaults to None
+ :type deleted_at_range: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'query': to_string(query),
+ 'scope': to_string(scope),
+ 'file_extensions': to_string(file_extensions),
+ 'created_at_range': to_string(created_at_range),
+ 'updated_at_range': to_string(updated_at_range),
+ 'size_range': to_string(size_range),
+ 'owner_user_ids': to_string(owner_user_ids),
+ 'recent_updater_user_ids': to_string(recent_updater_user_ids),
+ 'ancestor_folder_ids': to_string(ancestor_folder_ids),
+ 'content_types': to_string(content_types),
+ 'type': to_string(type),
+ 'trash_content': to_string(trash_content),
+ 'mdfilters': to_string(mdfilters),
+ 'sort': to_string(sort),
+ 'direction': to_string(direction),
+ 'limit': to_string(limit),
+ 'include_recent_shared_links': to_string(include_recent_shared_links),
+ 'fields': to_string(fields),
+ 'offset': to_string(offset),
+ 'deleted_user_ids': to_string(deleted_user_ids),
+ 'deleted_at_range': to_string(deleted_at_range),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/search']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(
+ response.data, Union[SearchResults, SearchResultsWithSharedLinks]
+ )
diff --git a/box_sdk_gen/managers/session_termination.py b/box_sdk_gen/managers/session_termination.py
new file mode 100644
index 000000000..756666a0c
--- /dev/null
+++ b/box_sdk_gen/managers/session_termination.py
@@ -0,0 +1,139 @@
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.session_termination_message import SessionTerminationMessage
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class SessionTerminationManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def terminate_users_sessions(
+ self,
+ user_ids: List[str],
+ user_logins: List[str],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SessionTerminationMessage:
+ """
+ Validates the roles and permissions of the user,
+
+ and creates asynchronous jobs
+
+
+ to terminate the user's sessions.
+
+
+ Returns the status for the POST request.
+
+ :param user_ids: A list of user IDs.
+ :type user_ids: List[str]
+ :param user_logins: A list of user logins.
+ :type user_logins: List[str]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'user_ids': user_ids, 'user_logins': user_logins}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/terminate_sessions',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SessionTerminationMessage)
+
+ def terminate_groups_sessions(
+ self,
+ group_ids: List[str],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SessionTerminationMessage:
+ """
+ Validates the roles and permissions of the group,
+
+ and creates asynchronous jobs
+
+
+ to terminate the group's sessions.
+
+
+ Returns the status for the POST request.
+
+ :param group_ids: A list of group IDs.
+ :type group_ids: List[str]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'group_ids': group_ids}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/groups/terminate_sessions',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SessionTerminationMessage)
diff --git a/box_sdk_gen/managers/shared_links_app_items.py b/box_sdk_gen/managers/shared_links_app_items.py
new file mode 100644
index 000000000..bb9017660
--- /dev/null
+++ b/box_sdk_gen/managers/shared_links_app_items.py
@@ -0,0 +1,84 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.app_item import AppItem
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class SharedLinksAppItemsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def find_app_item_for_shared_link(
+ self, boxapi: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> AppItem:
+ """
+ Returns the app item represented by a shared link.
+
+ The link can originate from the current enterprise or another.
+
+ :param boxapi: A header containing the shared link and optional password for the
+ shared link.
+
+ The format for this header is `shared_link=[link]&shared_link_password=[password]`.
+ :type boxapi: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'boxapi': to_string(boxapi), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shared_items#app_items',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, AppItem)
diff --git a/box_sdk_gen/managers/shared_links_files.py b/box_sdk_gen/managers/shared_links_files.py
new file mode 100644
index 000000000..0cfad2018
--- /dev/null
+++ b/box_sdk_gen/managers/shared_links_files.py
@@ -0,0 +1,540 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class AddShareLinkToFileSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class AddShareLinkToFileSharedLinkPermissionsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ can_download: Optional[bool] = None,
+ can_preview: Optional[bool] = None,
+ can_edit: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param can_download: If the shared link allows for downloading of files.
+ This can only be set when `access` is set to
+ `open` or `company`., defaults to None
+ :type can_download: Optional[bool], optional
+ :param can_preview: If the shared link allows for previewing of files.
+ This value is always `true`. For shared links on folders
+ this also applies to any items in the folder., defaults to None
+ :type can_preview: Optional[bool], optional
+ :param can_edit: If the shared link allows for editing of files.
+ This can only be set when `access` is set to
+ `open` or `company`.
+ This value can only be `true` is `can_download` is
+ also `true`., defaults to None
+ :type can_edit: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class AddShareLinkToFileSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[AddShareLinkToFileSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[AddShareLinkToFileSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the file (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared
+ links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts. The value must be greater than the
+ current date and time., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class UpdateSharedLinkOnFileSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class UpdateSharedLinkOnFileSharedLinkPermissionsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ can_download: Optional[bool] = None,
+ can_preview: Optional[bool] = None,
+ can_edit: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param can_download: If the shared link allows for downloading of files.
+ This can only be set when `access` is set to
+ `open` or `company`., defaults to None
+ :type can_download: Optional[bool], optional
+ :param can_preview: If the shared link allows for previewing of files.
+ This value is always `true`. For shared links on folders
+ this also applies to any items in the folder., defaults to None
+ :type can_preview: Optional[bool], optional
+ :param can_edit: If the shared link allows for editing of files.
+ This can only be set when `access` is set to
+ `open` or `company`.
+ This value can only be `true` is `can_download` is
+ also `true`., defaults to None
+ :type can_edit: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class UpdateSharedLinkOnFileSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[UpdateSharedLinkOnFileSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[UpdateSharedLinkOnFileSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the folder (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared
+ links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts. The value must be greater than the
+ current date and time., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class RemoveSharedLinkFromFileSharedLink(BaseObject):
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+
+
+class SharedLinksFilesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def find_file_for_shared_link(
+ self,
+ boxapi: str,
+ *,
+ fields: Optional[List[str]] = None,
+ if_none_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileFull:
+ """
+ Returns the file represented by a shared link.
+
+ A shared file can be represented by a shared link,
+
+
+ which can originate within the current enterprise or within another.
+
+
+ This endpoint allows an application to retrieve information about a
+
+
+ shared file when only given a shared link.
+
+
+ The `shared_link_permission_options` array field can be returned
+
+
+ by requesting it in the `fields` query parameter.
+
+ :param boxapi: A header containing the shared link and optional password for the
+ shared link.
+
+ The format for this header is as follows:
+
+ `shared_link=[link]&shared_link_password=[password]`.
+ :type boxapi: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param if_none_match: Ensures an item is only returned if it has changed.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `304 Not Modified` if the item has not
+ changed since., defaults to None
+ :type if_none_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'if-none-match': to_string(if_none_match),
+ 'boxapi': to_string(boxapi),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/shared_items']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileFull)
+
+ def get_shared_link_for_file(
+ self,
+ file_id: str,
+ fields: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileFull:
+ """
+ Gets the information for a shared link on a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '#get_shared_link',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileFull)
+
+ def add_share_link_to_file(
+ self,
+ file_id: str,
+ fields: str,
+ *,
+ shared_link: Optional[AddShareLinkToFileSharedLink] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileFull:
+ """
+ Adds a shared link to a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :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., defaults to None
+ :type shared_link: Optional[AddShareLinkToFileSharedLink], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '#add_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileFull)
+
+ def update_shared_link_on_file(
+ self,
+ file_id: str,
+ fields: str,
+ *,
+ shared_link: Optional[UpdateSharedLinkOnFileSharedLink] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileFull:
+ """
+ Updates a shared link on a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param shared_link: The settings for the shared link to update., defaults to None
+ :type shared_link: Optional[UpdateSharedLinkOnFileSharedLink], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '#update_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileFull)
+
+ def remove_shared_link_from_file(
+ self,
+ file_id: str,
+ fields: str,
+ *,
+ shared_link: Union[
+ Optional[RemoveSharedLinkFromFileSharedLink], NullValue
+ ] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FileFull:
+ """
+ Removes a shared link from a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param shared_link: By setting this value to `null`, the shared link
+ is removed from the file., defaults to None
+ :type shared_link: Union[Optional[RemoveSharedLinkFromFileSharedLink], NullValue], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '#remove_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FileFull)
diff --git a/box_sdk_gen/managers/shared_links_folders.py b/box_sdk_gen/managers/shared_links_folders.py
new file mode 100644
index 000000000..94be61488
--- /dev/null
+++ b/box_sdk_gen/managers/shared_links_folders.py
@@ -0,0 +1,546 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.folder_full import FolderFull
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class AddShareLinkToFolderSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class AddShareLinkToFolderSharedLinkPermissionsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ can_download: Optional[bool] = None,
+ can_preview: Optional[bool] = None,
+ can_edit: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param can_download: If the shared link allows for downloading of files.
+ This can only be set when `access` is set to
+ `open` or `company`., defaults to None
+ :type can_download: Optional[bool], optional
+ :param can_preview: If the shared link allows for previewing of files.
+ This value is always `true`. For shared links on folders
+ this also applies to any items in the folder., defaults to None
+ :type can_preview: Optional[bool], optional
+ :param can_edit: This value can only be `false` for items
+ with a `type` of `folder`., defaults to None
+ :type can_edit: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class AddShareLinkToFolderSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[AddShareLinkToFolderSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[AddShareLinkToFolderSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the folder (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared
+ links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts. The value must be greater than the
+ current date and time., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class UpdateSharedLinkOnFolderSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class UpdateSharedLinkOnFolderSharedLinkPermissionsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ can_download: Optional[bool] = None,
+ can_preview: Optional[bool] = None,
+ can_edit: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param can_download: If the shared link allows for downloading of files.
+ This can only be set when `access` is set to
+ `open` or `company`., defaults to None
+ :type can_download: Optional[bool], optional
+ :param can_preview: If the shared link allows for previewing of files.
+ This value is always `true`. For shared links on folders
+ this also applies to any items in the folder., defaults to None
+ :type can_preview: Optional[bool], optional
+ :param can_edit: This value can only be `false` for items
+ with a `type` of `folder`., defaults to None
+ :type can_edit: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class UpdateSharedLinkOnFolderSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[UpdateSharedLinkOnFolderSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[
+ UpdateSharedLinkOnFolderSharedLinkPermissionsField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the folder (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared
+ links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts. The value must be greater than the
+ current date and time., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class RemoveSharedLinkFromFolderSharedLink(BaseObject):
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+
+
+class SharedLinksFoldersManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def find_folder_for_shared_link(
+ self,
+ boxapi: str,
+ *,
+ fields: Optional[List[str]] = None,
+ if_none_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ """
+ Return the folder represented by a shared link.
+
+ A shared folder can be represented by a shared link,
+
+
+ which can originate within the current enterprise or within another.
+
+
+ This endpoint allows an application to retrieve information about a
+
+
+ shared folder when only given a shared link.
+
+ :param boxapi: A header containing the shared link and optional password for the
+ shared link.
+
+ The format for this header is as follows:
+
+ `shared_link=[link]&shared_link_password=[password]`.
+ :type boxapi: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param if_none_match: Ensures an item is only returned if it has changed.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `304 Not Modified` if the item has not
+ changed since., defaults to None
+ :type if_none_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'if-none-match': to_string(if_none_match),
+ 'boxapi': to_string(boxapi),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shared_items#folders',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
+
+ def get_shared_link_for_folder(
+ self,
+ folder_id: str,
+ fields: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ """
+ Gets the information for a shared link on a folder.
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '#get_shared_link',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
+
+ def add_share_link_to_folder(
+ self,
+ folder_id: str,
+ fields: str,
+ *,
+ shared_link: Optional[AddShareLinkToFolderSharedLink] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ """
+ Adds a shared link to a folder.
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :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., defaults to None
+ :type shared_link: Optional[AddShareLinkToFolderSharedLink], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '#add_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
+
+ def update_shared_link_on_folder(
+ self,
+ folder_id: str,
+ fields: str,
+ *,
+ shared_link: Optional[UpdateSharedLinkOnFolderSharedLink] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ """
+ Updates a shared link on a folder.
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param shared_link: The settings for the shared link to update., defaults to None
+ :type shared_link: Optional[UpdateSharedLinkOnFolderSharedLink], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '#update_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
+
+ def remove_shared_link_from_folder(
+ self,
+ folder_id: str,
+ fields: str,
+ *,
+ shared_link: Union[
+ Optional[RemoveSharedLinkFromFolderSharedLink], NullValue
+ ] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ """
+ Removes a shared link from a folder.
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param shared_link: By setting this value to `null`, the shared link
+ is removed from the folder., defaults to None
+ :type shared_link: Union[Optional[RemoveSharedLinkFromFolderSharedLink], NullValue], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '#remove_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
diff --git a/box_sdk_gen/managers/shared_links_web_links.py b/box_sdk_gen/managers/shared_links_web_links.py
new file mode 100644
index 000000000..97ed09613
--- /dev/null
+++ b/box_sdk_gen/managers/shared_links_web_links.py
@@ -0,0 +1,508 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class AddShareLinkToWebLinkSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class AddShareLinkToWebLinkSharedLinkPermissionsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ can_download: Optional[bool] = None,
+ can_preview: Optional[bool] = None,
+ can_edit: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param can_download: If the shared link allows for downloading of files.
+ This can only be set when `access` is set to
+ `open` or `company`., defaults to None
+ :type can_download: Optional[bool], optional
+ :param can_preview: If the shared link allows for previewing of files.
+ This value is always `true`. For shared links on folders
+ this also applies to any items in the folder., defaults to None
+ :type can_preview: Optional[bool], optional
+ :param can_edit: This value can only be `true` is `type` is `file`., defaults to None
+ :type can_edit: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class AddShareLinkToWebLinkSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[AddShareLinkToWebLinkSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[AddShareLinkToWebLinkSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the file (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared
+ links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts. The value must be greater than the
+ current date and time., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class UpdateSharedLinkOnWebLinkSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class UpdateSharedLinkOnWebLinkSharedLinkPermissionsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ can_download: Optional[bool] = None,
+ can_preview: Optional[bool] = None,
+ can_edit: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param can_download: If the shared link allows for downloading of files.
+ This can only be set when `access` is set to
+ `open` or `company`., defaults to None
+ :type can_download: Optional[bool], optional
+ :param can_preview: If the shared link allows for previewing of files.
+ This value is always `true`. For shared links on folders
+ this also applies to any items in the folder., defaults to None
+ :type can_preview: Optional[bool], optional
+ :param can_edit: This value can only be `true` is `type` is `file`., defaults to None
+ :type can_edit: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class UpdateSharedLinkOnWebLinkSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[UpdateSharedLinkOnWebLinkSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[
+ UpdateSharedLinkOnWebLinkSharedLinkPermissionsField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the folder (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared
+ links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts. The value must be greater than the
+ current date and time., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class RemoveSharedLinkFromWebLinkSharedLink(BaseObject):
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+
+
+class SharedLinksWebLinksManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def find_web_link_for_shared_link(
+ self,
+ boxapi: str,
+ *,
+ fields: Optional[List[str]] = None,
+ if_none_match: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> WebLink:
+ """
+ Returns the web link represented by a shared link.
+
+ A shared web link can be represented by a shared link,
+
+
+ which can originate within the current enterprise or within another.
+
+
+ This endpoint allows an application to retrieve information about a
+
+
+ shared web link when only given a shared link.
+
+ :param boxapi: A header containing the shared link and optional password for the
+ shared link.
+
+ The format for this header is as follows:
+
+ `shared_link=[link]&shared_link_password=[password]`.
+ :type boxapi: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param if_none_match: Ensures an item is only returned if it has changed.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `304 Not Modified` if the item has not
+ changed since., defaults to None
+ :type if_none_match: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'if-none-match': to_string(if_none_match),
+ 'boxapi': to_string(boxapi),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shared_items#web_links',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, WebLink)
+
+ def get_shared_link_for_web_link(
+ self,
+ web_link_id: str,
+ fields: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> WebLink:
+ """
+ Gets the information for a shared link on a web link.
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ '#get_shared_link',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, WebLink)
+
+ def add_share_link_to_web_link(
+ self,
+ web_link_id: str,
+ fields: str,
+ *,
+ shared_link: Optional[AddShareLinkToWebLinkSharedLink] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> WebLink:
+ """
+ Adds a shared link to a web link.
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :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., defaults to None
+ :type shared_link: Optional[AddShareLinkToWebLinkSharedLink], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ '#add_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, WebLink)
+
+ def update_shared_link_on_web_link(
+ self,
+ web_link_id: str,
+ fields: str,
+ *,
+ shared_link: Optional[UpdateSharedLinkOnWebLinkSharedLink] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> WebLink:
+ """
+ Updates a shared link on a web link.
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param shared_link: The settings for the shared link to update., defaults to None
+ :type shared_link: Optional[UpdateSharedLinkOnWebLinkSharedLink], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ '#update_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, WebLink)
+
+ def remove_shared_link_from_web_link(
+ self,
+ web_link_id: str,
+ fields: str,
+ *,
+ shared_link: Union[
+ Optional[RemoveSharedLinkFromWebLinkSharedLink], NullValue
+ ] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> WebLink:
+ """
+ Removes a shared link from a web link.
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :param fields: Explicitly request the `shared_link` fields
+ to be returned for this item.
+ :type fields: str
+ :param shared_link: By setting this value to `null`, the shared link
+ is removed from the web link., defaults to None
+ :type shared_link: Union[Optional[RemoveSharedLinkFromWebLinkSharedLink], NullValue], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shared_link': shared_link}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ '#remove_shared_link',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, WebLink)
diff --git a/box_sdk_gen/managers/shield_information_barrier_reports.py b/box_sdk_gen/managers/shield_information_barrier_reports.py
new file mode 100644
index 000000000..d25c0bce8
--- /dev/null
+++ b/box_sdk_gen/managers/shield_information_barrier_reports.py
@@ -0,0 +1,183 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.shield_information_barrier_base import (
+ ShieldInformationBarrierBase,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_reports import (
+ ShieldInformationBarrierReports,
+)
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.shield_information_barrier_report import (
+ ShieldInformationBarrierReport,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_reference import (
+ ShieldInformationBarrierReference,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class ShieldInformationBarrierReportsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_shield_information_barrier_reports(
+ self,
+ shield_information_barrier_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierReports:
+ """
+ Lists shield information barrier reports.
+ :param shield_information_barrier_id: The ID of the shield information barrier.
+ :type shield_information_barrier_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'shield_information_barrier_id': to_string(
+ shield_information_barrier_id
+ ),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_reports',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierReports)
+
+ def create_shield_information_barrier_report(
+ self,
+ *,
+ shield_information_barrier: Optional[ShieldInformationBarrierBase] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierReport:
+ """
+ Creates a shield information barrier report for a given barrier.
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'shield_information_barrier': shield_information_barrier}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_reports',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierReport)
+
+ def get_shield_information_barrier_report_by_id(
+ self,
+ shield_information_barrier_report_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierReport:
+ """
+ Retrieves a shield information barrier report by its ID.
+ :param shield_information_barrier_report_id: The ID of the shield information barrier Report.
+ Example: "3423"
+ :type shield_information_barrier_report_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_reports/',
+ to_string(shield_information_barrier_report_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierReport)
diff --git a/box_sdk_gen/managers/shield_information_barrier_segment_members.py b/box_sdk_gen/managers/shield_information_barrier_segment_members.py
new file mode 100644
index 000000000..8580d3d54
--- /dev/null
+++ b/box_sdk_gen/managers/shield_information_barrier_segment_members.py
@@ -0,0 +1,282 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member import (
+ ShieldInformationBarrierSegmentMember,
+)
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_members import (
+ ShieldInformationBarrierSegmentMembers,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_base import (
+ ShieldInformationBarrierBase,
+)
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateShieldInformationBarrierSegmentMemberType(str, Enum):
+ SHIELD_INFORMATION_BARRIER_SEGMENT_MEMBER = (
+ 'shield_information_barrier_segment_member'
+ )
+
+
+class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField(
+ str, Enum
+):
+ SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment'
+
+
+class CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment(
+ BaseObject
+):
+ _discriminator = 'type', {'shield_information_barrier_segment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[
+ CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID reference of the
+ requesting shield information barrier segment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield barrier segment for this member., defaults to None
+ :type type: Optional[CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class ShieldInformationBarrierSegmentMembersManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_shield_information_barrier_segment_member_by_id(
+ self,
+ shield_information_barrier_segment_member_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegmentMember:
+ """
+ Retrieves a shield information barrier
+
+ segment member by its ID.
+
+ :param shield_information_barrier_segment_member_id: The ID of the shield information barrier segment Member.
+ Example: "7815"
+ :type shield_information_barrier_segment_member_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segment_members/',
+ to_string(shield_information_barrier_segment_member_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegmentMember)
+
+ def delete_shield_information_barrier_segment_member_by_id(
+ self,
+ shield_information_barrier_segment_member_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a shield information barrier
+
+ segment member based on provided ID.
+
+ :param shield_information_barrier_segment_member_id: The ID of the shield information barrier segment Member.
+ Example: "7815"
+ :type shield_information_barrier_segment_member_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segment_members/',
+ to_string(shield_information_barrier_segment_member_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_shield_information_barrier_segment_members(
+ self,
+ shield_information_barrier_segment_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegmentMembers:
+ """
+ Lists shield information barrier segment members
+
+ based on provided segment IDs.
+
+ :param shield_information_barrier_segment_id: The ID of the shield information barrier segment.
+ :type shield_information_barrier_segment_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'shield_information_barrier_segment_id': to_string(
+ shield_information_barrier_segment_id
+ ),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segment_members',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegmentMembers)
+
+ def create_shield_information_barrier_segment_member(
+ self,
+ shield_information_barrier_segment: CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment,
+ user: UserBase,
+ *,
+ type: Optional[CreateShieldInformationBarrierSegmentMemberType] = None,
+ shield_information_barrier: Optional[ShieldInformationBarrierBase] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegmentMember:
+ """
+ Creates a new shield information barrier segment member.
+ :param shield_information_barrier_segment: The `type` and `id` of the
+ requested shield information barrier segment.
+ :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., defaults to None
+ :type type: Optional[CreateShieldInformationBarrierSegmentMemberType], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'type': type,
+ 'shield_information_barrier': shield_information_barrier,
+ 'shield_information_barrier_segment': shield_information_barrier_segment,
+ 'user': user,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segment_members',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegmentMember)
diff --git a/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py b/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py
new file mode 100644
index 000000000..e499efbe3
--- /dev/null
+++ b/box_sdk_gen/managers/shield_information_barrier_segment_restrictions.py
@@ -0,0 +1,316 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction import (
+ ShieldInformationBarrierSegmentRestriction,
+)
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restrictions import (
+ ShieldInformationBarrierSegmentRestrictions,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_base import (
+ ShieldInformationBarrierBase,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateShieldInformationBarrierSegmentRestrictionType(str, Enum):
+ SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION = (
+ 'shield_information_barrier_segment_restriction'
+ )
+
+
+class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField(
+ str, Enum
+):
+ SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment'
+
+
+class CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment(
+ BaseObject
+):
+ _discriminator = 'type', {'shield_information_barrier_segment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[
+ CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID reference of the requesting
+ shield information barrier segment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield barrier segment for this member., defaults to None
+ :type type: Optional[CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField(
+ str, Enum
+):
+ SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment'
+
+
+class CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment(BaseObject):
+ _discriminator = 'type', {'shield_information_barrier_segment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[
+ CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID reference of the restricted
+ shield information barrier segment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the restricted shield
+ information barrier segment., defaults to None
+ :type type: Optional[CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class ShieldInformationBarrierSegmentRestrictionsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_shield_information_barrier_segment_restriction_by_id(
+ self,
+ shield_information_barrier_segment_restriction_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegmentRestriction:
+ """
+ Retrieves a shield information barrier segment
+
+ restriction based on provided ID.
+
+ :param shield_information_barrier_segment_restriction_id: The ID of the shield information barrier segment Restriction.
+ Example: "4563"
+ :type shield_information_barrier_segment_restriction_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segment_restrictions/',
+ to_string(shield_information_barrier_segment_restriction_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegmentRestriction)
+
+ def delete_shield_information_barrier_segment_restriction_by_id(
+ self,
+ shield_information_barrier_segment_restriction_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Delete shield information barrier segment restriction
+
+ based on provided ID.
+
+ :param shield_information_barrier_segment_restriction_id: The ID of the shield information barrier segment Restriction.
+ Example: "4563"
+ :type shield_information_barrier_segment_restriction_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segment_restrictions/',
+ to_string(shield_information_barrier_segment_restriction_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_shield_information_barrier_segment_restrictions(
+ self,
+ shield_information_barrier_segment_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegmentRestrictions:
+ """
+ Lists shield information barrier segment restrictions
+
+ based on provided segment ID.
+
+ :param shield_information_barrier_segment_id: The ID of the shield information barrier segment.
+ :type shield_information_barrier_segment_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'shield_information_barrier_segment_id': to_string(
+ shield_information_barrier_segment_id
+ ),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segment_restrictions',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegmentRestrictions)
+
+ def create_shield_information_barrier_segment_restriction(
+ self,
+ shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment,
+ restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment,
+ *,
+ type: CreateShieldInformationBarrierSegmentRestrictionType = CreateShieldInformationBarrierSegmentRestrictionType.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION,
+ shield_information_barrier: Optional[ShieldInformationBarrierBase] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegmentRestriction:
+ """
+ Creates a shield information barrier
+
+ segment restriction object.
+
+ :param shield_information_barrier_segment: The `type` and `id` of the requested
+ shield information barrier segment.
+ :type shield_information_barrier_segment: CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment
+ :param restricted_segment: The `type` and `id` of the restricted
+ shield information barrier segment.
+ :type restricted_segment: CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment
+ :param type: The type of the shield barrier segment
+ restriction for this member., defaults to CreateShieldInformationBarrierSegmentRestrictionType.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION
+ :type type: CreateShieldInformationBarrierSegmentRestrictionType, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'type': type,
+ 'shield_information_barrier': shield_information_barrier,
+ 'shield_information_barrier_segment': shield_information_barrier_segment,
+ 'restricted_segment': restricted_segment,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segment_restrictions',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegmentRestriction)
diff --git a/box_sdk_gen/managers/shield_information_barrier_segments.py b/box_sdk_gen/managers/shield_information_barrier_segments.py
new file mode 100644
index 000000000..d258edeca
--- /dev/null
+++ b/box_sdk_gen/managers/shield_information_barrier_segments.py
@@ -0,0 +1,279 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.shield_information_barrier_segment import (
+ ShieldInformationBarrierSegment,
+)
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.shield_information_barrier_segments import (
+ ShieldInformationBarrierSegments,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_base import (
+ ShieldInformationBarrierBase,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class ShieldInformationBarrierSegmentsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_shield_information_barrier_segment_by_id(
+ self,
+ shield_information_barrier_segment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegment:
+ """
+ Retrieves shield information barrier segment based on provided ID..
+ :param shield_information_barrier_segment_id: The ID of the shield information barrier segment.
+ Example: "3423"
+ :type shield_information_barrier_segment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segments/',
+ to_string(shield_information_barrier_segment_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegment)
+
+ def delete_shield_information_barrier_segment_by_id(
+ self,
+ shield_information_barrier_segment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes the shield information barrier segment
+
+ based on provided ID.
+
+ :param shield_information_barrier_segment_id: The ID of the shield information barrier segment.
+ Example: "3423"
+ :type shield_information_barrier_segment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segments/',
+ to_string(shield_information_barrier_segment_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def update_shield_information_barrier_segment_by_id(
+ self,
+ shield_information_barrier_segment_id: str,
+ *,
+ name: Optional[str] = None,
+ description: Union[Optional[str], NullValue] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegment:
+ """
+ Updates the shield information barrier segment based on provided ID..
+ :param shield_information_barrier_segment_id: The ID of the shield information barrier segment.
+ Example: "3423"
+ :type shield_information_barrier_segment_id: str
+ :param name: The updated name for the shield information barrier segment., defaults to None
+ :type name: Optional[str], optional
+ :param description: The updated description for
+ the shield information barrier segment., defaults to None
+ :type description: Union[Optional[str], NullValue], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'name': name, 'description': description}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segments/',
+ to_string(shield_information_barrier_segment_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegment)
+
+ def get_shield_information_barrier_segments(
+ self,
+ shield_information_barrier_id: str,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegments:
+ """
+ Retrieves a list of shield information barrier segment objects
+
+ for the specified Information Barrier ID.
+
+ :param shield_information_barrier_id: The ID of the shield information barrier.
+ :type shield_information_barrier_id: str
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'shield_information_barrier_id': to_string(
+ shield_information_barrier_id
+ ),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segments',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegments)
+
+ def create_shield_information_barrier_segment(
+ self,
+ shield_information_barrier: ShieldInformationBarrierBase,
+ name: str,
+ *,
+ description: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrierSegment:
+ """
+ Creates a shield information barrier segment.
+ :param name: Name of the shield information barrier segment.
+ :type name: str
+ :param description: Description of the shield information barrier segment., defaults to None
+ :type description: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'shield_information_barrier': shield_information_barrier,
+ 'name': name,
+ 'description': description,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barrier_segments',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrierSegment)
diff --git a/box_sdk_gen/managers/shield_information_barriers.py b/box_sdk_gen/managers/shield_information_barriers.py
new file mode 100644
index 000000000..b3784dae2
--- /dev/null
+++ b/box_sdk_gen/managers/shield_information_barriers.py
@@ -0,0 +1,219 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.shield_information_barrier import ShieldInformationBarrier
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.shield_information_barriers import ShieldInformationBarriers
+
+from box_sdk_gen.schemas.enterprise_base import EnterpriseBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class UpdateShieldInformationBarrierStatusStatus(str, Enum):
+ PENDING = 'pending'
+ DISABLED = 'disabled'
+
+
+class ShieldInformationBarriersManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_shield_information_barrier_by_id(
+ self,
+ shield_information_barrier_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrier:
+ """
+ Get shield information barrier based on provided ID.
+ :param shield_information_barrier_id: The ID of the shield information barrier.
+ Example: "1910967"
+ :type shield_information_barrier_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barriers/',
+ to_string(shield_information_barrier_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrier)
+
+ def update_shield_information_barrier_status(
+ self,
+ id: str,
+ status: UpdateShieldInformationBarrierStatusStatus,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrier:
+ """
+ Change status of shield information barrier with the specified ID.
+ :param id: The ID of the shield information barrier.
+ :type id: str
+ :param status: The desired status for the shield information barrier.
+ :type status: UpdateShieldInformationBarrierStatusStatus
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'id': id, 'status': status}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barriers/change_status',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrier)
+
+ def get_shield_information_barriers(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarriers:
+ """
+ Retrieves a list of shield information barrier objects
+
+ for the enterprise of JWT.
+
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barriers',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarriers)
+
+ def create_shield_information_barrier(
+ self,
+ enterprise: EnterpriseBase,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldInformationBarrier:
+ """
+ Creates a shield information barrier to
+
+ separate individuals/groups within the same
+
+
+ firm and prevents confidential information passing between them.
+
+ :param enterprise: The `type` and `id` of enterprise this barrier is under.
+ :type enterprise: EnterpriseBase
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'enterprise': enterprise}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_information_barriers',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldInformationBarrier)
diff --git a/box_sdk_gen/managers/shield_lists.py b/box_sdk_gen/managers/shield_lists.py
new file mode 100644
index 000000000..ec363b9a3
--- /dev/null
+++ b/box_sdk_gen/managers/shield_lists.py
@@ -0,0 +1,300 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import (
+ ShieldListContentCountryV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import (
+ ShieldListContentDomainV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import (
+ ShieldListContentEmailV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import (
+ ShieldListContentIpV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_request_v2025_r0 import (
+ ShieldListContentRequestV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_lists_v2025_r0 import ShieldListsV2025R0
+
+from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import (
+ BoxVersionHeaderV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_v2025_r0 import ShieldListV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.shield_lists_create_v2025_r0 import (
+ ShieldListsCreateV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_lists_update_v2025_r0 import (
+ ShieldListsUpdateV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class ShieldListsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_shield_lists_v2025_r0(
+ self,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldListsV2025R0:
+ """
+ Retrieves all shield lists in the enterprise.
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/shield_lists']
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldListsV2025R0)
+
+ def create_shield_list_v2025_r0(
+ self,
+ name: str,
+ content: ShieldListContentRequestV2025R0,
+ *,
+ description: Optional[str] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldListV2025R0:
+ """
+ Creates a shield list.
+ :param name: The name of the shield list.
+ :type name: str
+ :param description: Optional description of Shield List., defaults to None
+ :type description: Optional[str], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'name': name,
+ 'description': description,
+ 'content': content,
+ }
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/shield_lists']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldListV2025R0)
+
+ def get_shield_list_by_id_v2025_r0(
+ self,
+ shield_list_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldListV2025R0:
+ """
+ Retrieves a single shield list by its ID.
+ :param shield_list_id: The unique identifier that represents a shield list.
+ The ID for any Shield List can be determined by the response from the endpoint
+ fetching all shield lists for the enterprise.
+ Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 "
+ :type shield_list_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_lists/',
+ to_string(shield_list_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldListV2025R0)
+
+ def delete_shield_list_by_id_v2025_r0(
+ self,
+ shield_list_id: str,
+ *,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Delete a single shield list by its ID.
+ :param shield_list_id: The unique identifier that represents a shield list.
+ The ID for any Shield List can be determined by the response from the endpoint
+ fetching all shield lists for the enterprise.
+ Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 "
+ :type shield_list_id: str
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_lists/',
+ to_string(shield_list_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def update_shield_list_by_id_v2025_r0(
+ self,
+ shield_list_id: str,
+ name: str,
+ content: ShieldListContentRequestV2025R0,
+ *,
+ description: Optional[str] = None,
+ box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ShieldListV2025R0:
+ """
+ Updates a shield list.
+ :param shield_list_id: The unique identifier that represents a shield list.
+ The ID for any Shield List can be determined by the response from the endpoint
+ fetching all shield lists for the enterprise.
+ Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 "
+ :type shield_list_id: str
+ :param name: The name of the shield list.
+ :type name: str
+ :param description: Optional description of Shield List., defaults to None
+ :type description: Optional[str], optional
+ :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
+ :type box_version: BoxVersionHeaderV2025R0, optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'name': name,
+ 'description': description,
+ 'content': content,
+ }
+ headers_map: Dict[str, str] = prepare_params(
+ {'box-version': to_string(box_version), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/shield_lists/',
+ to_string(shield_list_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ShieldListV2025R0)
diff --git a/box_sdk_gen/managers/sign_requests.py b/box_sdk_gen/managers/sign_requests.py
new file mode 100644
index 000000000..bef15282c
--- /dev/null
+++ b/box_sdk_gen/managers/sign_requests.py
@@ -0,0 +1,348 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from typing import List
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.file_base import FileBase
+
+from box_sdk_gen.schemas.sign_request_create_signer import SignRequestCreateSigner
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.sign_request_prefill_tag import SignRequestPrefillTag
+
+from box_sdk_gen.schemas.sign_request import SignRequest
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.sign_requests import SignRequests
+
+from box_sdk_gen.schemas.sign_request_create_request import SignRequestCreateRequest
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateSignRequestSignatureColor(str, Enum):
+ BLUE = 'blue'
+ BLACK = 'black'
+ RED = 'red'
+
+
+class SignRequestsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def cancel_sign_request(
+ self,
+ sign_request_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SignRequest:
+ """
+ Cancels a sign request.
+ :param sign_request_id: The ID of the signature request.
+ Example: "33243242"
+ :type sign_request_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/sign_requests/',
+ to_string(sign_request_id),
+ '/cancel',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SignRequest)
+
+ def resend_sign_request(
+ self,
+ sign_request_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Resends a signature request email to all outstanding signers.
+ :param sign_request_id: The ID of the signature request.
+ Example: "33243242"
+ :type sign_request_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/sign_requests/',
+ to_string(sign_request_id),
+ '/resend',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def get_sign_request_by_id(
+ self,
+ sign_request_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SignRequest:
+ """
+ Gets a sign request by ID.
+ :param sign_request_id: The ID of the signature request.
+ Example: "33243242"
+ :type sign_request_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/sign_requests/',
+ to_string(sign_request_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SignRequest)
+
+ def get_sign_requests(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ senders: Optional[List[str]] = None,
+ shared_requests: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SignRequests:
+ """
+ Gets signature requests created by a user. If the `sign_files` and/or
+
+ `parent_folder` are deleted, the signature request will not return in the list.
+
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param senders: A list of sender emails to filter the signature requests by sender.
+ If provided, `shared_requests` must be set to `true`., defaults to None
+ :type senders: Optional[List[str]], optional
+ :param shared_requests: If set to `true`, only includes requests that user is not an owner,
+ but user is a collaborator. Collaborator access is determined by the
+ user access level of the sign files of the request.
+ Default is `false`. Must be set to `true` if `senders` are provided., defaults to None
+ :type shared_requests: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ 'senders': to_string(senders),
+ 'shared_requests': to_string(shared_requests),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/sign_requests']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SignRequests)
+
+ def create_sign_request(
+ self,
+ signers: List[SignRequestCreateSigner],
+ *,
+ source_files: Union[Optional[List[FileBase]], NullValue] = None,
+ signature_color: Union[
+ Optional[CreateSignRequestSignatureColor], NullValue
+ ] = None,
+ parent_folder: Optional[FolderMini] = None,
+ is_document_preparation_needed: Optional[bool] = None,
+ redirect_url: Union[Optional[str], NullValue] = None,
+ declined_redirect_url: Union[Optional[str], NullValue] = None,
+ are_text_signatures_enabled: Optional[bool] = None,
+ email_subject: Union[Optional[str], NullValue] = None,
+ email_message: Union[Optional[str], NullValue] = None,
+ are_reminders_enabled: Optional[bool] = None,
+ name: Optional[str] = None,
+ prefill_tags: Optional[List[SignRequestPrefillTag]] = None,
+ days_valid: Union[Optional[int], NullValue] = None,
+ external_id: Union[Optional[str], NullValue] = None,
+ template_id: Union[Optional[str], NullValue] = None,
+ external_system_name: Union[Optional[str], NullValue] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SignRequest:
+ """
+ Creates a signature request. This involves preparing a document for signing and
+
+ sending the signature request to signers.
+
+ :param signers: Array of signers for the signature request. 35 is the
+ max number of signers permitted.
+
+ **Note**: It may happen that some signers belong to conflicting [segments](r://shield-information-barrier-segment-member) (user groups).
+ This means that due to the security policies, users are assigned to segments to prevent exchanges or communication that could lead to ethical conflicts.
+ In such a case, an attempt to send the sign request will result in an error.
+
+ Read more about [segments and ethical walls](https://support.box.com/hc/en-us/articles/9920431507603-Understanding-Information-Barriers#h_01GFVJEHQA06N7XEZ4GCZ9GFAQ).
+ :type signers: List[SignRequestCreateSigner]
+ :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., defaults to None
+ :type source_files: Union[Optional[List[FileBase]], NullValue], optional
+ :param signature_color: Force a specific color for the signature (blue, black, or red)., defaults to None
+ :type signature_color: Union[Optional[CreateSignRequestSignatureColor], NullValue], optional
+ :param is_document_preparation_needed: Indicates if the sender should receive a `prepare_url` in the response to complete document preparation using the UI., defaults to None
+ :type is_document_preparation_needed: Optional[bool], optional
+ :param redirect_url: When specified, the signature request will be redirected to this url when a document is signed., defaults to None
+ :type redirect_url: Union[Optional[str], NullValue], optional
+ :param declined_redirect_url: The uri that a signer will be redirected to after declining to sign a document., defaults to None
+ :type declined_redirect_url: Union[Optional[str], NullValue], optional
+ :param are_text_signatures_enabled: Disables the usage of signatures generated by typing (text)., defaults to None
+ :type are_text_signatures_enabled: Optional[bool], optional
+ :param email_subject: Subject of sign request email. This is cleaned by sign request. If this field is not passed, a default subject will be used., defaults to None
+ :type email_subject: Union[Optional[str], NullValue], optional
+ :param email_message: Message to include in sign request email. The field is cleaned through sanitization of specific characters. However, some html tags are allowed. Links included in the message are also converted to hyperlinks in the email. The message may contain the following html tags including `a`, `abbr`, `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and `strong`. Be aware that when the text to html ratio is too high, the email may end up in spam filters. Custom styles on these tags are not allowed. If this field is not passed, a default message will be used., defaults to None
+ :type email_message: Union[Optional[str], NullValue], optional
+ :param are_reminders_enabled: Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to outstanding signers., defaults to None
+ :type are_reminders_enabled: Optional[bool], optional
+ :param name: Name of the signature request., defaults to None
+ :type name: Optional[str], optional
+ :param prefill_tags: When a document contains sign-related tags in the content, you can prefill them using this `prefill_tags` by referencing the 'id' of the tag as the `external_id` field of the prefill tag., defaults to None
+ :type prefill_tags: Optional[List[SignRequestPrefillTag]], optional
+ :param days_valid: Set the number of days after which the created signature request will automatically expire if not completed. By default, we do not apply any expiration date on signature requests, and the signature request does not expire., defaults to None
+ :type days_valid: Union[Optional[int], NullValue], optional
+ :param external_id: This can be used to reference an ID in an external system that the sign request is related to., defaults to None
+ :type external_id: Union[Optional[str], NullValue], optional
+ :param template_id: When a signature request is created from a template this field will indicate the id of that template., defaults to None
+ :type template_id: Union[Optional[str], NullValue], optional
+ :param external_system_name: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`., defaults to None
+ :type external_system_name: Union[Optional[str], NullValue], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'source_files': source_files,
+ 'signature_color': signature_color,
+ 'signers': signers,
+ 'parent_folder': parent_folder,
+ 'is_document_preparation_needed': is_document_preparation_needed,
+ 'redirect_url': redirect_url,
+ 'declined_redirect_url': declined_redirect_url,
+ 'are_text_signatures_enabled': are_text_signatures_enabled,
+ 'email_subject': email_subject,
+ 'email_message': email_message,
+ 'are_reminders_enabled': are_reminders_enabled,
+ 'name': name,
+ 'prefill_tags': prefill_tags,
+ 'days_valid': days_valid,
+ 'external_id': external_id,
+ 'template_id': template_id,
+ 'external_system_name': external_system_name,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/sign_requests']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SignRequest)
diff --git a/box_sdk_gen/managers/sign_templates.py b/box_sdk_gen/managers/sign_templates.py
new file mode 100644
index 000000000..531c1f0c6
--- /dev/null
+++ b/box_sdk_gen/managers/sign_templates.py
@@ -0,0 +1,123 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.sign_templates import SignTemplates
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.sign_template import SignTemplate
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class SignTemplatesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_sign_templates(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SignTemplates:
+ """
+ Gets Box Sign templates created by a user.
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination.
+
+ This requires `usemarker` to be set to `true`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/sign_templates']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SignTemplates)
+
+ def get_sign_template_by_id(
+ self,
+ template_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SignTemplate:
+ """
+ Fetches details of a specific Box Sign template.
+ :param template_id: The ID of a Box Sign template.
+ Example: "123075213-7d117509-8f05-42e4-a5ef-5190a319d41d"
+ :type template_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/sign_templates/',
+ to_string(template_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SignTemplate)
diff --git a/box_sdk_gen/managers/skills.py b/box_sdk_gen/managers/skills.py
new file mode 100644
index 000000000..26ae00b73
--- /dev/null
+++ b/box_sdk_gen/managers/skills.py
@@ -0,0 +1,442 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.skill_cards_metadata import SkillCardsMetadata
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.keyword_skill_card import KeywordSkillCard
+
+from box_sdk_gen.schemas.timeline_skill_card import TimelineSkillCard
+
+from box_sdk_gen.schemas.transcript_skill_card import TranscriptSkillCard
+
+from box_sdk_gen.schemas.status_skill_card import StatusSkillCard
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class UpdateBoxSkillCardsOnFileRequestBodyOpField(str, Enum):
+ REPLACE = 'replace'
+
+
+class UpdateBoxSkillCardsOnFileRequestBody(BaseObject):
+ def __init__(
+ self,
+ *,
+ op: Optional[UpdateBoxSkillCardsOnFileRequestBodyOpField] = None,
+ path: Optional[str] = None,
+ value: Optional[
+ Union[
+ KeywordSkillCard,
+ TimelineSkillCard,
+ TranscriptSkillCard,
+ StatusSkillCard,
+ ]
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param op: The value will always be `replace`., defaults to None
+ :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., defaults to None
+ :type path: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.op = op
+ self.path = path
+ self.value = value
+
+
+class UpdateAllSkillCardsOnFileStatus(str, Enum):
+ INVOKED = 'invoked'
+ PROCESSING = 'processing'
+ SUCCESS = 'success'
+ TRANSIENT_FAILURE = 'transient_failure'
+ PERMANENT_FAILURE = 'permanent_failure'
+
+
+class UpdateAllSkillCardsOnFileMetadata(BaseObject):
+ def __init__(
+ self,
+ *,
+ cards: Optional[
+ List[
+ Union[
+ KeywordSkillCard,
+ TimelineSkillCard,
+ TranscriptSkillCard,
+ StatusSkillCard,
+ ]
+ ]
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param cards: A list of Box Skill cards to apply to this file., defaults to None
+ :type cards: Optional[List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]], optional
+ """
+ super().__init__(**kwargs)
+ self.cards = cards
+
+
+class UpdateAllSkillCardsOnFileFileTypeField(str, Enum):
+ FILE = 'file'
+
+
+class UpdateAllSkillCardsOnFileFile(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[UpdateAllSkillCardsOnFileFileTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `file`., defaults to None
+ :type type: Optional[UpdateAllSkillCardsOnFileFileTypeField], optional
+ :param id: The ID of the file., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class UpdateAllSkillCardsOnFileFileVersionTypeField(str, Enum):
+ FILE_VERSION = 'file_version'
+
+
+class UpdateAllSkillCardsOnFileFileVersion(BaseObject):
+ _discriminator = 'type', {'file_version'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[UpdateAllSkillCardsOnFileFileVersionTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `file_version`., defaults to None
+ :type type: Optional[UpdateAllSkillCardsOnFileFileVersionTypeField], optional
+ :param id: The ID of the file version., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class UpdateAllSkillCardsOnFileUsage(BaseObject):
+ def __init__(
+ self, *, unit: Optional[str] = None, value: Optional[float] = None, **kwargs
+ ):
+ """
+ :param unit: The value will always be `file`., defaults to None
+ :type unit: Optional[str], optional
+ :param value: Number of resources affected., defaults to None
+ :type value: Optional[float], optional
+ """
+ super().__init__(**kwargs)
+ self.unit = unit
+ self.value = value
+
+
+class SkillsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_box_skill_cards_on_file(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SkillCardsMetadata:
+ """
+ List the Box Skills metadata cards that are attached to a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/global/boxSkillsCards',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SkillCardsMetadata)
+
+ def create_box_skill_cards_on_file(
+ self,
+ file_id: str,
+ cards: List[
+ Union[
+ KeywordSkillCard,
+ TimelineSkillCard,
+ TranscriptSkillCard,
+ StatusSkillCard,
+ ]
+ ],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SkillCardsMetadata:
+ """
+ Applies one or more Box Skills metadata cards to a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param cards: A list of Box Skill cards to apply to this file.
+ :type cards: List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'cards': cards}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/global/boxSkillsCards',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SkillCardsMetadata)
+
+ def update_box_skill_cards_on_file(
+ self,
+ file_id: str,
+ request_body: List[UpdateBoxSkillCardsOnFileRequestBody],
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> SkillCardsMetadata:
+ """
+ Updates one or more Box Skills metadata cards to a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :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., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/global/boxSkillsCards',
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json-patch+json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, SkillCardsMetadata)
+
+ def delete_box_skill_cards_from_file(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes any Box Skills cards metadata from a file.
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/metadata/global/boxSkillsCards',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def update_all_skill_cards_on_file(
+ self,
+ skill_id: str,
+ status: UpdateAllSkillCardsOnFileStatus,
+ metadata: UpdateAllSkillCardsOnFileMetadata,
+ file: UpdateAllSkillCardsOnFileFile,
+ *,
+ file_version: Optional[UpdateAllSkillCardsOnFileFileVersion] = None,
+ usage: Optional[UpdateAllSkillCardsOnFileUsage] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ An alternative method that can be used to overwrite and update all Box Skill
+
+ metadata cards on a file.
+
+ :param skill_id: The ID of the skill to apply this metadata for.
+ Example: "33243242"
+ :type skill_id: str
+ :param status: Defines the status of this invocation. Set this to `success` when setting Skill cards.
+ :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: UpdateAllSkillCardsOnFileMetadata
+ :param file: The file to assign the cards to.
+ :type file: UpdateAllSkillCardsOnFileFile
+ :param file_version: The optional file version to assign the cards to., defaults to None
+ :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., defaults to None
+ :type usage: Optional[UpdateAllSkillCardsOnFileUsage], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'status': status,
+ 'metadata': metadata,
+ 'file': file,
+ 'file_version': file_version,
+ 'usage': usage,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/skill_invocations/',
+ to_string(skill_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/storage_policies.py b/box_sdk_gen/managers/storage_policies.py
new file mode 100644
index 000000000..54f08cb97
--- /dev/null
+++ b/box_sdk_gen/managers/storage_policies.py
@@ -0,0 +1,140 @@
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.storage_policies import StoragePolicies
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.storage_policy import StoragePolicy
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class StoragePoliciesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_storage_policies(
+ self,
+ *,
+ fields: Optional[List[str]] = None,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> StoragePolicies:
+ """
+ Fetches all the storage policies in the enterprise.
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'marker': to_string(marker),
+ 'limit': to_string(limit),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/storage_policies']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, StoragePolicies)
+
+ def get_storage_policy_by_id(
+ self,
+ storage_policy_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> StoragePolicy:
+ """
+ Fetches a specific storage policy.
+ :param storage_policy_id: The ID of the storage policy.
+ Example: "34342"
+ :type storage_policy_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/storage_policies/',
+ to_string(storage_policy_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, StoragePolicy)
diff --git a/box_sdk_gen/managers/storage_policy_assignments.py b/box_sdk_gen/managers/storage_policy_assignments.py
new file mode 100644
index 000000000..be0f88b2a
--- /dev/null
+++ b/box_sdk_gen/managers/storage_policy_assignments.py
@@ -0,0 +1,352 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.storage_policy_assignments import StoragePolicyAssignments
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.storage_policy_assignment import StoragePolicyAssignment
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetStoragePolicyAssignmentsResolvedForType(str, Enum):
+ USER = 'user'
+ ENTERPRISE = 'enterprise'
+
+
+class CreateStoragePolicyAssignmentStoragePolicyTypeField(str, Enum):
+ STORAGE_POLICY = 'storage_policy'
+
+
+class CreateStoragePolicyAssignmentStoragePolicy(BaseObject):
+ _discriminator = 'type', {'storage_policy'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CreateStoragePolicyAssignmentStoragePolicyTypeField = CreateStoragePolicyAssignmentStoragePolicyTypeField.STORAGE_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the storage policy to assign.
+ :type id: str
+ :param type: The type to assign., defaults to CreateStoragePolicyAssignmentStoragePolicyTypeField.STORAGE_POLICY
+ :type type: CreateStoragePolicyAssignmentStoragePolicyTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CreateStoragePolicyAssignmentAssignedToTypeField(str, Enum):
+ USER = 'user'
+ ENTERPRISE = 'enterprise'
+
+
+class CreateStoragePolicyAssignmentAssignedTo(BaseObject):
+ _discriminator = 'type', {'user', 'enterprise'}
+
+ def __init__(
+ self, type: CreateStoragePolicyAssignmentAssignedToTypeField, id: str, **kwargs
+ ):
+ """
+ :param type: The type to assign the policy to.
+ :type type: CreateStoragePolicyAssignmentAssignedToTypeField
+ :param id: The ID of the user or enterprise.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class UpdateStoragePolicyAssignmentByIdStoragePolicyTypeField(str, Enum):
+ STORAGE_POLICY = 'storage_policy'
+
+
+class UpdateStoragePolicyAssignmentByIdStoragePolicy(BaseObject):
+ _discriminator = 'type', {'storage_policy'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: UpdateStoragePolicyAssignmentByIdStoragePolicyTypeField = UpdateStoragePolicyAssignmentByIdStoragePolicyTypeField.STORAGE_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the storage policy to assign.
+ :type id: str
+ :param type: The type to assign., defaults to UpdateStoragePolicyAssignmentByIdStoragePolicyTypeField.STORAGE_POLICY
+ :type type: UpdateStoragePolicyAssignmentByIdStoragePolicyTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class StoragePolicyAssignmentsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_storage_policy_assignments(
+ self,
+ resolved_for_type: GetStoragePolicyAssignmentsResolvedForType,
+ resolved_for_id: str,
+ *,
+ marker: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> StoragePolicyAssignments:
+ """
+ Fetches all the storage policy assignment for an enterprise or user.
+ :param resolved_for_type: The target type to return assignments for.
+ :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
+ used when paginating using marker-based pagination.
+
+ This requires `usemarker` to be set to `true`., defaults to None
+ :type marker: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'marker': to_string(marker),
+ 'resolved_for_type': to_string(resolved_for_type),
+ 'resolved_for_id': to_string(resolved_for_id),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/storage_policy_assignments',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, StoragePolicyAssignments)
+
+ def create_storage_policy_assignment(
+ self,
+ 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: CreateStoragePolicyAssignmentStoragePolicy
+ :param assigned_to: The user or enterprise to assign the storage
+ policy to.
+ :type assigned_to: CreateStoragePolicyAssignmentAssignedTo
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'storage_policy': storage_policy,
+ 'assigned_to': assigned_to,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/storage_policy_assignments',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, StoragePolicyAssignment)
+
+ def get_storage_policy_assignment_by_id(
+ self,
+ storage_policy_assignment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> StoragePolicyAssignment:
+ """
+ Fetches a specific storage policy assignment.
+ :param storage_policy_assignment_id: The ID of the storage policy assignment.
+ Example: "932483"
+ :type storage_policy_assignment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/storage_policy_assignments/',
+ to_string(storage_policy_assignment_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, StoragePolicyAssignment)
+
+ def update_storage_policy_assignment_by_id(
+ self,
+ storage_policy_assignment_id: str,
+ storage_policy: UpdateStoragePolicyAssignmentByIdStoragePolicy,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> StoragePolicyAssignment:
+ """
+ Updates a specific storage policy assignment.
+ :param storage_policy_assignment_id: The ID of the storage policy assignment.
+ Example: "932483"
+ :type storage_policy_assignment_id: str
+ :param storage_policy: The storage policy to assign to the user or
+ enterprise.
+ :type storage_policy: UpdateStoragePolicyAssignmentByIdStoragePolicy
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'storage_policy': storage_policy}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/storage_policy_assignments/',
+ to_string(storage_policy_assignment_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, StoragePolicyAssignment)
+
+ def delete_storage_policy_assignment_by_id(
+ self,
+ storage_policy_assignment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Delete a storage policy assignment.
+
+ Deleting a storage policy assignment on a user
+
+
+ will have the user inherit the enterprise's default
+
+
+ storage policy.
+
+
+ There is a rate limit for calling this endpoint of only
+
+
+ twice per user in a 24 hour time frame.
+
+ :param storage_policy_assignment_id: The ID of the storage policy assignment.
+ Example: "932483"
+ :type storage_policy_assignment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/storage_policy_assignments/',
+ to_string(storage_policy_assignment_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/task_assignments.py b/box_sdk_gen/managers/task_assignments.py
new file mode 100644
index 000000000..f7d5a8139
--- /dev/null
+++ b/box_sdk_gen/managers/task_assignments.py
@@ -0,0 +1,303 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.task_assignments import TaskAssignments
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.task_assignment import TaskAssignment
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateTaskAssignmentTaskTypeField(str, Enum):
+ TASK = 'task'
+
+
+class CreateTaskAssignmentTask(BaseObject):
+ _discriminator = 'type', {'task'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CreateTaskAssignmentTaskTypeField = CreateTaskAssignmentTaskTypeField.TASK,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the task.
+ :type id: str
+ :param type: The type of the item to assign., defaults to CreateTaskAssignmentTaskTypeField.TASK
+ :type type: CreateTaskAssignmentTaskTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+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
+ task.
+
+ To specify a user by their email
+ address use the `login` parameter., defaults to None
+ :type id: Optional[str], optional
+ :param login: The email address of the user to assign to the task.
+ To specify a user by their user ID please use the `id` parameter., defaults to None
+ :type login: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.login = login
+
+
+class UpdateTaskAssignmentByIdResolutionState(str, Enum):
+ COMPLETED = 'completed'
+ INCOMPLETE = 'incomplete'
+ APPROVED = 'approved'
+ REJECTED = 'rejected'
+
+
+class TaskAssignmentsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_task_assignments(
+ self, task_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TaskAssignments:
+ """
+ Lists all of the assignments for a given task.
+ :param task_id: The ID of the task.
+ Example: "12345"
+ :type task_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/tasks/',
+ to_string(task_id),
+ '/assignments',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TaskAssignments)
+
+ def create_task_assignment(
+ self,
+ task: CreateTaskAssignmentTask,
+ assign_to: CreateTaskAssignmentAssignTo,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TaskAssignment:
+ """
+ Assigns a task to a user.
+
+ A task can be assigned to more than one user by creating multiple
+
+
+ assignments.
+
+ :param task: The task to assign to a user.
+ :type task: CreateTaskAssignmentTask
+ :param assign_to: The user to assign the task to.
+ :type assign_to: CreateTaskAssignmentAssignTo
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'task': task, 'assign_to': assign_to}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/task_assignments']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TaskAssignment)
+
+ def get_task_assignment_by_id(
+ self,
+ task_assignment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TaskAssignment:
+ """
+ Retrieves information about a task assignment.
+ :param task_assignment_id: The ID of the task assignment.
+ Example: "12345"
+ :type task_assignment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/task_assignments/',
+ to_string(task_assignment_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TaskAssignment)
+
+ def update_task_assignment_by_id(
+ self,
+ task_assignment_id: str,
+ *,
+ message: Optional[str] = None,
+ resolution_state: Optional[UpdateTaskAssignmentByIdResolutionState] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TaskAssignment:
+ """
+ Updates a task assignment. This endpoint can be
+
+ used to update the state of a task assigned to a user.
+
+ :param task_assignment_id: The ID of the task assignment.
+ Example: "12345"
+ :type task_assignment_id: str
+ :param message: An optional message by the assignee that can be added to the task., defaults to None
+ :type message: Optional[str], optional
+ :param resolution_state: 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`., defaults to None
+ :type resolution_state: Optional[UpdateTaskAssignmentByIdResolutionState], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'message': message, 'resolution_state': resolution_state}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/task_assignments/',
+ to_string(task_assignment_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TaskAssignment)
+
+ def delete_task_assignment_by_id(
+ self,
+ task_assignment_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a specific task assignment.
+ :param task_assignment_id: The ID of the task assignment.
+ Example: "12345"
+ :type task_assignment_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/task_assignments/',
+ to_string(task_assignment_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/tasks.py b/box_sdk_gen/managers/tasks.py
new file mode 100644
index 000000000..47becd4f6
--- /dev/null
+++ b/box_sdk_gen/managers/tasks.py
@@ -0,0 +1,338 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.tasks import Tasks
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.task import Task
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class CreateTaskItemTypeField(str, Enum):
+ FILE = 'file'
+
+
+class CreateTaskItem(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[CreateTaskItemTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the file., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `file`., defaults to None
+ :type type: Optional[CreateTaskItemTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CreateTaskAction(str, Enum):
+ REVIEW = 'review'
+ COMPLETE = 'complete'
+
+
+class CreateTaskCompletionRule(str, Enum):
+ ALL_ASSIGNEES = 'all_assignees'
+ ANY_ASSIGNEE = 'any_assignee'
+
+
+class UpdateTaskByIdAction(str, Enum):
+ REVIEW = 'review'
+ COMPLETE = 'complete'
+
+
+class UpdateTaskByIdCompletionRule(str, Enum):
+ ALL_ASSIGNEES = 'all_assignees'
+ ANY_ASSIGNEE = 'any_assignee'
+
+
+class TasksManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_file_tasks(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Tasks:
+ """
+ Retrieves a list of all the tasks for a file. This
+
+ endpoint does not support pagination.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/tasks',
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Tasks)
+
+ def create_task(
+ self,
+ item: CreateTaskItem,
+ *,
+ action: Optional[CreateTaskAction] = None,
+ message: Optional[str] = None,
+ due_at: Optional[DateTime] = None,
+ completion_rule: Optional[CreateTaskCompletionRule] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Task:
+ """
+ Creates a single task on a file. This task is not assigned to any user and
+
+ will need to be assigned separately.
+
+ :param item: The file to attach the task to.
+ :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., defaults to None
+ :type action: Optional[CreateTaskAction], optional
+ :param message: An optional message to include with the task., defaults to None
+ :type message: Optional[str], optional
+ :param due_at: Defines when the task is due. Defaults to `null` if not
+ provided., defaults to None
+ :type due_at: Optional[DateTime], optional
+ :param completion_rule: 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., defaults to None
+ :type completion_rule: Optional[CreateTaskCompletionRule], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'item': item,
+ 'action': action,
+ 'message': message,
+ 'due_at': due_at,
+ 'completion_rule': completion_rule,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/tasks']),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Task)
+
+ def get_task_by_id(
+ self, task_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Task:
+ """
+ Retrieves information about a specific task.
+ :param task_id: The ID of the task.
+ Example: "12345"
+ :type task_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/tasks/',
+ to_string(task_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Task)
+
+ def update_task_by_id(
+ self,
+ task_id: str,
+ *,
+ action: Optional[UpdateTaskByIdAction] = None,
+ message: Optional[str] = None,
+ due_at: Optional[DateTime] = None,
+ completion_rule: Optional[UpdateTaskByIdCompletionRule] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Task:
+ """
+ Updates a task. This can be used to update a task's configuration, or to
+
+ update its completion state.
+
+ :param task_id: The ID of the task.
+ Example: "12345"
+ :type task_id: str
+ :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., defaults to None
+ :type action: Optional[UpdateTaskByIdAction], optional
+ :param message: The message included with the task., defaults to None
+ :type message: Optional[str], optional
+ :param due_at: When the task is due at., defaults to None
+ :type due_at: Optional[DateTime], optional
+ :param completion_rule: 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., defaults to None
+ :type completion_rule: Optional[UpdateTaskByIdCompletionRule], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'action': action,
+ 'message': message,
+ 'due_at': due_at,
+ 'completion_rule': completion_rule,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/tasks/',
+ to_string(task_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Task)
+
+ def delete_task_by_id(
+ self, task_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Removes a task from a file.
+ :param task_id: The ID of the task.
+ Example: "12345"
+ :type task_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/tasks/',
+ to_string(task_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/terms_of_service_user_statuses.py b/box_sdk_gen/managers/terms_of_service_user_statuses.py
new file mode 100644
index 000000000..9374d3c21
--- /dev/null
+++ b/box_sdk_gen/managers/terms_of_service_user_statuses.py
@@ -0,0 +1,235 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.terms_of_service_user_statuses import (
+ TermsOfServiceUserStatuses,
+)
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.terms_of_service_user_status import TermsOfServiceUserStatus
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class CreateTermsOfServiceStatusForUserTosTypeField(str, Enum):
+ TERMS_OF_SERVICE = 'terms_of_service'
+
+
+class CreateTermsOfServiceStatusForUserTos(BaseObject):
+ _discriminator = 'type', {'terms_of_service'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CreateTermsOfServiceStatusForUserTosTypeField = CreateTermsOfServiceStatusForUserTosTypeField.TERMS_OF_SERVICE,
+ **kwargs
+ ):
+ """
+ :param id: The ID of terms of service.
+ :type id: str
+ :param type: The type of object., defaults to CreateTermsOfServiceStatusForUserTosTypeField.TERMS_OF_SERVICE
+ :type type: CreateTermsOfServiceStatusForUserTosTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CreateTermsOfServiceStatusForUserUserTypeField(str, Enum):
+ USER = 'user'
+
+
+class CreateTermsOfServiceStatusForUserUser(BaseObject):
+ _discriminator = 'type', {'user'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CreateTermsOfServiceStatusForUserUserTypeField = CreateTermsOfServiceStatusForUserUserTypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The ID of user.
+ :type id: str
+ :param type: The type of object., defaults to CreateTermsOfServiceStatusForUserUserTypeField.USER
+ :type type: CreateTermsOfServiceStatusForUserUserTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class TermsOfServiceUserStatusesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_terms_of_service_user_statuses(
+ self,
+ tos_id: str,
+ *,
+ user_id: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TermsOfServiceUserStatuses:
+ """
+ Retrieves an overview of users and their status for a
+
+ terms of service, including Whether they have accepted
+
+
+ the terms and when.
+
+ :param tos_id: The ID of the terms of service.
+ :type tos_id: str
+ :param user_id: Limits results to the given user ID., defaults to None
+ :type user_id: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/terms_of_service_user_statuses',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TermsOfServiceUserStatuses)
+
+ def create_terms_of_service_status_for_user(
+ self,
+ 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: CreateTermsOfServiceStatusForUserTos
+ :param user: The user to set the status for.
+ :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., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'tos': tos, 'user': user, 'is_accepted': is_accepted}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/terms_of_service_user_statuses',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TermsOfServiceUserStatus)
+
+ def update_terms_of_service_status_for_user_by_id(
+ self,
+ terms_of_service_user_status_id: str,
+ is_accepted: bool,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TermsOfServiceUserStatus:
+ """
+ Updates the status for a terms of service for a user.
+ :param terms_of_service_user_status_id: The ID of the terms of service status.
+ Example: "324234"
+ :type terms_of_service_user_status_id: str
+ :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., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'is_accepted': is_accepted}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/terms_of_service_user_statuses/',
+ to_string(terms_of_service_user_status_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TermsOfServiceUserStatus)
diff --git a/box_sdk_gen/managers/terms_of_services.py b/box_sdk_gen/managers/terms_of_services.py
new file mode 100644
index 000000000..2440409f1
--- /dev/null
+++ b/box_sdk_gen/managers/terms_of_services.py
@@ -0,0 +1,235 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.terms_of_services import TermsOfServices
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.terms_of_service import TermsOfService
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetTermsOfServiceTosType(str, Enum):
+ EXTERNAL = 'external'
+ MANAGED = 'managed'
+
+
+class CreateTermsOfServiceStatus(str, Enum):
+ ENABLED = 'enabled'
+ DISABLED = 'disabled'
+
+
+class CreateTermsOfServiceTosType(str, Enum):
+ EXTERNAL = 'external'
+ MANAGED = 'managed'
+
+
+class UpdateTermsOfServiceByIdStatus(str, Enum):
+ ENABLED = 'enabled'
+ DISABLED = 'disabled'
+
+
+class TermsOfServicesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_terms_of_service(
+ self,
+ *,
+ tos_type: Optional[GetTermsOfServiceTosType] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TermsOfServices:
+ """
+ Returns the current terms of service text and settings
+
+ for the enterprise.
+
+ :param tos_type: Limits the results to the terms of service of the given type., defaults to None
+ :type tos_type: Optional[GetTermsOfServiceTosType], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/terms_of_services']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TermsOfServices)
+
+ def create_terms_of_service(
+ self,
+ status: CreateTermsOfServiceStatus,
+ text: str,
+ *,
+ tos_type: Optional[CreateTermsOfServiceTosType] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TermsOfService:
+ """
+ Creates a terms of service for a given enterprise
+
+ and type of user.
+
+ :param status: Whether this terms of service is active.
+ :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., defaults to None
+ :type tos_type: Optional[CreateTermsOfServiceTosType], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'status': status, 'tos_type': tos_type, 'text': text}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/terms_of_services']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TermsOfService)
+
+ def get_terms_of_service_by_id(
+ self,
+ terms_of_service_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TermsOfService:
+ """
+ Fetches a specific terms of service.
+ :param terms_of_service_id: The ID of the terms of service.
+ Example: "324234"
+ :type terms_of_service_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/terms_of_services/',
+ to_string(terms_of_service_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TermsOfService)
+
+ def update_terms_of_service_by_id(
+ self,
+ terms_of_service_id: str,
+ status: UpdateTermsOfServiceByIdStatus,
+ text: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TermsOfService:
+ """
+ Updates a specific terms of service.
+ :param terms_of_service_id: The ID of the terms of service.
+ Example: "324234"
+ :type terms_of_service_id: str
+ :param status: Whether this terms of service is active.
+ :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
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'status': status, 'text': text}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/terms_of_services/',
+ to_string(terms_of_service_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TermsOfService)
diff --git a/box_sdk_gen/managers/transfer.py b/box_sdk_gen/managers/transfer.py
new file mode 100644
index 000000000..866934f48
--- /dev/null
+++ b/box_sdk_gen/managers/transfer.py
@@ -0,0 +1,193 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.folder_full import FolderFull
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class TransferOwnedFolderOwnedBy(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of the user who the folder will be
+ transferred to.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class TransferManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def transfer_owned_folder(
+ self,
+ user_id: str,
+ owned_by: TransferOwnedFolderOwnedBy,
+ *,
+ fields: Optional[List[str]] = None,
+ notify: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> FolderFull:
+ """
+ Move all of the items (files, folders and workflows) owned by a user into
+
+ another user's account
+
+
+ Only the root folder (`0`) can be transferred.
+
+
+ Folders can only be moved across users by users with administrative
+
+
+ permissions.
+
+
+ All existing shared links and folder-level collaborations are transferred
+
+
+ during the operation. Please note that while collaborations at the individual
+
+
+ file-level are transferred during the operation, the collaborations are
+
+
+ deleted when the original user is deleted.
+
+
+ If the user has a large number of items across all folders, the call will
+
+
+ be run asynchronously. If the operation is not completed within 10 minutes,
+
+
+ the user will receive a 200 OK response, and the operation will continue running.
+
+
+ If the destination path has a metadata cascade policy attached to any of
+
+
+ the parent folders, a metadata cascade operation will be kicked off
+
+
+ asynchronously.
+
+
+ There is currently no way to check for when this operation is finished.
+
+
+ The destination folder's name will be in the format `{User}'s Files and
+
+
+ Folders`, where `{User}` is the display name of the user.
+
+
+ To make this API call your application will need to have the "Read and write
+
+
+ all files and folders stored in Box" scope enabled.
+
+
+ Please make sure the destination user has access to `Relay` or `Relay Lite`,
+
+
+ and has access to the files and folders involved in the workflows being
+
+
+ transferred.
+
+
+ Admins will receive an email when the operation is completed.
+
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param owned_by: The user who the folder will be transferred to.
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param notify: Determines if users should receive email notification
+ for the action performed., defaults to None
+ :type notify: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'owned_by': owned_by}
+ query_params_map: Dict[str, str] = prepare_params(
+ {'fields': to_string(fields), 'notify': to_string(notify)}
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ '/folders/0',
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, FolderFull)
diff --git a/box_sdk_gen/managers/trashed_files.py b/box_sdk_gen/managers/trashed_files.py
new file mode 100644
index 000000000..340d93b32
--- /dev/null
+++ b/box_sdk_gen/managers/trashed_files.py
@@ -0,0 +1,252 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.trash_file_restored import TrashFileRestored
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.trash_file import TrashFile
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class RestoreFileFromTrashParent(BaseObject):
+ def __init__(self, *, id: Optional[str] = None, **kwargs):
+ """
+ :param id: The ID of parent item., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class TrashedFilesManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def restore_file_from_trash(
+ self,
+ file_id: str,
+ *,
+ name: Optional[str] = None,
+ parent: Optional[RestoreFileFromTrashParent] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TrashFileRestored:
+ """
+ Restores a file that has been moved to the trash.
+
+ An optional new parent ID can be provided to restore the file to in case the
+
+
+ original folder has been deleted.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param name: An optional new name for the file., defaults to None
+ :type name: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'name': name, 'parent': parent}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ ]
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TrashFileRestored)
+
+ def get_trashed_file_by_id(
+ self,
+ file_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TrashFile:
+ """
+ Retrieves a file that has been moved to the trash.
+
+ Please note that only if the file itself has been moved to the
+
+
+ trash can it be retrieved with this API call. If instead one of
+
+
+ its parent folders was moved to the trash, only that folder
+
+
+ can be inspected using the
+
+
+ [`GET /folders/:id/trash`](e://get_folders_id_trash) API.
+
+
+ To list all items that have been moved to the trash, please
+
+
+ use the [`GET /folders/trash/items`](e://get-folders-trash-items/)
+
+
+ API.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/trash',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TrashFile)
+
+ def delete_trashed_file_by_id(
+ self, file_id: str, *, extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Permanently deletes a file that is in the trash.
+
+ This action cannot be undone.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/trash',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/trashed_folders.py b/box_sdk_gen/managers/trashed_folders.py
new file mode 100644
index 000000000..b41e66dd1
--- /dev/null
+++ b/box_sdk_gen/managers/trashed_folders.py
@@ -0,0 +1,279 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.trash_folder_restored import TrashFolderRestored
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.trash_folder import TrashFolder
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class RestoreFolderFromTrashParent(BaseObject):
+ def __init__(self, *, id: Optional[str] = None, **kwargs):
+ """
+ :param id: The ID of parent item., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class TrashedFoldersManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def restore_folder_from_trash(
+ self,
+ folder_id: str,
+ *,
+ name: Optional[str] = None,
+ parent: Optional[RestoreFolderFromTrashParent] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TrashFolderRestored:
+ """
+ Restores a folder that has been moved to the trash.
+
+ An optional new parent ID can be provided to restore the folder to in case the
+
+
+ original folder has been deleted.
+
+
+ During this operation, part of the file tree will be locked, mainly
+
+
+ the source folder and all of its descendants, as well as the destination
+
+
+ folder.
+
+
+ For the duration of the operation, no other move, copy, delete, or restore
+
+
+ operation can performed on any of the locked folders.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param name: An optional new name for the folder., defaults to None
+ :type name: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'name': name, 'parent': parent}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ ]
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TrashFolderRestored)
+
+ def get_trashed_folder_by_id(
+ self,
+ folder_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TrashFolder:
+ """
+ Retrieves a folder that has been moved to the trash.
+
+ Please note that only if the folder itself has been moved to the
+
+
+ trash can it be retrieved with this API call. If instead one of
+
+
+ its parent folders was moved to the trash, only that folder
+
+
+ can be inspected using the
+
+
+ [`GET /folders/:id/trash`](e://get_folders_id_trash) API.
+
+
+ To list all items that have been moved to the trash, please
+
+
+ use the [`GET /folders/trash/items`](e://get-folders-trash-items/)
+
+
+ API.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/trash',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TrashFolder)
+
+ def delete_trashed_folder_by_id(
+ self,
+ folder_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Permanently deletes a folder that is in the trash.
+
+ This action cannot be undone.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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"
+ :type folder_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/',
+ to_string(folder_id),
+ '/trash',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/trashed_items.py b/box_sdk_gen/managers/trashed_items.py
new file mode 100644
index 000000000..242cd2ed3
--- /dev/null
+++ b/box_sdk_gen/managers/trashed_items.py
@@ -0,0 +1,171 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.items import Items
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetTrashedItemsDirection(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class GetTrashedItemsSort(str, Enum):
+ NAME = 'name'
+ DATE = 'date'
+ SIZE = 'size'
+
+
+class TrashedItemsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_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[GetTrashedItemsDirection] = None,
+ sort: Optional[GetTrashedItemsSort] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Items:
+ """
+ Retrieves the files and folders that have been moved
+
+ to the trash.
+
+
+ Any attribute in the full files or folders objects can be passed
+
+
+ in with the `fields` parameter to retrieve those specific
+
+
+ attributes that are not returned by default.
+
+
+ This endpoint defaults to use offset-based pagination, yet also supports
+
+
+ marker-based pagination using the `marker` parameter.
+
+ :param fields: A comma-separated list of attributes to include in the
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param usemarker: 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., defaults to None
+ :type usemarker: Optional[bool], optional
+ :param marker: 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`., defaults to None
+ :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., defaults to None
+ :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., defaults to None
+ :type sort: Optional[GetTrashedItemsSort], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'fields': to_string(fields),
+ 'limit': to_string(limit),
+ 'offset': to_string(offset),
+ 'usemarker': to_string(usemarker),
+ 'marker': to_string(marker),
+ 'direction': to_string(direction),
+ 'sort': to_string(sort),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/folders/trash/items',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Items)
diff --git a/box_sdk_gen/managers/trashed_web_links.py b/box_sdk_gen/managers/trashed_web_links.py
new file mode 100644
index 000000000..de1cbe168
--- /dev/null
+++ b/box_sdk_gen/managers/trashed_web_links.py
@@ -0,0 +1,213 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.trash_web_link_restored import TrashWebLinkRestored
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.trash_web_link import TrashWebLink
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class RestoreWeblinkFromTrashParent(BaseObject):
+ def __init__(self, *, id: Optional[str] = None, **kwargs):
+ """
+ :param id: The ID of parent item., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class TrashedWebLinksManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def restore_weblink_from_trash(
+ self,
+ web_link_id: str,
+ *,
+ name: Optional[str] = None,
+ parent: Optional[RestoreWeblinkFromTrashParent] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TrashWebLinkRestored:
+ """
+ Restores a web link that has been moved to the trash.
+
+ An optional new parent ID can be provided to restore the web link to in case
+
+
+ the original folder has been deleted.
+
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :param name: An optional new name for the web link., defaults to None
+ :type name: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'name': name, 'parent': parent}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ ]
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TrashWebLinkRestored)
+
+ def get_trashed_web_link_by_id(
+ self,
+ web_link_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> TrashWebLink:
+ """
+ Retrieves a web link that has been moved to the trash.
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ '/trash',
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, TrashWebLink)
+
+ def delete_trashed_web_link_by_id(
+ self,
+ web_link_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Permanently deletes a web link that is in the trash.
+
+ This action cannot be undone.
+
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ '/trash',
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/uploads.py b/box_sdk_gen/managers/uploads.py
new file mode 100644
index 000000000..1bdb269a6
--- /dev/null
+++ b/box_sdk_gen/managers/uploads.py
@@ -0,0 +1,546 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.files import Files
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.upload_url import UploadUrl
+
+from box_sdk_gen.schemas.conflict_error import ConflictError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.networking.fetch_options import MultipartItem
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class UploadFileVersionAttributes(BaseObject):
+ def __init__(
+ self, name: str, *, content_modified_at: Optional[DateTime] = None, **kwargs
+ ):
+ """
+ :param name: An optional new name for the file. If specified, the file
+ will be renamed when the new version is uploaded.
+ :type name: str
+ :param content_modified_at: Defines the time the file was last modified at.
+
+ If not set, the upload time will be used., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.content_modified_at = content_modified_at
+
+
+class PreflightFileUploadCheckParent(BaseObject):
+ def __init__(self, *, id: Optional[str] = None, **kwargs):
+ """
+ :param id: The ID of parent item., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class UploadFileAttributesParentField(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The id of the parent folder. Use
+ `0` for the user's root folder.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class UploadFileAttributes(BaseObject):
+ def __init__(
+ self,
+ name: str,
+ parent: UploadFileAttributesParentField,
+ *,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param name: The name of the file.
+
+ File names must be unique within their parent folder. The name check is case-insensitive, so a file
+ named `New File` cannot be created in a parent folder that already contains a folder named `new file`.
+ :type name: str
+ :param parent: The parent folder to upload the file to.
+ :type parent: UploadFileAttributesParentField
+ :param content_created_at: Defines the time the file was originally created at.
+
+ If not set, the upload time will be used., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: Defines the time the file was last modified at.
+
+ If not set, the upload time will be used., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.parent = parent
+ self.content_created_at = content_created_at
+ self.content_modified_at = content_modified_at
+
+
+class UploadWithPreflightCheckAttributesParentField(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The id of the parent folder. Use
+ `0` for the user's root folder.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class UploadWithPreflightCheckAttributes(BaseObject):
+ def __init__(
+ self,
+ name: str,
+ parent: UploadWithPreflightCheckAttributesParentField,
+ size: int,
+ *,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param name: The name of the file.
+
+ File names must be unique within their parent folder. The name check is case-insensitive, so a file
+ named `New File` cannot be created in a parent folder that already contains a folder named `new file`.
+ :type name: str
+ :param parent: The parent folder to upload the file to.
+ :type parent: UploadWithPreflightCheckAttributesParentField
+ :param size: The size of the file in bytes
+ :type size: int
+ :param content_created_at: Defines the time the file was originally created at.
+
+ If not set, the upload time will be used., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: Defines the time the file was last modified at.
+
+ If not set, the upload time will be used., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.parent = parent
+ self.size = size
+ self.content_created_at = content_created_at
+ self.content_modified_at = content_modified_at
+
+
+class UploadsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def upload_file_version(
+ self,
+ file_id: str,
+ attributes: UploadFileVersionAttributes,
+ file: ByteStream,
+ *,
+ file_file_name: Optional[str] = None,
+ file_content_type: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ if_match: Optional[str] = None,
+ content_md_5: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Files:
+ """
+ Update a file's content. For file sizes over 50MB we recommend
+
+ using the Chunk Upload APIs.
+
+
+ The `attributes` part of the body must come **before** the
+
+
+ `file` part. Requests that do not follow this format when
+
+
+ uploading the file will receive a HTTP `400` error with a
+
+
+ `metadata_after_file_contents` error code.
+
+ :param file_id: The unique identifier that represents a file.
+
+ 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"
+ :type file_id: str
+ :param attributes: The additional attributes of the file being uploaded. Mainly the
+ name and the parent folder. These attributes are part of the multi
+ part request body and are in JSON format.
+
+
+
+ The `attributes` part of the body must come **before** the
+ `file` part. Requests that do not follow this format when
+ uploading the file will receive a HTTP `400` error with a
+ `metadata_after_file_contents` error code.
+
+
+ :type attributes: UploadFileVersionAttributes
+ :param file: The content of the file to upload to Box.
+
+
+
+ The `attributes` part of the body must come **before** the
+ `file` part. Requests that do not follow this format when
+ uploading the file will receive a HTTP `400` error with a
+ `metadata_after_file_contents` error code.
+
+
+ :type file: ByteStream
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param if_match: Ensures this item hasn't recently changed before
+ making changes.
+
+ Pass in the item's last observed `etag` value
+ into this header and the endpoint will fail
+ with a `412 Precondition Failed` if it
+ has changed since., defaults to None
+ :type if_match: Optional[str], optional
+ :param content_md_5: An optional header containing the SHA1 hash of the file to
+ ensure that the file was not corrupted in transit., defaults to None
+ :type content_md_5: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'attributes': attributes,
+ 'file': file,
+ 'file_file_name': file_file_name,
+ 'file_content_type': file_content_type,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {
+ 'if-match': to_string(if_match),
+ 'content-md5': to_string(content_md_5),
+ **extra_headers,
+ }
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.upload_url,
+ '/2.0/files/',
+ to_string(file_id),
+ '/content',
+ ]
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ multipart_data=[
+ MultipartItem(part_name='attributes', data=serialize(attributes)),
+ MultipartItem(
+ part_name='file',
+ file_stream=file,
+ file_name=file_file_name,
+ content_type=file_content_type,
+ ),
+ ],
+ content_type='multipart/form-data',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Files)
+
+ def preflight_file_upload_check(
+ self,
+ *,
+ name: Optional[str] = None,
+ size: Optional[int] = None,
+ parent: Optional[PreflightFileUploadCheckParent] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UploadUrl:
+ """
+ Performs a check to verify that a file will be accepted by Box
+
+ before you upload the entire file.
+
+ :param name: The name for the file., defaults to None
+ :type name: Optional[str], optional
+ :param size: The size of the file in bytes., defaults to None
+ :type size: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'name': name, 'size': size, 'parent': parent}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/files/content']
+ ),
+ method='OPTIONS',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UploadUrl)
+
+ def upload_file(
+ self,
+ attributes: UploadFileAttributes,
+ file: ByteStream,
+ *,
+ file_file_name: Optional[str] = None,
+ file_content_type: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ content_md_5: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Files:
+ """
+ Uploads a small file to Box. For file sizes over 50MB we recommend
+
+ using the Chunk Upload APIs.
+
+
+ The `attributes` part of the body must come **before** the
+
+
+ `file` part. Requests that do not follow this format when
+
+
+ uploading the file will receive a HTTP `400` error with a
+
+
+ `metadata_after_file_contents` error code.
+
+ :param attributes: The additional attributes of the file being uploaded. Mainly the
+ name and the parent folder. These attributes are part of the multi
+ part request body and are in JSON format.
+
+
+
+ The `attributes` part of the body must come **before** the
+ `file` part. Requests that do not follow this format when
+ uploading the file will receive a HTTP `400` error with a
+ `metadata_after_file_contents` error code.
+
+
+ :type attributes: UploadFileAttributes
+ :param file: The content of the file to upload to Box.
+
+
+
+ The `attributes` part of the body must come **before** the
+ `file` part. Requests that do not follow this format when
+ uploading the file will receive a HTTP `400` error with a
+ `metadata_after_file_contents` error code.
+
+
+ :type file: ByteStream
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param content_md_5: An optional header containing the SHA1 hash of the file to
+ ensure that the file was not corrupted in transit., defaults to None
+ :type content_md_5: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'attributes': attributes,
+ 'file': file,
+ 'file_file_name': file_file_name,
+ 'file_content_type': file_content_type,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {'content-md5': to_string(content_md_5), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.upload_url, '/2.0/files/content']
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ multipart_data=[
+ MultipartItem(part_name='attributes', data=serialize(attributes)),
+ MultipartItem(
+ part_name='file',
+ file_stream=file,
+ file_name=file_file_name,
+ content_type=file_content_type,
+ ),
+ ],
+ content_type='multipart/form-data',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Files)
+
+ def upload_with_preflight_check(
+ self,
+ attributes: UploadWithPreflightCheckAttributes,
+ file: ByteStream,
+ *,
+ file_file_name: Optional[str] = None,
+ file_content_type: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ content_md_5: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Files:
+ """
+ Upload a file with a preflight check
+ :param file: The content of the file to upload to Box.
+
+
+
+ The `attributes` part of the body must come **before** the
+ `file` part. Requests that do not follow this format when
+ uploading the file will receive a HTTP `400` error with a
+ `metadata_after_file_contents` error code.
+
+
+ :type file: ByteStream
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param content_md_5: An optional header containing the SHA1 hash of the file to
+ ensure that the file was not corrupted in transit., defaults to None
+ :type content_md_5: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'attributes': attributes,
+ 'file': file,
+ 'file_file_name': file_file_name,
+ 'file_content_type': file_content_type,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params(
+ {'content-md5': to_string(content_md_5), **extra_headers}
+ )
+ preflight_upload_url: UploadUrl = self.preflight_file_upload_check(
+ name=attributes.name,
+ size=attributes.size,
+ parent=PreflightFileUploadCheckParent(id=attributes.parent.id),
+ extra_headers=extra_headers,
+ )
+ if (
+ preflight_upload_url.upload_url == None
+ or not 'http' in preflight_upload_url.upload_url
+ ):
+ raise BoxSDKError(message='Unable to get preflight upload URL')
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=preflight_upload_url.upload_url,
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ multipart_data=[
+ MultipartItem(part_name='attributes', data=serialize(attributes)),
+ MultipartItem(
+ part_name='file',
+ file_stream=file,
+ file_name=file_file_name,
+ content_type=file_content_type,
+ ),
+ ],
+ content_type='multipart/form-data',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Files)
diff --git a/box_sdk_gen/managers/user_collaborations.py b/box_sdk_gen/managers/user_collaborations.py
new file mode 100644
index 000000000..2357844ca
--- /dev/null
+++ b/box_sdk_gen/managers/user_collaborations.py
@@ -0,0 +1,444 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.collaboration import Collaboration
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class UpdateCollaborationByIdRole(str, Enum):
+ EDITOR = 'editor'
+ VIEWER = 'viewer'
+ PREVIEWER = 'previewer'
+ UPLOADER = 'uploader'
+ PREVIEWER_UPLOADER = 'previewer uploader'
+ VIEWER_UPLOADER = 'viewer uploader'
+ CO_OWNER = 'co-owner'
+ OWNER = 'owner'
+
+
+class UpdateCollaborationByIdStatus(str, Enum):
+ PENDING = 'pending'
+ ACCEPTED = 'accepted'
+ REJECTED = 'rejected'
+
+
+class CreateCollaborationItemTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class CreateCollaborationItem(BaseObject):
+ _discriminator = 'type', {'file', 'folder'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[CreateCollaborationItemTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of the item that this collaboration will be
+ granted access to., defaults to None
+ :type type: Optional[CreateCollaborationItemTypeField], optional
+ :param id: The ID of the item that will be granted access to., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class CreateCollaborationAccessibleByTypeField(str, Enum):
+ USER = 'user'
+ GROUP = 'group'
+
+
+class CreateCollaborationAccessibleBy(BaseObject):
+ _discriminator = 'type', {'user', 'group'}
+
+ def __init__(
+ self,
+ type: CreateCollaborationAccessibleByTypeField,
+ *,
+ id: Optional[str] = None,
+ login: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of collaborator to invite.
+ :type type: CreateCollaborationAccessibleByTypeField
+ :param id: The ID of the user or group.
+
+ Alternatively, use `login` to specify a user by email
+ address., defaults to None
+ :type id: Optional[str], optional
+ :param login: The email address of the user to grant access to the item.
+
+ Alternatively, use `id` to specify a user by user ID., defaults to None
+ :type login: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.login = login
+
+
+class CreateCollaborationRole(str, Enum):
+ EDITOR = 'editor'
+ VIEWER = 'viewer'
+ PREVIEWER = 'previewer'
+ UPLOADER = 'uploader'
+ PREVIEWER_UPLOADER = 'previewer uploader'
+ VIEWER_UPLOADER = 'viewer uploader'
+ CO_OWNER = 'co-owner'
+
+
+class UserCollaborationsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_collaboration_by_id(
+ self,
+ collaboration_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Collaboration:
+ """
+ Retrieves a single collaboration.
+ :param collaboration_id: The ID of the collaboration.
+ Example: "1234"
+ :type collaboration_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaborations/',
+ to_string(collaboration_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Collaboration)
+
+ def update_collaboration_by_id(
+ self,
+ collaboration_id: str,
+ role: UpdateCollaborationByIdRole,
+ *,
+ status: Optional[UpdateCollaborationByIdStatus] = None,
+ expires_at: Optional[DateTime] = None,
+ can_view_path: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Optional[Collaboration]:
+ """
+ Updates a collaboration.
+
+ Can be used to change the owner of an item, or to
+
+
+ accept collaboration invites.
+
+ :param collaboration_id: The ID of the collaboration.
+ Example: "1234"
+ :type collaboration_id: str
+ :param role: The level of access granted.
+ :type role: UpdateCollaborationByIdRole
+ :param status: Set the status of a `pending` collaboration invitation,
+ effectively accepting, or rejecting the invite., defaults to None
+ :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
+ 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., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ :param can_view_path: Determines if the invited users can see the entire parent path to
+ the associated folder. The user will not gain privileges in any
+ parent folder and therefore can not see content the user is not
+ collaborated on.
+
+ Be aware that this meaningfully increases the time required to load the
+ invitee's **All Files** page. We recommend you limit the number of
+ collaborations with `can_view_path` enabled to 1,000 per user.
+
+ Only owner or co-owners can invite collaborators with a `can_view_path` of
+ `true`.
+
+ `can_view_path` can only be used for folder collaborations., defaults to None
+ :type can_view_path: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'role': role,
+ 'status': status,
+ 'expires_at': expires_at,
+ 'can_view_path': can_view_path,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaborations/',
+ to_string(collaboration_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ if to_string(response.status) == '204':
+ return None
+ return deserialize(response.data, Collaboration)
+
+ def delete_collaboration_by_id(
+ self,
+ collaboration_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a single collaboration.
+ :param collaboration_id: The ID of the collaboration.
+ Example: "1234"
+ :type collaboration_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/collaborations/',
+ to_string(collaboration_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ def create_collaboration(
+ self,
+ item: CreateCollaborationItem,
+ accessible_by: CreateCollaborationAccessibleBy,
+ role: CreateCollaborationRole,
+ *,
+ is_access_only: Optional[bool] = None,
+ can_view_path: Optional[bool] = None,
+ expires_at: Optional[DateTime] = None,
+ fields: Optional[List[str]] = None,
+ notify: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Collaboration:
+ """
+ Adds a collaboration for a single user or a single group to a file
+
+ or folder.
+
+
+ Collaborations can be created using email address, user IDs, or a
+
+
+ group IDs.
+
+
+ If a collaboration is being created with a group, access to
+
+
+ this endpoint is dependent on the group's ability to be invited.
+
+
+ If collaboration is in `pending` status, the following fields
+
+
+ are redacted:
+
+
+ - `login` and `name` are hidden if a collaboration was created
+
+
+ using `user_id`,
+
+
+ - `name` is hidden if a collaboration was created using `login`.
+
+ :param item: The item to attach the comment to.
+ :type item: CreateCollaborationItem
+ :param accessible_by: The user or group to give access to the item.
+ :type accessible_by: CreateCollaborationAccessibleBy
+ :param role: The level of access granted.
+ :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
+ see the the path to the root folder for the
+ shared item., defaults to None
+ :type is_access_only: Optional[bool], optional
+ :param can_view_path: Determines if the invited users can see the entire parent path to
+ the associated folder. The user will not gain privileges in any
+ parent folder and therefore can not see content the user is not
+ collaborated on.
+
+ Be aware that this meaningfully increases the time required to load the
+ invitee's **All Files** page. We recommend you limit the number of
+ collaborations with `can_view_path` enabled to 1,000 per user.
+
+ Only owner or co-owners can invite collaborators with a `can_view_path` of
+ `true`.
+
+ `can_view_path` can only be used for folder collaborations., defaults to None
+ :type can_view_path: Optional[bool], optional
+ :param expires_at: Set the expiration date for the collaboration. At this date, the
+ collaboration will be automatically removed from the item.
+
+ This feature will only work if the **Automatically remove invited
+ collaborators: Allow folder owners to extend the expiry date**
+ setting has been enabled in the **Enterprise Settings**
+ of the **Admin Console**. When the setting is not enabled,
+ collaborations can not have an expiry date and a value for this
+ field will be result in an error., defaults to None
+ :type expires_at: Optional[DateTime], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param notify: Determines if users should receive email notification
+ for the action performed., defaults to None
+ :type notify: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'item': item,
+ 'accessible_by': accessible_by,
+ 'role': role,
+ 'is_access_only': is_access_only,
+ 'can_view_path': can_view_path,
+ 'expires_at': expires_at,
+ }
+ query_params_map: Dict[str, str] = prepare_params(
+ {'fields': to_string(fields), 'notify': to_string(notify)}
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/collaborations']
+ ),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Collaboration)
diff --git a/box_sdk_gen/managers/users.py b/box_sdk_gen/managers/users.py
new file mode 100644
index 000000000..52df23cb1
--- /dev/null
+++ b/box_sdk_gen/managers/users.py
@@ -0,0 +1,701 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.internal.null_value import NullValue
+
+from typing import Union
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.users import Users
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.user_full import UserFull
+
+from box_sdk_gen.schemas.tracking_code import TrackingCode
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class GetUsersUserType(str, Enum):
+ ALL = 'all'
+ MANAGED = 'managed'
+ EXTERNAL = 'external'
+
+
+class CreateUserRole(str, Enum):
+ COADMIN = 'coadmin'
+ USER = 'user'
+
+
+class CreateUserStatus(str, Enum):
+ ACTIVE = 'active'
+ INACTIVE = 'inactive'
+ CANNOT_DELETE_EDIT = 'cannot_delete_edit'
+ CANNOT_DELETE_EDIT_UPLOAD = 'cannot_delete_edit_upload'
+
+
+class UpdateUserByIdRole(str, Enum):
+ COADMIN = 'coadmin'
+ USER = 'user'
+
+
+class UpdateUserByIdStatus(str, Enum):
+ ACTIVE = 'active'
+ INACTIVE = 'inactive'
+ CANNOT_DELETE_EDIT = 'cannot_delete_edit'
+ CANNOT_DELETE_EDIT_UPLOAD = 'cannot_delete_edit_upload'
+
+
+class UpdateUserByIdNotificationEmail(BaseObject):
+ def __init__(self, *, email: Optional[str] = None, **kwargs):
+ """
+ :param email: The email address to send the notifications to., defaults to None
+ :type email: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.email = email
+
+
+class UsersManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_users(
+ self,
+ *,
+ filter_term: Optional[str] = None,
+ user_type: Optional[GetUsersUserType] = None,
+ external_app_user_id: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ offset: Optional[int] = None,
+ limit: Optional[int] = None,
+ usemarker: Optional[bool] = None,
+ marker: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Users:
+ """
+ Returns a list of all users for the Enterprise along with their `user_id`,
+
+ `public_name`, and `login`.
+
+
+ The application and the authenticated user need to
+
+
+ have the permission to look up users in the entire
+
+
+ enterprise.
+
+ :param filter_term: Limits the results to only users who's `name` or
+ `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., defaults to None
+ :type filter_term: Optional[str], optional
+ :param user_type: 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., defaults to None
+ :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
+ `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., defaults to None
+ :type external_app_user_id: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param offset: The offset of the item at which to begin the response.
+
+ Queries with offset parameter value
+ exceeding 10000 will be rejected
+ with a 400 response., defaults to None
+ :type offset: Optional[int], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param usemarker: 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., defaults to None
+ :type usemarker: Optional[bool], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'filter_term': to_string(filter_term),
+ 'user_type': to_string(user_type),
+ 'external_app_user_id': to_string(external_app_user_id),
+ 'fields': to_string(fields),
+ 'offset': to_string(offset),
+ 'limit': to_string(limit),
+ 'usemarker': to_string(usemarker),
+ 'marker': to_string(marker),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/users']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Users)
+
+ def create_user(
+ self,
+ name: str,
+ *,
+ login: Optional[str] = None,
+ is_platform_access_only: Optional[bool] = None,
+ role: Optional[CreateUserRole] = None,
+ language: Optional[str] = None,
+ is_sync_enabled: Optional[bool] = None,
+ job_title: Optional[str] = None,
+ phone: Optional[str] = None,
+ address: Optional[str] = None,
+ space_amount: Optional[int] = None,
+ tracking_codes: Optional[List[TrackingCode]] = None,
+ can_see_managed_users: Optional[bool] = None,
+ timezone: Optional[str] = None,
+ is_external_collab_restricted: Optional[bool] = None,
+ is_exempt_from_device_limits: Optional[bool] = None,
+ is_exempt_from_login_verification: Optional[bool] = None,
+ status: Optional[CreateUserStatus] = None,
+ external_app_user_id: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UserFull:
+ """
+ Creates a new managed user in an enterprise. This endpoint
+
+ is only available to users and applications with the right
+
+
+ admin permissions.
+
+ :param name: The name of the user.
+ :type name: str
+ :param login: The email address the user uses to log in
+
+ Required, unless `is_platform_access_only`
+ is set to `true`., defaults to None
+ :type login: Optional[str], optional
+ :param is_platform_access_only: Specifies that the user is an app user., defaults to None
+ :type is_platform_access_only: Optional[bool], optional
+ :param role: The user’s enterprise role., defaults to None
+ :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., defaults to None
+ :type language: Optional[str], optional
+ :param is_sync_enabled: Whether the user can use Box Sync., defaults to None
+ :type is_sync_enabled: Optional[bool], optional
+ :param job_title: The user’s job title., defaults to None
+ :type job_title: Optional[str], optional
+ :param phone: The user’s phone number., defaults to None
+ :type phone: Optional[str], optional
+ :param address: The user’s address., defaults to None
+ :type address: Optional[str], optional
+ :param space_amount: The user’s total available space in bytes. Set this to `-1` to
+ indicate unlimited storage., defaults to None
+ :type space_amount: Optional[int], optional
+ :param tracking_codes: Tracking codes allow an admin to generate reports from the
+ admin console and assign an attribute to a specific group
+ of users. This setting must be enabled for an enterprise before it
+ can be used., defaults to None
+ :type tracking_codes: Optional[List[TrackingCode]], optional
+ :param can_see_managed_users: Whether the user can see other enterprise users in their
+ contact list., defaults to None
+ :type can_see_managed_users: Optional[bool], optional
+ :param timezone: The user's timezone., defaults to None
+ :type timezone: Optional[str], optional
+ :param is_external_collab_restricted: Whether the user is allowed to collaborate with users outside
+ their enterprise., defaults to None
+ :type is_external_collab_restricted: Optional[bool], optional
+ :param is_exempt_from_device_limits: Whether to exempt the user from enterprise device limits., defaults to None
+ :type is_exempt_from_device_limits: Optional[bool], optional
+ :param is_exempt_from_login_verification: Whether the user must use two-factor authentication., defaults to None
+ :type is_exempt_from_login_verification: Optional[bool], optional
+ :param status: The user's account status., defaults to None
+ :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., defaults to None
+ :type external_app_user_id: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'name': name,
+ 'login': login,
+ 'is_platform_access_only': is_platform_access_only,
+ 'role': role,
+ 'language': language,
+ 'is_sync_enabled': is_sync_enabled,
+ 'job_title': job_title,
+ 'phone': phone,
+ 'address': address,
+ 'space_amount': space_amount,
+ 'tracking_codes': tracking_codes,
+ 'can_see_managed_users': can_see_managed_users,
+ 'timezone': timezone,
+ 'is_external_collab_restricted': is_external_collab_restricted,
+ 'is_exempt_from_device_limits': is_exempt_from_device_limits,
+ 'is_exempt_from_login_verification': is_exempt_from_login_verification,
+ 'status': status,
+ 'external_app_user_id': external_app_user_id,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/users']),
+ method='POST',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UserFull)
+
+ def get_user_me(
+ self,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UserFull:
+ """
+ Retrieves information about the user who is currently authenticated.
+
+ In the case of a client-side authenticated OAuth 2.0 application
+
+
+ this will be the user who authorized the app.
+
+
+ In the case of a JWT, server-side authenticated application
+
+
+ this will be the service account that belongs to the application
+
+
+ by default.
+
+
+ Use the `As-User` header to change who this API call is made on behalf of.
+
+ :param fields: A comma-separated list of attributes to include in the
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/users/me']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UserFull)
+
+ def get_user_by_id(
+ self,
+ user_id: str,
+ *,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UserFull:
+ """
+ Retrieves information about a user in the enterprise.
+
+ The application and the authenticated user need to
+
+
+ have the permission to look up users in the entire
+
+
+ enterprise.
+
+
+ This endpoint also returns a limited set of information
+
+
+ for external users who are collaborated on content
+
+
+ owned by the enterprise for authenticated users with the
+
+
+ right scopes. In this case, disallowed fields will return
+
+
+ null instead.
+
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ ]
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UserFull)
+
+ def update_user_by_id(
+ self,
+ user_id: str,
+ *,
+ enterprise: Union[Optional[str], NullValue] = None,
+ notify: Optional[bool] = None,
+ name: Optional[str] = None,
+ login: Optional[str] = None,
+ role: Optional[UpdateUserByIdRole] = None,
+ language: Optional[str] = None,
+ is_sync_enabled: Optional[bool] = None,
+ job_title: Optional[str] = None,
+ phone: Optional[str] = None,
+ address: Optional[str] = None,
+ tracking_codes: Optional[List[TrackingCode]] = None,
+ can_see_managed_users: Optional[bool] = None,
+ timezone: Optional[str] = None,
+ is_external_collab_restricted: Optional[bool] = None,
+ is_exempt_from_device_limits: Optional[bool] = None,
+ is_exempt_from_login_verification: Optional[bool] = None,
+ is_password_reset_required: Optional[bool] = None,
+ status: Optional[UpdateUserByIdStatus] = None,
+ space_amount: Optional[int] = None,
+ notification_email: Union[
+ Optional[UpdateUserByIdNotificationEmail], NullValue
+ ] = None,
+ external_app_user_id: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> UserFull:
+ """
+ Updates a managed or app user in an enterprise. This endpoint
+
+ is only available to users and applications with the right
+
+
+ admin permissions.
+
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param enterprise: Set this to `null` to roll the user out of the enterprise
+ and make them a free user., defaults to None
+ :type enterprise: Union[Optional[str], NullValue], optional
+ :param notify: Whether the user should receive an email when they
+ are rolled out of an enterprise., defaults to None
+ :type notify: Optional[bool], optional
+ :param name: The name of the user., defaults to None
+ :type name: Optional[str], optional
+ :param login: 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., defaults to None
+ :type login: Optional[str], optional
+ :param role: The user’s enterprise role., defaults to None
+ :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., defaults to None
+ :type language: Optional[str], optional
+ :param is_sync_enabled: Whether the user can use Box Sync., defaults to None
+ :type is_sync_enabled: Optional[bool], optional
+ :param job_title: The user’s job title., defaults to None
+ :type job_title: Optional[str], optional
+ :param phone: The user’s phone number., defaults to None
+ :type phone: Optional[str], optional
+ :param address: The user’s address., defaults to None
+ :type address: Optional[str], optional
+ :param tracking_codes: Tracking codes allow an admin to generate reports from the
+ admin console and assign an attribute to a specific group
+ of users. This setting must be enabled for an enterprise before it
+ can be used., defaults to None
+ :type tracking_codes: Optional[List[TrackingCode]], optional
+ :param can_see_managed_users: Whether the user can see other enterprise users in their
+ contact list., defaults to None
+ :type can_see_managed_users: Optional[bool], optional
+ :param timezone: The user's timezone., defaults to None
+ :type timezone: Optional[str], optional
+ :param is_external_collab_restricted: Whether the user is allowed to collaborate with users outside
+ their enterprise., defaults to None
+ :type is_external_collab_restricted: Optional[bool], optional
+ :param is_exempt_from_device_limits: Whether to exempt the user from enterprise device limits., defaults to None
+ :type is_exempt_from_device_limits: Optional[bool], optional
+ :param is_exempt_from_login_verification: Whether the user must use two-factor authentication., defaults to None
+ :type is_exempt_from_login_verification: Optional[bool], optional
+ :param is_password_reset_required: Whether the user is required to reset their password., defaults to None
+ :type is_password_reset_required: Optional[bool], optional
+ :param status: The user's account status., defaults to None
+ :type status: Optional[UpdateUserByIdStatus], optional
+ :param space_amount: The user’s total available space in bytes. Set this to `-1` to
+ indicate unlimited storage., defaults to None
+ :type space_amount: Optional[int], optional
+ :param notification_email: An alternate notification email address to which email
+ notifications are sent. When it's confirmed, this will be
+ the email address to which notifications are sent instead of
+ to the primary email address.
+
+ Set this value to `null` to remove the notification email., defaults to None
+ :type notification_email: Union[Optional[UpdateUserByIdNotificationEmail], NullValue], 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.
+
+ Note: In order to update this field, you need to request a token
+ using the application that created the app user., defaults to None
+ :type external_app_user_id: Optional[str], 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.
+
+ 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., defaults to None
+ :type fields: Optional[List[str]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'enterprise': enterprise,
+ 'notify': notify,
+ 'name': name,
+ 'login': login,
+ 'role': role,
+ 'language': language,
+ 'is_sync_enabled': is_sync_enabled,
+ 'job_title': job_title,
+ 'phone': phone,
+ 'address': address,
+ 'tracking_codes': tracking_codes,
+ 'can_see_managed_users': can_see_managed_users,
+ 'timezone': timezone,
+ 'is_external_collab_restricted': is_external_collab_restricted,
+ 'is_exempt_from_device_limits': is_exempt_from_device_limits,
+ 'is_exempt_from_login_verification': is_exempt_from_login_verification,
+ 'is_password_reset_required': is_password_reset_required,
+ 'status': status,
+ 'space_amount': space_amount,
+ 'notification_email': notification_email,
+ 'external_app_user_id': external_app_user_id,
+ }
+ query_params_map: Dict[str, str] = prepare_params({'fields': to_string(fields)})
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ ]
+ ),
+ method='PUT',
+ params=query_params_map,
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, UserFull)
+
+ def delete_user_by_id(
+ self,
+ user_id: str,
+ *,
+ notify: Optional[bool] = None,
+ force: Optional[bool] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a user. By default this will fail if the user
+
+ still owns any content. Move their owned content first
+
+
+ before proceeding, or use the `force` field to delete
+
+
+ the user and their files.
+
+ :param user_id: The ID of the user.
+ Example: "12345"
+ :type user_id: str
+ :param notify: Whether the user will receive email notification of
+ the deletion., defaults to None
+ :type notify: Optional[bool], optional
+ :param force: Whether the user should be deleted even if this user
+ still own files., defaults to None
+ :type force: Optional[bool], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/users/',
+ to_string(user_id),
+ ]
+ ),
+ method='DELETE',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/web_links.py b/box_sdk_gen/managers/web_links.py
new file mode 100644
index 000000000..1ee5165c2
--- /dev/null
+++ b/box_sdk_gen/managers/web_links.py
@@ -0,0 +1,326 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from enum import Enum
+
+from typing import Dict
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class CreateWebLinkParent(BaseObject):
+ def __init__(self, id: str, **kwargs):
+ """
+ :param id: The ID of parent folder.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class UpdateWebLinkByIdParent(BaseObject):
+ def __init__(
+ self, *, id: Optional[str] = None, user_id: Optional[str] = None, **kwargs
+ ):
+ """
+ :param id: The ID of parent item., defaults to None
+ :type id: Optional[str], optional
+ :param user_id: The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided., defaults to None
+ :type user_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.user_id = user_id
+
+
+class UpdateWebLinkByIdSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class UpdateWebLinkByIdSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[UpdateWebLinkByIdSharedLinkAccessField] = None,
+ password: Optional[str] = None,
+ vanity_name: Optional[str] = None,
+ unshared_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param access: The level of access for the shared link. This can be
+ restricted to anyone with the link (`open`), only people
+ within the company (`company`) and only those who
+ have been invited to the folder (`collaborators`).
+
+ If not set, this field defaults to the access level specified
+ by the enterprise admin. To create a shared link with this
+ default setting pass the `shared_link` object with
+ no `access` field, for example `{ "shared_link": {} }`.
+
+ The `company` access level is only available to paid
+ accounts., defaults to None
+ :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
+ long and include a number, upper case letter, or
+ a non-numeric or non-alphabetic character.
+ A password can only be set when `access` is set to `open`., defaults to None
+ :type password: Optional[str], optional
+ :param vanity_name: Defines a custom vanity name to use in the shared link URL,
+ for example `https://app.box.com/v/my-shared-link`.
+
+ Custom URLs should not be used when sharing sensitive content
+ as vanity URLs are a lot easier to guess than regular shared
+ links., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param unshared_at: The timestamp at which this shared link will
+ expire. This field can only be set by
+ users with paid accounts. The value must be greater than the
+ current date and time., defaults to None
+ :type unshared_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.password = password
+ self.vanity_name = vanity_name
+ self.unshared_at = unshared_at
+
+
+class WebLinksManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def create_web_link(
+ self,
+ url: str,
+ parent: CreateWebLinkParent,
+ *,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> WebLink:
+ """
+ Creates a web link object within a folder.
+ :param url: The URL that this web link links to. Must start with
+ `"http://"` or `"https://"`.
+ :type url: str
+ :param parent: The parent folder to create the web link within.
+ :type parent: CreateWebLinkParent
+ :param name: Name of the web link. Defaults to the URL if not set., defaults to None
+ :type name: Optional[str], optional
+ :param description: Description of the web link., defaults to None
+ :type description: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'url': url,
+ 'parent': parent,
+ 'name': name,
+ 'description': description,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/web_links']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, WebLink)
+
+ def get_web_link_by_id(
+ self,
+ web_link_id: str,
+ *,
+ boxapi: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> WebLink:
+ """
+ Retrieve information about a web link.
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :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.
+
+ Use the format `shared_link=[link]` or if a password is required then
+ use `shared_link=[link]&shared_link_password=[password]`.
+
+ This header can be used on the file or folder shared, as well as on any files
+ or folders nested within the item., defaults to None
+ :type boxapi: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params(
+ {'boxapi': to_string(boxapi), **extra_headers}
+ )
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, WebLink)
+
+ def update_web_link_by_id(
+ self,
+ web_link_id: str,
+ *,
+ url: Optional[str] = None,
+ parent: Optional[UpdateWebLinkByIdParent] = None,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ shared_link: Optional[UpdateWebLinkByIdSharedLink] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> WebLink:
+ """
+ Updates a web link object.
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :param url: The new URL that the web link links to. Must start with
+ `"http://"` or `"https://"`., defaults to None
+ :type url: Optional[str], optional
+ :param name: A new name for the web link. Defaults to the URL if not set., defaults to None
+ :type name: Optional[str], optional
+ :param description: A new description of the web link., defaults to None
+ :type description: Optional[str], optional
+ :param shared_link: The settings for the shared link to update., defaults to None
+ :type shared_link: Optional[UpdateWebLinkByIdSharedLink], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'url': url,
+ 'parent': parent,
+ 'name': name,
+ 'description': description,
+ 'shared_link': shared_link,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, WebLink)
+
+ def delete_web_link_by_id(
+ self,
+ web_link_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a web link.
+ :param web_link_id: The ID of the web link.
+ Example: "12345"
+ :type web_link_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/web_links/',
+ to_string(web_link_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/webhooks.py b/box_sdk_gen/managers/webhooks.py
new file mode 100644
index 000000000..accecd298
--- /dev/null
+++ b/box_sdk_gen/managers/webhooks.py
@@ -0,0 +1,491 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from typing import List
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.webhooks import Webhooks
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.webhook import Webhook
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import compute_webhook_signature
+
+from box_sdk_gen.internal.utils import compare_signatures
+
+from box_sdk_gen.internal.utils import date_time_from_string
+
+from box_sdk_gen.internal.utils import get_epoch_time_in_seconds
+
+from box_sdk_gen.internal.utils import date_time_to_epoch_seconds
+
+
+class CreateWebhookTargetTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class CreateWebhookTarget(BaseObject):
+ _discriminator = 'type', {'file', 'folder'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[CreateWebhookTargetTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the item to trigger a webhook., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of item to trigger a webhook., defaults to None
+ :type type: Optional[CreateWebhookTargetTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CreateWebhookTriggers(str, Enum):
+ FILE_UPLOADED = 'FILE.UPLOADED'
+ FILE_PREVIEWED = 'FILE.PREVIEWED'
+ FILE_DOWNLOADED = 'FILE.DOWNLOADED'
+ FILE_TRASHED = 'FILE.TRASHED'
+ FILE_DELETED = 'FILE.DELETED'
+ FILE_RESTORED = 'FILE.RESTORED'
+ FILE_COPIED = 'FILE.COPIED'
+ FILE_MOVED = 'FILE.MOVED'
+ FILE_LOCKED = 'FILE.LOCKED'
+ FILE_UNLOCKED = 'FILE.UNLOCKED'
+ FILE_RENAMED = 'FILE.RENAMED'
+ COMMENT_CREATED = 'COMMENT.CREATED'
+ COMMENT_UPDATED = 'COMMENT.UPDATED'
+ COMMENT_DELETED = 'COMMENT.DELETED'
+ TASK_ASSIGNMENT_CREATED = 'TASK_ASSIGNMENT.CREATED'
+ TASK_ASSIGNMENT_UPDATED = 'TASK_ASSIGNMENT.UPDATED'
+ METADATA_INSTANCE_CREATED = 'METADATA_INSTANCE.CREATED'
+ METADATA_INSTANCE_UPDATED = 'METADATA_INSTANCE.UPDATED'
+ METADATA_INSTANCE_DELETED = 'METADATA_INSTANCE.DELETED'
+ FOLDER_CREATED = 'FOLDER.CREATED'
+ FOLDER_RENAMED = 'FOLDER.RENAMED'
+ FOLDER_DOWNLOADED = 'FOLDER.DOWNLOADED'
+ FOLDER_RESTORED = 'FOLDER.RESTORED'
+ FOLDER_DELETED = 'FOLDER.DELETED'
+ FOLDER_COPIED = 'FOLDER.COPIED'
+ FOLDER_MOVED = 'FOLDER.MOVED'
+ FOLDER_TRASHED = 'FOLDER.TRASHED'
+ WEBHOOK_DELETED = 'WEBHOOK.DELETED'
+ COLLABORATION_CREATED = 'COLLABORATION.CREATED'
+ COLLABORATION_ACCEPTED = 'COLLABORATION.ACCEPTED'
+ COLLABORATION_REJECTED = 'COLLABORATION.REJECTED'
+ COLLABORATION_REMOVED = 'COLLABORATION.REMOVED'
+ COLLABORATION_UPDATED = 'COLLABORATION.UPDATED'
+ SHARED_LINK_DELETED = 'SHARED_LINK.DELETED'
+ SHARED_LINK_CREATED = 'SHARED_LINK.CREATED'
+ SHARED_LINK_UPDATED = 'SHARED_LINK.UPDATED'
+ SIGN_REQUEST_COMPLETED = 'SIGN_REQUEST.COMPLETED'
+ SIGN_REQUEST_DECLINED = 'SIGN_REQUEST.DECLINED'
+ SIGN_REQUEST_EXPIRED = 'SIGN_REQUEST.EXPIRED'
+ SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED'
+
+
+class UpdateWebhookByIdTargetTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class UpdateWebhookByIdTarget(BaseObject):
+ _discriminator = 'type', {'file', 'folder'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[UpdateWebhookByIdTargetTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the item to trigger a webhook., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of item to trigger a webhook., defaults to None
+ :type type: Optional[UpdateWebhookByIdTargetTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class UpdateWebhookByIdTriggers(str, Enum):
+ FILE_UPLOADED = 'FILE.UPLOADED'
+ FILE_PREVIEWED = 'FILE.PREVIEWED'
+ FILE_DOWNLOADED = 'FILE.DOWNLOADED'
+ FILE_TRASHED = 'FILE.TRASHED'
+ FILE_DELETED = 'FILE.DELETED'
+ FILE_RESTORED = 'FILE.RESTORED'
+ FILE_COPIED = 'FILE.COPIED'
+ FILE_MOVED = 'FILE.MOVED'
+ FILE_LOCKED = 'FILE.LOCKED'
+ FILE_UNLOCKED = 'FILE.UNLOCKED'
+ FILE_RENAMED = 'FILE.RENAMED'
+ COMMENT_CREATED = 'COMMENT.CREATED'
+ COMMENT_UPDATED = 'COMMENT.UPDATED'
+ COMMENT_DELETED = 'COMMENT.DELETED'
+ TASK_ASSIGNMENT_CREATED = 'TASK_ASSIGNMENT.CREATED'
+ TASK_ASSIGNMENT_UPDATED = 'TASK_ASSIGNMENT.UPDATED'
+ METADATA_INSTANCE_CREATED = 'METADATA_INSTANCE.CREATED'
+ METADATA_INSTANCE_UPDATED = 'METADATA_INSTANCE.UPDATED'
+ METADATA_INSTANCE_DELETED = 'METADATA_INSTANCE.DELETED'
+ FOLDER_CREATED = 'FOLDER.CREATED'
+ FOLDER_RENAMED = 'FOLDER.RENAMED'
+ FOLDER_DOWNLOADED = 'FOLDER.DOWNLOADED'
+ FOLDER_RESTORED = 'FOLDER.RESTORED'
+ FOLDER_DELETED = 'FOLDER.DELETED'
+ FOLDER_COPIED = 'FOLDER.COPIED'
+ FOLDER_MOVED = 'FOLDER.MOVED'
+ FOLDER_TRASHED = 'FOLDER.TRASHED'
+ WEBHOOK_DELETED = 'WEBHOOK.DELETED'
+ COLLABORATION_CREATED = 'COLLABORATION.CREATED'
+ COLLABORATION_ACCEPTED = 'COLLABORATION.ACCEPTED'
+ COLLABORATION_REJECTED = 'COLLABORATION.REJECTED'
+ COLLABORATION_REMOVED = 'COLLABORATION.REMOVED'
+ COLLABORATION_UPDATED = 'COLLABORATION.UPDATED'
+ SHARED_LINK_DELETED = 'SHARED_LINK.DELETED'
+ SHARED_LINK_CREATED = 'SHARED_LINK.CREATED'
+ SHARED_LINK_UPDATED = 'SHARED_LINK.UPDATED'
+ SIGN_REQUEST_COMPLETED = 'SIGN_REQUEST.COMPLETED'
+ SIGN_REQUEST_DECLINED = 'SIGN_REQUEST.DECLINED'
+ SIGN_REQUEST_EXPIRED = 'SIGN_REQUEST.EXPIRED'
+ SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED'
+
+
+class WebhooksManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_webhooks(
+ self,
+ *,
+ marker: Optional[str] = None,
+ limit: Optional[int] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Webhooks:
+ """
+ Returns all defined webhooks for the requesting application.
+
+ This API only returns webhooks that are applied to files or folders that are
+
+
+ owned by the authenticated user. This means that an admin can not see webhooks
+
+
+ created by a service account unless the admin has access to those folders, and
+
+
+ vice versa.
+
+ :param marker: Defines the position marker at which to begin returning results. This is
+ used when paginating using marker-based pagination.
+
+ This requires `usemarker` to be set to `true`., defaults to None
+ :type marker: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ 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 = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/webhooks']),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Webhooks)
+
+ def create_webhook(
+ self,
+ target: CreateWebhookTarget,
+ address: str,
+ 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: 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[CreateWebhookTriggers]
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'target': target,
+ 'address': address,
+ 'triggers': triggers,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join([self.network_session.base_urls.base_url, '/2.0/webhooks']),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Webhook)
+
+ def get_webhook_by_id(
+ self,
+ webhook_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Webhook:
+ """
+ Retrieves a specific webhook.
+ :param webhook_id: The ID of the webhook.
+ Example: "3321123"
+ :type webhook_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/webhooks/',
+ to_string(webhook_id),
+ ]
+ ),
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Webhook)
+
+ def update_webhook_by_id(
+ self,
+ webhook_id: str,
+ *,
+ target: Optional[UpdateWebhookByIdTarget] = None,
+ address: Optional[str] = None,
+ triggers: Optional[List[UpdateWebhookByIdTriggers]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Webhook:
+ """
+ Updates a webhook.
+ :param webhook_id: The ID of the webhook.
+ Example: "3321123"
+ :type webhook_id: str
+ :param target: The item that will trigger the webhook., defaults to None
+ :type target: Optional[UpdateWebhookByIdTarget], optional
+ :param address: The URL that is notified by this webhook., defaults to None
+ :type address: Optional[str], optional
+ :param triggers: An array of event names that this webhook is
+ to be triggered for., defaults to None
+ :type triggers: Optional[List[UpdateWebhookByIdTriggers]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'target': target,
+ 'address': address,
+ 'triggers': triggers,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/webhooks/',
+ to_string(webhook_id),
+ ]
+ ),
+ method='PUT',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Webhook)
+
+ def delete_webhook_by_id(
+ self,
+ webhook_id: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Deletes a webhook.
+ :param webhook_id: The ID of the webhook.
+ Example: "3321123"
+ :type webhook_id: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/webhooks/',
+ to_string(webhook_id),
+ ]
+ ),
+ method='DELETE',
+ headers=headers_map,
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
+
+ @staticmethod
+ def validate_message(
+ body: str,
+ headers: Dict[str, str],
+ primary_key: str,
+ *,
+ secondary_key: Optional[str] = None,
+ max_age: Optional[int] = 600
+ ) -> bool:
+ """
+ Validate a webhook message by verifying the signature and the delivery timestamp
+ :param body: The request body of the webhook message
+ :type body: str
+ :param headers: The headers of the webhook message
+ :type headers: Dict[str, str]
+ :param primary_key: The primary signature to verify the message with
+ :type primary_key: str
+ :param secondary_key: The secondary signature to verify the message with, defaults to None
+ :type secondary_key: Optional[str], optional
+ :param max_age: The maximum age of the message in seconds, defaults to 10 minutes, defaults to 600
+ :type max_age: Optional[int], optional
+ """
+ delivery_timestamp: DateTime = date_time_from_string(
+ headers.get('box-delivery-timestamp')
+ )
+ current_epoch: int = get_epoch_time_in_seconds()
+ if (
+ current_epoch - max_age > date_time_to_epoch_seconds(delivery_timestamp)
+ or date_time_to_epoch_seconds(delivery_timestamp) > current_epoch
+ ):
+ return False
+ if (
+ not primary_key == None and not headers.get('box-signature-primary') == None
+ ) and compare_signatures(
+ expected_signature=compute_webhook_signature(
+ body, headers, primary_key, escape_body=False
+ ),
+ received_signature=headers.get('box-signature-primary'),
+ ):
+ return True
+ if (
+ not primary_key == None and not headers.get('box-signature-primary') == None
+ ) and compare_signatures(
+ expected_signature=compute_webhook_signature(
+ body, headers, primary_key, escape_body=True
+ ),
+ received_signature=headers.get('box-signature-primary'),
+ ):
+ return True
+ if (
+ not secondary_key == None
+ and not headers.get('box-signature-secondary') == None
+ ) and compare_signatures(
+ expected_signature=compute_webhook_signature(
+ body, headers, secondary_key, escape_body=False
+ ),
+ received_signature=headers.get('box-signature-secondary'),
+ ):
+ return True
+ if (
+ not secondary_key == None
+ and not headers.get('box-signature-secondary') == None
+ ) and compare_signatures(
+ expected_signature=compute_webhook_signature(
+ body, headers, secondary_key, escape_body=True
+ ),
+ received_signature=headers.get('box-signature-secondary'),
+ ):
+ return True
+ return False
diff --git a/box_sdk_gen/managers/workflows.py b/box_sdk_gen/managers/workflows.py
new file mode 100644
index 000000000..7e0881040
--- /dev/null
+++ b/box_sdk_gen/managers/workflows.py
@@ -0,0 +1,261 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.serialization.json import deserialize
+
+from typing import List
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.workflows import Workflows
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.outcome import Outcome
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+from box_sdk_gen.serialization.json import SerializedData
+
+
+class StartWorkflowType(str, Enum):
+ WORKFLOW_PARAMETERS = 'workflow_parameters'
+
+
+class StartWorkflowFlow(BaseObject):
+ def __init__(
+ self, *, type: Optional[str] = None, id: Optional[str] = None, **kwargs
+ ):
+ """
+ :param type: The type of the flow object., defaults to None
+ :type type: Optional[str], optional
+ :param id: The id of the flow., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class StartWorkflowFilesTypeField(str, Enum):
+ FILE = 'file'
+
+
+class StartWorkflowFiles(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[StartWorkflowFilesTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of the file object., defaults to None
+ :type type: Optional[StartWorkflowFilesTypeField], optional
+ :param id: The id of the file., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class StartWorkflowFolderTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class StartWorkflowFolder(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[StartWorkflowFolderTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of the folder object., defaults to None
+ :type type: Optional[StartWorkflowFolderTypeField], optional
+ :param id: The id of the folder., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class WorkflowsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def get_workflows(
+ self,
+ folder_id: str,
+ *,
+ trigger_type: Optional[str] = None,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> Workflows:
+ """
+ Returns list of workflows that act on a given `folder ID`, and
+
+ have a flow with a trigger type of `WORKFLOW_MANUAL_START`.
+
+
+ You application must be authorized to use the `Manage Box Relay` application
+
+
+ scope within the developer console in to use this endpoint.
+
+ :param folder_id: The unique identifier that represent a folder.
+
+ 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`.
+ :type folder_id: str
+ :param trigger_type: Type of trigger to search for., defaults to None
+ :type trigger_type: Optional[str], optional
+ :param limit: The maximum number of items to return per page., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: 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`., defaults to None
+ :type marker: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ query_params_map: Dict[str, str] = prepare_params(
+ {
+ 'folder_id': to_string(folder_id),
+ 'trigger_type': to_string(trigger_type),
+ 'limit': to_string(limit),
+ 'marker': to_string(marker),
+ }
+ )
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/workflows']
+ ),
+ method='GET',
+ params=query_params_map,
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, Workflows)
+
+ def start_workflow(
+ self,
+ workflow_id: str,
+ flow: StartWorkflowFlow,
+ files: List[StartWorkflowFiles],
+ folder: StartWorkflowFolder,
+ *,
+ type: Optional[StartWorkflowType] = None,
+ outcomes: Optional[List[Outcome]] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> None:
+ """
+ Initiates a flow with a trigger type of `WORKFLOW_MANUAL_START`.
+
+ You application must be authorized to use the `Manage Box Relay` application
+
+
+ scope within the developer console.
+
+ :param workflow_id: The ID of the workflow.
+ Example: "12345"
+ :type workflow_id: str
+ :param flow: The flow that will be triggered.
+ :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[StartWorkflowFiles]
+ :param folder: The folder object for which the workflow is configured.
+ :type folder: StartWorkflowFolder
+ :param type: The type of the parameters object., defaults to None
+ :type type: Optional[StartWorkflowType], optional
+ :param outcomes: A configurable outcome the workflow should complete., defaults to None
+ :type outcomes: Optional[List[Outcome]], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {
+ 'type': type,
+ 'flow': flow,
+ 'files': files,
+ 'folder': folder,
+ 'outcomes': outcomes,
+ }
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [
+ self.network_session.base_urls.base_url,
+ '/2.0/workflows/',
+ to_string(workflow_id),
+ '/start',
+ ]
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.NO_CONTENT,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return None
diff --git a/box_sdk_gen/managers/zip_downloads.py b/box_sdk_gen/managers/zip_downloads.py
new file mode 100644
index 000000000..7813cbdc2
--- /dev/null
+++ b/box_sdk_gen/managers/zip_downloads.py
@@ -0,0 +1,318 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.serialization.json import serialize
+
+from box_sdk_gen.serialization.json import deserialize
+
+from box_sdk_gen.networking.fetch_options import ResponseFormat
+
+from box_sdk_gen.schemas.zip_download import ZipDownload
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.zip_download_request import ZipDownloadRequest
+
+from box_sdk_gen.schemas.zip_download_status import ZipDownloadStatus
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.networking.auth import Authentication
+
+from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import prepare_params
+
+from box_sdk_gen.internal.utils import to_string
+
+from box_sdk_gen.internal.utils import ByteStream
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.serialization.json import sd_to_json
+
+
+class CreateZipDownloadItemsTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class CreateZipDownloadItems(BaseObject):
+ _discriminator = 'type', {'file', 'folder'}
+
+ def __init__(self, type: CreateZipDownloadItemsTypeField, id: str, **kwargs):
+ """
+ :param type: The type of the item to add to the archive.
+ :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
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class DownloadZipItemsTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class DownloadZipItems(BaseObject):
+ _discriminator = 'type', {'file', 'folder'}
+
+ def __init__(self, type: DownloadZipItemsTypeField, id: str, **kwargs):
+ """
+ :param type: The type of the item to add to the archive.
+ :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
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class ZipDownloadsManager:
+ def __init__(
+ self,
+ *,
+ auth: Optional[Authentication] = None,
+ network_session: NetworkSession = None
+ ):
+ if network_session is None:
+ network_session = NetworkSession()
+ self.auth = auth
+ self.network_session = network_session
+
+ def create_zip_download(
+ self,
+ items: List[CreateZipDownloadItems],
+ *,
+ download_file_name: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ZipDownload:
+ """
+ Creates a request to download multiple files and folders as a single `zip`
+
+ archive file. This API does not return the archive but instead performs all
+
+
+ the checks to ensure that the user has access to all the items, and then
+
+
+ returns a `download_url` and a `status_url` that can be used to download the
+
+
+ archive.
+
+
+ The limit for an archive is either the Account's upload limit or
+
+
+ 10,000 files, whichever is met first.
+
+
+ **Note**: Downloading a large file can be
+
+
+ affected by various
+
+
+ factors such as distance, network latency,
+
+
+ bandwidth, and congestion, as well as packet loss
+
+
+ ratio and current server load.
+
+
+ For these reasons we recommend that a maximum ZIP archive
+
+
+ total size does not exceed 25GB.
+
+ :param items: A list of items to add to the `zip` archive. These can
+ be folders or files.
+ :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`., defaults to None
+ :type download_file_name: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'items': items, 'download_file_name': download_file_name}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=''.join(
+ [self.network_session.base_urls.base_url, '/2.0/zip_downloads']
+ ),
+ method='POST',
+ headers=headers_map,
+ data=serialize(request_body),
+ content_type='application/json',
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ZipDownload)
+
+ def get_zip_download_content(
+ self,
+ download_url: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ByteStream:
+ """
+ Returns the contents of a `zip` archive in binary format. This URL does not
+
+ require any form of authentication and could be used in a user's browser to
+
+
+ download the archive to a user's device.
+
+
+ By default, this URL is only valid for a few seconds from the creation of
+
+
+ the request for this archive. Once a download has started it can not be
+
+
+ stopped and resumed, instead a new request for a zip archive would need to
+
+
+ be created.
+
+
+ The URL of this endpoint should not be considered as fixed. Instead, use
+
+
+ the [Create zip download](e://post_zip_downloads) API to request to create a
+
+
+ `zip` archive, and then follow the `download_url` field in the response to
+
+
+ this endpoint.
+
+ :param download_url: The URL that can be used to download created `zip` archive.
+ Example: `https://dl.boxcloud.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/content`
+ :type download_url: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=download_url,
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.BINARY,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return response.content
+
+ def get_zip_download_status(
+ self,
+ status_url: str,
+ *,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ZipDownloadStatus:
+ """
+ Returns the download status of a `zip` archive, allowing an application to
+
+ inspect the progress of the download as well as the number of items that
+
+
+ might have been skipped.
+
+
+ This endpoint can only be accessed once the download has started.
+
+
+ Subsequently this endpoint is valid for 12 hours from the start of the
+
+
+ download.
+
+
+ The URL of this endpoint should not be considered as fixed. Instead, use
+
+
+ the [Create zip download](e://post_zip_downloads) API to request to create a
+
+
+ `zip` archive, and then follow the `status_url` field in the response to
+
+
+ this endpoint.
+
+ :param status_url: The URL that can be used to get the status of the `zip` archive being downloaded.
+ Example: `https://dl.boxcloud.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/status`
+ :type status_url: str
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ headers_map: Dict[str, str] = prepare_params({**extra_headers})
+ response: FetchResponse = self.network_session.network_client.fetch(
+ FetchOptions(
+ url=status_url,
+ method='GET',
+ headers=headers_map,
+ response_format=ResponseFormat.JSON,
+ auth=self.auth,
+ network_session=self.network_session,
+ )
+ )
+ return deserialize(response.data, ZipDownloadStatus)
+
+ def download_zip(
+ self,
+ items: List[DownloadZipItems],
+ *,
+ download_file_name: Optional[str] = None,
+ extra_headers: Optional[Dict[str, Optional[str]]] = None
+ ) -> ByteStream:
+ """
+ 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[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`., defaults to None
+ :type download_file_name: Optional[str], optional
+ :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
+ :type extra_headers: Optional[Dict[str, Optional[str]]], optional
+ """
+ if extra_headers is None:
+ extra_headers = {}
+ request_body: Dict = {'items': items, 'download_file_name': download_file_name}
+ zip_download_session: ZipDownload = self.create_zip_download(
+ items, download_file_name=download_file_name, extra_headers=extra_headers
+ )
+ return self.get_zip_download_content(
+ zip_download_session.download_url, extra_headers=extra_headers
+ )
diff --git a/box_sdk_gen/networking/__init__.py b/box_sdk_gen/networking/__init__.py
new file mode 100644
index 000000000..c12260c17
--- /dev/null
+++ b/box_sdk_gen/networking/__init__.py
@@ -0,0 +1,19 @@
+from box_sdk_gen.networking.box_network_client import *
+
+from box_sdk_gen.networking.proxy_config import *
+
+from box_sdk_gen.networking.network import *
+
+from box_sdk_gen.networking.auth import *
+
+from box_sdk_gen.networking.fetch_options import *
+
+from box_sdk_gen.networking.fetch_response import *
+
+from box_sdk_gen.networking.network_client import *
+
+from box_sdk_gen.networking.retries import *
+
+from box_sdk_gen.networking.base_urls import *
+
+from box_sdk_gen.networking.version import *
diff --git a/box_sdk_gen/networking/auth.py b/box_sdk_gen/networking/auth.py
new file mode 100644
index 000000000..61347ff3c
--- /dev/null
+++ b/box_sdk_gen/networking/auth.py
@@ -0,0 +1,47 @@
+from typing import Optional
+
+from abc import abstractmethod
+
+from typing import List
+
+from box_sdk_gen.schemas.access_token import AccessToken
+
+from box_sdk_gen.networking.network import NetworkSession
+
+
+class Authentication:
+ def __init__(self):
+ pass
+
+ @abstractmethod
+ def retrieve_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ pass
+
+ @abstractmethod
+ def refresh_token(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ pass
+
+ @abstractmethod
+ def retrieve_authorization_header(
+ self, *, network_session: Optional[NetworkSession] = None
+ ) -> str:
+ pass
+
+ @abstractmethod
+ def revoke_token(self, *, network_session: Optional[NetworkSession] = None) -> None:
+ pass
+
+ @abstractmethod
+ def downscope_token(
+ self,
+ scopes: List[str],
+ *,
+ resource: Optional[str] = None,
+ shared_link: Optional[str] = None,
+ network_session: Optional[NetworkSession] = None
+ ) -> AccessToken:
+ pass
diff --git a/box_sdk_gen/networking/base_urls.py b/box_sdk_gen/networking/base_urls.py
new file mode 100644
index 000000000..6b59444f7
--- /dev/null
+++ b/box_sdk_gen/networking/base_urls.py
@@ -0,0 +1,29 @@
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+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',
+ upload_url: str = 'https://upload.box.com/api',
+ 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/networking/box_network_client.py b/box_sdk_gen/networking/box_network_client.py
new file mode 100644
index 000000000..7a4f44647
--- /dev/null
+++ b/box_sdk_gen/networking/box_network_client.py
@@ -0,0 +1,363 @@
+import io
+
+import time
+from collections import OrderedDict
+from dataclasses import dataclass
+from typing import Optional, Dict, Union
+from sys import version_info as py_version
+
+import requests
+from requests import RequestException, Session, Response
+from requests_toolbelt import MultipartEncoder
+
+from ..internal.logging import DataSanitizer
+from .retries import BoxRetryStrategy
+from ..networking.fetch_options import FetchOptions
+from ..networking.fetch_response import FetchResponse
+from ..box.errors import BoxAPIError, BoxSDKError, RequestInfo, ResponseInfo
+from ..internal.utils import ByteStream, ResponseByteStream
+from ..networking.network_client import NetworkClient
+from ..serialization.json import (
+ sd_to_json,
+ sd_to_url_params,
+ json_to_serialized_data,
+)
+from ..networking.version import __version__
+
+SDK_VERSION = __version__
+USER_AGENT_HEADER = f'box-python-generated-sdk-{SDK_VERSION}'
+X_BOX_UA_HEADER = (
+ f'agent=box-python-generated-sdk/{SDK_VERSION}; '
+ f'env=python/{py_version.major}.{py_version.minor}.{py_version.micro}'
+)
+
+
+@dataclass
+class APIRequest:
+ method: str
+ url: str
+ headers: Dict[str, str]
+ params: Dict[str, str]
+ data: Optional[Union[str, ByteStream, MultipartEncoder]]
+ allow_redirects: bool = True
+
+
+@dataclass
+class APIResponse:
+ network_response: Optional[Response] = None
+ reauthentication_needed: Optional[bool] = False
+ raised_exception: Optional[Exception] = None
+
+ def get_header(
+ self, header_name: str, default_value: Optional[str] = None
+ ) -> Optional[str]:
+ try:
+ return self.network_response.headers[header_name]
+ except (ValueError, KeyError, AttributeError):
+ return default_value
+
+
+class BoxNetworkClient(NetworkClient):
+ def __init__(self, requests_session: Optional[Session] = None):
+ super().__init__()
+ self.requests_session = requests_session or requests.Session()
+
+ def fetch(self, options: 'FetchOptions') -> FetchResponse:
+ retry_strategy = (
+ options.network_session.retry_strategy
+ if options.network_session
+ else BoxRetryStrategy()
+ )
+ data_sanitizer = (
+ options.network_session.data_sanitizer
+ if options.network_session
+ else DataSanitizer()
+ )
+
+ attempt_nr = 1
+ number_of_retries_on_exception = 0
+ response = APIResponse()
+
+ options_stream_position = self._get_options_stream_position(options)
+ multipart_streams_positions = self._get_multipart_stream_positions(options)
+
+ while True:
+ request: APIRequest = self._prepare_request(
+ options=options, reauthenticate=response.reauthentication_needed
+ )
+ response: APIResponse = self._make_request(request=request)
+ if response.network_response is not None:
+ attempt_for_retry = attempt_nr
+ network_response = response.network_response
+
+ if options.response_format == 'binary':
+ fetch_response = FetchResponse(
+ url=network_response.url,
+ status=network_response.status_code,
+ headers=dict(response.network_response.headers),
+ content=ResponseByteStream(
+ response.network_response.iter_content(chunk_size=1024)
+ ),
+ )
+ else:
+ fetch_response = FetchResponse(
+ url=network_response.url,
+ status=network_response.status_code,
+ headers=dict(response.network_response.headers),
+ data=(self._read_json_body(network_response.text)),
+ content=io.BytesIO(network_response.content),
+ )
+ else:
+ number_of_retries_on_exception += 1
+ attempt_for_retry = number_of_retries_on_exception
+ fetch_response = FetchResponse(status=0, headers={})
+
+ attempt_nr += 1
+ should_retry = retry_strategy.should_retry(
+ fetch_options=options,
+ fetch_response=fetch_response,
+ attempt_number=attempt_for_retry,
+ )
+
+ if should_retry:
+ self._reset_options_stream(
+ options, options_stream_position, response.raised_exception
+ )
+ self._reset_multipart_streams(
+ options, multipart_streams_positions, response.raised_exception
+ )
+ time.sleep(
+ retry_strategy.retry_after(
+ fetch_options=options,
+ fetch_response=fetch_response,
+ attempt_number=attempt_for_retry,
+ )
+ )
+ continue
+
+ if 200 <= fetch_response.status < 400:
+ return fetch_response
+ break
+ self._raise_on_unsuccessful_request(
+ request=request, response=response, data_sanitizer=data_sanitizer
+ )
+
+ def _prepare_request(
+ self, options: 'FetchOptions', reauthenticate: bool = False
+ ) -> APIRequest:
+ headers = self._prepare_headers(options, reauthenticate)
+ params = options.params or {}
+ data = self._prepare_body(
+ options.content_type, options.file_stream or options.data
+ )
+ allow_redirects = options.follow_redirects
+
+ if options.content_type:
+ if options.content_type == 'multipart/form-data':
+ fields = OrderedDict()
+ for part in options.multipart_data:
+ if part.data:
+ fields[part.part_name] = sd_to_json(part.data)
+ else:
+ fields[part.part_name] = (
+ part.file_name or '',
+ part.file_stream,
+ part.content_type,
+ )
+
+ multipart_stream = MultipartEncoder(fields)
+ data = multipart_stream
+ headers['Content-Type'] = multipart_stream.content_type
+ else:
+ headers['Content-Type'] = options.content_type
+
+ return APIRequest(
+ method=options.method,
+ url=options.url,
+ headers=headers,
+ params=params,
+ data=data,
+ allow_redirects=allow_redirects,
+ )
+
+ @staticmethod
+ def _prepare_headers(
+ options: 'FetchOptions', reauthenticate: bool = False
+ ) -> Dict[str, str]:
+ headers = {}
+ if options.network_session:
+ headers.update(options.network_session.additional_headers)
+ if options.headers:
+ headers.update(options.headers)
+ if options.auth:
+ if reauthenticate:
+ options.auth.refresh_token(network_session=options.network_session)
+ headers['Authorization'] = options.auth.retrieve_authorization_header(
+ network_session=options.network_session
+ )
+
+ headers['User-Agent'] = USER_AGENT_HEADER
+ headers['X-Box-UA'] = X_BOX_UA_HEADER
+ return headers
+
+ @staticmethod
+ def _prepare_body(
+ content_type: str, data: Union[dict, ByteStream]
+ ) -> Optional[Union[str, ByteStream]]:
+ if (
+ content_type == 'application/json'
+ or content_type == 'application/json-patch+json'
+ ):
+ return sd_to_json(data) if data else None
+ if content_type == 'application/x-www-form-urlencoded':
+ return sd_to_url_params(data)
+ if (
+ content_type == 'multipart/form-data'
+ or content_type == 'application/octet-stream'
+ ):
+ return data
+ raise
+
+ def _make_request(self, request: APIRequest) -> APIResponse:
+ raised_exception = None
+ reauthentication_needed = False
+ default_timeout = (5, 60) # connect, read timeout
+ try:
+ network_response = self.requests_session.request(
+ method=request.method,
+ url=request.url,
+ headers=request.headers,
+ data=request.data,
+ params=request.params,
+ allow_redirects=request.allow_redirects,
+ stream=True,
+ timeout=default_timeout,
+ )
+ except RequestException as request_exc:
+ raised_exception = request_exc
+ network_response = None
+
+ if 'EOF occurred in violation of protocol' in str(request_exc):
+ reauthentication_needed = True
+
+ return APIResponse(
+ network_response=network_response,
+ reauthentication_needed=reauthentication_needed,
+ raised_exception=raised_exception,
+ )
+
+ @staticmethod
+ def _raise_on_unsuccessful_request(
+ request: APIRequest, response: APIResponse, data_sanitizer: DataSanitizer
+ ) -> None:
+ if response.raised_exception:
+ raise BoxSDKError(
+ message=str(response.raised_exception), error=response.raised_exception
+ )
+
+ network_response = response.network_response
+ response_json = BoxNetworkClient._read_json_body(network_response.text)
+
+ raise BoxAPIError(
+ message=f'{network_response.status_code} {response_json.get("message", "")}; Request ID: {response_json.get("request_id", "")}',
+ request_info=RequestInfo(
+ method=request.method,
+ url=request.url,
+ query_params=request.params,
+ headers=request.headers,
+ body=request.data,
+ ),
+ response_info=ResponseInfo(
+ status_code=network_response.status_code,
+ headers=dict(network_response.headers),
+ body=response_json,
+ raw_body=network_response.text,
+ code=response_json.get("code", None),
+ context_info=response_json.get("context_info", {}),
+ request_id=response_json.get("request_id", None),
+ help_url=response_json.get("help_url", None),
+ ),
+ data_sanitizer=data_sanitizer,
+ )
+
+ @staticmethod
+ def _get_multipart_stream_positions(options: 'FetchOptions') -> dict:
+ multipart_streams_positions = {}
+ if options.multipart_data:
+ for part in options.multipart_data:
+ if part.file_stream and part.file_stream.seekable():
+ multipart_streams_positions[part.part_name] = (
+ part.file_stream.tell()
+ )
+ return multipart_streams_positions
+
+ @staticmethod
+ def _get_options_stream_position(options: 'FetchOptions') -> int:
+ filestream_position = 0
+ if options.file_stream and options.file_stream.seekable():
+ filestream_position = options.file_stream.tell()
+ return filestream_position
+
+ @staticmethod
+ def _validate_seekable(stream: ByteStream, raised_exception: Optional[Exception]):
+ if not stream.seekable():
+ raise BoxSDKError(
+ message='Request with non-seekable stream cannot be retried',
+ error=raised_exception,
+ )
+
+ @staticmethod
+ def _read_json_body(response_body: str) -> dict:
+ if not response_body:
+ return {}
+ try:
+ return json_to_serialized_data(response_body)
+ except (ValueError, TypeError):
+ return {}
+
+ def _reset_stream(
+ self,
+ stream: ByteStream,
+ original_position: int,
+ raised_exception: Optional[Exception],
+ ):
+ self._validate_seekable(stream, raised_exception)
+ stream.seek(original_position)
+
+ def _reset_options_stream(
+ self,
+ options: 'FetchOptions',
+ filestream_position: int,
+ raised_exception: Optional[Exception],
+ ):
+ if options.file_stream:
+ self._reset_stream(
+ options.file_stream, filestream_position, raised_exception
+ )
+
+ def _reset_multipart_streams(
+ self,
+ options: 'FetchOptions',
+ multipart_streams_positions: dict,
+ raised_exception: Optional[Exception],
+ ):
+ if not options.multipart_data:
+ return
+
+ for part in options.multipart_data:
+ if not part.file_stream:
+ continue
+
+ position = multipart_streams_positions.get(part.part_name)
+ # we didn't get position before sending request hence the stream must be non-seekable
+ if position is None:
+ raise BoxSDKError(
+ message='Request with non-seekable stream cannot be retried',
+ error=raised_exception,
+ )
+
+ self._reset_stream(
+ part.file_stream,
+ multipart_streams_positions[part.part_name],
+ raised_exception,
+ )
diff --git a/box_sdk_gen/networking/fetch_options.py b/box_sdk_gen/networking/fetch_options.py
new file mode 100644
index 000000000..84d85f215
--- /dev/null
+++ b/box_sdk_gen/networking/fetch_options.py
@@ -0,0 +1,113 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from typing import List
+
+if TYPE_CHECKING:
+ from box_sdk_gen.networking.auth import Authentication
+
+if TYPE_CHECKING:
+ from box_sdk_gen.networking.network import NetworkSession
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import ByteStream
+
+
+class ResponseFormat(str, Enum):
+ JSON = 'json'
+ BINARY = 'binary'
+ NO_CONTENT = 'no_content'
+
+
+class MultipartItem:
+ def __init__(
+ self,
+ part_name: str,
+ *,
+ data: Optional[SerializedData] = None,
+ file_stream: Optional[ByteStream] = None,
+ file_name: Optional[str] = None,
+ content_type: Optional[str] = None,
+ ):
+ """
+ :param part_name: Name of the part
+ :type part_name: str
+ :param data: Data of the part, defaults to None
+ :type data: Optional[SerializedData], optional
+ :param file_stream: File stream of the part, defaults to None
+ :type file_stream: Optional[ByteStream], optional
+ :param file_name: File name of the part, defaults to None
+ :type file_name: Optional[str], optional
+ :param content_type: Content type of the part, defaults to None
+ :type content_type: Optional[str], optional
+ """
+ self.part_name = part_name
+ self.data = data
+ self.file_stream = file_stream
+ self.file_name = file_name
+ self.content_type = content_type
+
+
+class FetchOptions:
+ def __init__(
+ self,
+ url: str,
+ method: str,
+ *,
+ params: Optional[Dict[str, str]] = None,
+ headers: Optional[Dict[str, str]] = None,
+ data: Optional[SerializedData] = None,
+ file_stream: Optional[ByteStream] = None,
+ multipart_data: Optional[List[MultipartItem]] = None,
+ content_type: str = 'application/json',
+ response_format: ResponseFormat = ResponseFormat.JSON,
+ auth: Optional[Authentication] = None,
+ network_session: Optional[NetworkSession] = None,
+ follow_redirects: Optional[bool] = True,
+ ):
+ """
+ :param url: URL of the request
+ :type url: str
+ :param method: HTTP verb of the request
+ :type method: str
+ :param params: HTTP query parameters, defaults to None
+ :type params: Optional[Dict[str, str]], optional
+ :param headers: HTTP headers, defaults to None
+ :type headers: Optional[Dict[str, str]], optional
+ :param data: Request body of the request, defaults to None
+ :type data: Optional[SerializedData], optional
+ :param file_stream: Stream data of the request, defaults to None
+ :type file_stream: Optional[ByteStream], optional
+ :param multipart_data: Multipart data of the request, defaults to None
+ :type multipart_data: Optional[List[MultipartItem]], optional
+ :param content_type: Content type of the request body, defaults to 'application/json'
+ :type content_type: str, optional
+ :param response_format: Expected response format, defaults to ResponseFormat.JSON
+ :type response_format: ResponseFormat, optional
+ :param auth: Authentication object, defaults to None
+ :type auth: Optional[Authentication], optional
+ :param network_session: Network session object, defaults to None
+ :type network_session: Optional[NetworkSession], optional
+ :param follow_redirects: A boolean value indicate if the request should follow redirects. Defaults to True. Not supported in Browser environment., defaults to True
+ :type follow_redirects: Optional[bool], optional
+ """
+ self.url = url
+ self.method = method
+ self.params = params
+ self.headers = headers
+ self.data = data
+ self.file_stream = file_stream
+ self.multipart_data = multipart_data
+ self.content_type = content_type
+ self.response_format = response_format
+ self.auth = auth
+ self.network_session = network_session
+ self.follow_redirects = follow_redirects
diff --git a/box_sdk_gen/networking/fetch_response.py b/box_sdk_gen/networking/fetch_response.py
new file mode 100644
index 000000000..48675119b
--- /dev/null
+++ b/box_sdk_gen/networking/fetch_response.py
@@ -0,0 +1,36 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.serialization.json import SerializedData
+
+from box_sdk_gen.internal.utils import ByteStream
+
+
+class FetchResponse:
+ def __init__(
+ self,
+ status: int,
+ headers: Dict[str, str],
+ *,
+ url: Optional[str] = None,
+ data: Optional[SerializedData] = None,
+ content: Optional[ByteStream] = None
+ ):
+ """
+ :param status: HTTP status code of the response
+ :type status: int
+ :param headers: HTTP headers of the response
+ :type headers: Dict[str, str]
+ :param url: URL of the response, defaults to None
+ :type url: Optional[str], optional
+ :param data: Response body of the response, defaults to None
+ :type data: Optional[SerializedData], optional
+ :param content: Streamed content of the response, defaults to None
+ :type content: Optional[ByteStream], optional
+ """
+ self.status = status
+ self.headers = headers
+ self.url = url
+ self.data = data
+ self.content = content
diff --git a/box_sdk_gen/networking/network.py b/box_sdk_gen/networking/network.py
new file mode 100644
index 000000000..c51f8722e
--- /dev/null
+++ b/box_sdk_gen/networking/network.py
@@ -0,0 +1,154 @@
+from typing import Dict
+
+from ..internal.logging import DataSanitizer
+from .network_client import NetworkClient
+from .box_network_client import BoxNetworkClient
+from .proxy_config import ProxyConfig
+from .base_urls import BaseUrls
+from .retries import RetryStrategy, BoxRetryStrategy
+
+
+class NetworkSession:
+ def __init__(
+ self,
+ *,
+ network_client: NetworkClient = None,
+ retry_strategy: RetryStrategy = None,
+ additional_headers: Dict[str, str] = None,
+ base_urls: BaseUrls = None,
+ proxy_url: str = None,
+ data_sanitizer: DataSanitizer = None,
+ ):
+ if additional_headers is None:
+ additional_headers = {}
+ if base_urls is None:
+ base_urls = BaseUrls()
+ if retry_strategy is None:
+ retry_strategy = BoxRetryStrategy()
+ if network_client is None:
+ network_client = BoxNetworkClient()
+ if (
+ proxy_url
+ and hasattr(network_client, 'requests_session')
+ and network_client.requests_session
+ ):
+ network_client.requests_session.proxies = {
+ 'http': proxy_url,
+ 'https': proxy_url,
+ }
+ if data_sanitizer is None:
+ data_sanitizer = DataSanitizer()
+ self.additional_headers = additional_headers
+ self.base_urls = base_urls
+ self.proxy_url = proxy_url
+ self.network_client = network_client
+ self.retry_strategy = retry_strategy
+ self.data_sanitizer = data_sanitizer
+
+ def with_additional_headers(
+ self, additional_headers: Dict[str, str] = None
+ ) -> 'NetworkSession':
+ """
+ Generate a fresh network session by duplicating the existing configuration and network parameters,
+ while also including additional headers to be attached to every API call.
+ :param additional_headers: Dict of headers, which are appended to each API request
+ :return: a new instance of NetworkSession
+ """
+ return NetworkSession(
+ network_client=self.network_client,
+ additional_headers={**self.additional_headers, **additional_headers},
+ base_urls=self.base_urls,
+ proxy_url=self.proxy_url,
+ retry_strategy=self.retry_strategy,
+ data_sanitizer=self.data_sanitizer,
+ )
+
+ 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(
+ network_client=self.network_client,
+ additional_headers=self.additional_headers,
+ base_urls=base_urls,
+ proxy_url=self.proxy_url,
+ retry_strategy=self.retry_strategy,
+ data_sanitizer=self.data_sanitizer,
+ )
+
+ def with_proxy(self, config: ProxyConfig) -> 'NetworkSession':
+ """
+ Generate a fresh network session by duplicating the existing configuration and network parameters,
+ while also including a proxy to be used for each API call.
+ :param config: ProxyConfig object, which contains the proxy url, username, and password
+ :return: a new instance of NetworkSession
+ """
+ if not config.url or not config.url.startswith("http"):
+ raise ValueError("Invalid proxy URL provided")
+
+ proxy_host = config.url.split("//")[1]
+ proxy_auth = (
+ f"{config.username}:{config.password}@"
+ if config.username and config.password
+ else ""
+ )
+ proxy_url = f"http://{proxy_auth}{proxy_host}"
+ return NetworkSession(
+ network_client=self.network_client,
+ additional_headers=self.additional_headers,
+ base_urls=self.base_urls,
+ proxy_url=proxy_url,
+ retry_strategy=self.retry_strategy,
+ data_sanitizer=self.data_sanitizer,
+ )
+
+ def with_network_client(self, network_client: NetworkClient) -> 'NetworkSession':
+ """
+ Generate a fresh network session by duplicating the existing configuration and network parameters,
+ while also including a new network client to be used for each API call.
+ :param network_client: NetworkClient object, which contains the fetch method
+ :return: a new instance of NetworkSession
+ """
+ return NetworkSession(
+ network_client=network_client,
+ additional_headers=self.additional_headers,
+ base_urls=self.base_urls,
+ proxy_url=self.proxy_url,
+ retry_strategy=self.retry_strategy,
+ data_sanitizer=self.data_sanitizer,
+ )
+
+ def with_retry_strategy(self, retry_strategy: RetryStrategy) -> 'NetworkSession':
+ """
+ Generate a fresh network session by duplicating the existing configuration and network parameters,
+ while also including a new retry options to be used for each API call.
+ :param retry_strategy: RetryStrategy object, which contains the retry logic
+ :return: a new instance of NetworkSession
+ """
+ return NetworkSession(
+ network_client=self.network_client,
+ additional_headers=self.additional_headers,
+ base_urls=self.base_urls,
+ proxy_url=self.proxy_url,
+ retry_strategy=retry_strategy,
+ data_sanitizer=self.data_sanitizer,
+ )
+
+ def with_data_sanitizer(self, data_sanitizer: DataSanitizer) -> 'NetworkSession':
+ """
+ Generate a fresh network session by duplicating the existing configuration and network parameters,
+ while also applying data sanitizer to sanitize sensitive data for logging.
+ :param data_sanitizer:
+ :return:
+ """
+ return NetworkSession(
+ network_client=self.network_client,
+ additional_headers=self.additional_headers,
+ base_urls=self.base_urls,
+ proxy_url=self.proxy_url,
+ retry_strategy=self.retry_strategy,
+ data_sanitizer=data_sanitizer,
+ )
diff --git a/box_sdk_gen/networking/network_client.py b/box_sdk_gen/networking/network_client.py
new file mode 100644
index 000000000..789354a42
--- /dev/null
+++ b/box_sdk_gen/networking/network_client.py
@@ -0,0 +1,14 @@
+from abc import abstractmethod
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+
+class NetworkClient:
+ def __init__(self):
+ pass
+
+ @abstractmethod
+ def fetch(self, options: FetchOptions) -> FetchResponse:
+ pass
diff --git a/box_sdk_gen/networking/proxy_config.py b/box_sdk_gen/networking/proxy_config.py
new file mode 100644
index 000000000..05d6f1298
--- /dev/null
+++ b/box_sdk_gen/networking/proxy_config.py
@@ -0,0 +1,14 @@
+from typing import Optional
+
+
+class ProxyConfig:
+ def __init__(
+ self,
+ url: str,
+ *,
+ username: Optional[str] = None,
+ password: Optional[str] = None
+ ):
+ self.url = url
+ self.username = username
+ self.password = password
diff --git a/box_sdk_gen/networking/retries.py b/box_sdk_gen/networking/retries.py
new file mode 100644
index 000000000..30539dcdd
--- /dev/null
+++ b/box_sdk_gen/networking/retries.py
@@ -0,0 +1,94 @@
+from abc import abstractmethod
+
+from box_sdk_gen.networking.fetch_options import FetchOptions
+
+from box_sdk_gen.networking.fetch_response import FetchResponse
+
+from box_sdk_gen.internal.utils import random
+
+
+class RetryStrategy:
+ def __init__(self):
+ pass
+
+ @abstractmethod
+ def should_retry(
+ self,
+ fetch_options: FetchOptions,
+ fetch_response: FetchResponse,
+ attempt_number: int,
+ ) -> bool:
+ pass
+
+ @abstractmethod
+ def retry_after(
+ self,
+ fetch_options: FetchOptions,
+ fetch_response: FetchResponse,
+ attempt_number: int,
+ ) -> float:
+ pass
+
+
+class BoxRetryStrategy(RetryStrategy):
+ def __init__(
+ self,
+ *,
+ max_attempts: int = 5,
+ retry_randomization_factor: float = 0.5,
+ retry_base_interval: float = 1,
+ max_retries_on_exception: int = 2,
+ **kwargs
+ ):
+ super().__init__(**kwargs)
+ self.max_attempts = max_attempts
+ self.retry_randomization_factor = retry_randomization_factor
+ self.retry_base_interval = retry_base_interval
+ self.max_retries_on_exception = max_retries_on_exception
+
+ def should_retry(
+ self,
+ fetch_options: FetchOptions,
+ fetch_response: FetchResponse,
+ attempt_number: int,
+ ) -> bool:
+ if fetch_response.status == 0:
+ return attempt_number <= self.max_retries_on_exception
+ is_successful: bool = (
+ fetch_response.status >= 200 and fetch_response.status < 400
+ )
+ retry_after_header: str = fetch_response.headers.get('Retry-After')
+ is_accepted_with_retry_after: bool = (
+ fetch_response.status == 202 and not retry_after_header == None
+ )
+ if attempt_number >= self.max_attempts:
+ return False
+ if is_accepted_with_retry_after:
+ return True
+ if fetch_response.status >= 500:
+ return True
+ if fetch_response.status == 429:
+ return True
+ if fetch_response.status == 401 and not fetch_options.auth == None:
+ fetch_options.auth.refresh_token(
+ network_session=fetch_options.network_session
+ )
+ return True
+ if is_successful:
+ return False
+ return False
+
+ def retry_after(
+ self,
+ fetch_options: FetchOptions,
+ fetch_response: FetchResponse,
+ attempt_number: int,
+ ) -> float:
+ retry_after_header: str = fetch_response.headers.get('Retry-After')
+ if not retry_after_header == None:
+ return float(retry_after_header)
+ randomization: float = random(
+ 1 - self.retry_randomization_factor, 1 + self.retry_randomization_factor
+ )
+ exponential: float = 2**attempt_number
+ return (exponential * self.retry_base_interval) * randomization
diff --git a/box_sdk_gen/networking/version.py b/box_sdk_gen/networking/version.py
new file mode 100644
index 000000000..b794fd409
--- /dev/null
+++ b/box_sdk_gen/networking/version.py
@@ -0,0 +1 @@
+__version__ = '0.1.0'
diff --git a/box_sdk_gen/parameters/__init__.py b/box_sdk_gen/parameters/__init__.py
new file mode 100644
index 000000000..6ee9acb7e
--- /dev/null
+++ b/box_sdk_gen/parameters/__init__.py
@@ -0,0 +1 @@
+from box_sdk_gen.parameters.v2025_r0 import *
diff --git a/box_sdk_gen/parameters/v2025_r0/__init__.py b/box_sdk_gen/parameters/v2025_r0/__init__.py
new file mode 100644
index 000000000..72c18cf87
--- /dev/null
+++ b/box_sdk_gen/parameters/v2025_r0/__init__.py
@@ -0,0 +1 @@
+from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import *
diff --git a/box_sdk_gen/parameters/v2025_r0/box_version_header_v2025_r0.py b/box_sdk_gen/parameters/v2025_r0/box_version_header_v2025_r0.py
new file mode 100644
index 000000000..ed66cfe5c
--- /dev/null
+++ b/box_sdk_gen/parameters/v2025_r0/box_version_header_v2025_r0.py
@@ -0,0 +1,7 @@
+from enum import Enum
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class BoxVersionHeaderV2025R0(str, Enum):
+ _2025_0 = '2025.0'
diff --git a/box_sdk_gen/schemas/__init__.py b/box_sdk_gen/schemas/__init__.py
new file mode 100644
index 000000000..8c051af87
--- /dev/null
+++ b/box_sdk_gen/schemas/__init__.py
@@ -0,0 +1,523 @@
+from box_sdk_gen.schemas.ai_agent_info import *
+
+from box_sdk_gen.schemas.ai_response import *
+
+from box_sdk_gen.schemas.ai_agent_reference import *
+
+from box_sdk_gen.schemas.ai_citation import *
+
+from box_sdk_gen.schemas.ai_response_full import *
+
+from box_sdk_gen.schemas.ai_dialogue_history import *
+
+from box_sdk_gen.schemas.ai_extract_response import *
+
+from box_sdk_gen.schemas.ai_extract_structured_response import *
+
+from box_sdk_gen.schemas.ai_item_base import *
+
+from box_sdk_gen.schemas.ai_item_ask import *
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import *
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import *
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import *
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import *
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import *
+
+from box_sdk_gen.schemas.ai_agent_spreadsheet_tool import *
+
+from box_sdk_gen.schemas.ai_studio_agent_spreadsheet_tool import *
+
+from box_sdk_gen.schemas.ai_studio_agent_spreadsheet_tool_response import *
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import *
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_text_gen import *
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import *
+
+from box_sdk_gen.schemas.ai_agent_basic_gen_tool import *
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_gen_tool import *
+
+from box_sdk_gen.schemas.ai_studio_agent_text_gen import *
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_gen_tool_response import *
+
+from box_sdk_gen.schemas.ai_studio_agent_text_gen_response import *
+
+from box_sdk_gen.schemas.ai_agent_text_gen import *
+
+from box_sdk_gen.schemas.ai_text_gen import *
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import *
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool import *
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool_response import *
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool import *
+
+from box_sdk_gen.schemas.ai_studio_agent_long_text_tool import *
+
+from box_sdk_gen.schemas.ai_studio_agent_long_text_tool_response import *
+
+from box_sdk_gen.schemas.ai_studio_agent_extract_response import *
+
+from box_sdk_gen.schemas.ai_studio_agent_ask_response import *
+
+from box_sdk_gen.schemas.ai_studio_agent_extract import *
+
+from box_sdk_gen.schemas.ai_studio_agent_ask import *
+
+from box_sdk_gen.schemas.ai_agent_extract_structured import *
+
+from box_sdk_gen.schemas.ai_extract_structured import *
+
+from box_sdk_gen.schemas.ai_agent_extract import *
+
+from box_sdk_gen.schemas.ai_extract import *
+
+from box_sdk_gen.schemas.ai_agent_ask import *
+
+from box_sdk_gen.schemas.ai_ask import *
+
+from box_sdk_gen.schemas.app_item import *
+
+from box_sdk_gen.schemas.classification import *
+
+from box_sdk_gen.schemas.classification_template import *
+
+from box_sdk_gen.schemas.client_error import *
+
+from box_sdk_gen.schemas.collaboration_allowlist_entry import *
+
+from box_sdk_gen.schemas.collaboration_allowlist_entries import *
+
+from box_sdk_gen.schemas.collaborator_variable import *
+
+from box_sdk_gen.schemas.collection import *
+
+from box_sdk_gen.schemas.collections import *
+
+from box_sdk_gen.schemas.comment_base import *
+
+from box_sdk_gen.schemas.completion_rule_variable import *
+
+from box_sdk_gen.schemas.email_alias import *
+
+from box_sdk_gen.schemas.email_aliases import *
+
+from box_sdk_gen.schemas.enterprise_base import *
+
+from box_sdk_gen.schemas.file_base import *
+
+from box_sdk_gen.schemas.file_request_update_request import *
+
+from box_sdk_gen.schemas.file_request_copy_request import *
+
+from box_sdk_gen.schemas.file_version_base import *
+
+from box_sdk_gen.schemas.file_version_mini import *
+
+from box_sdk_gen.schemas.file_mini import *
+
+from box_sdk_gen.schemas.files_under_retention import *
+
+from box_sdk_gen.schemas.files_on_hold import *
+
+from box_sdk_gen.schemas.file_conflict import *
+
+from box_sdk_gen.schemas.conflict_error import *
+
+from box_sdk_gen.schemas.folder_base import *
+
+from box_sdk_gen.schemas.folder_mini import *
+
+from box_sdk_gen.schemas.file_or_folder_scope import *
+
+from box_sdk_gen.schemas.access_token import *
+
+from box_sdk_gen.schemas.folder_reference import *
+
+from box_sdk_gen.schemas.generic_source import *
+
+from box_sdk_gen.schemas.group_base import *
+
+from box_sdk_gen.schemas.group_mini import *
+
+from box_sdk_gen.schemas.group import *
+
+from box_sdk_gen.schemas.group_full import *
+
+from box_sdk_gen.schemas.groups import *
+
+from box_sdk_gen.schemas.integration_mapping_base import *
+
+from box_sdk_gen.schemas.integration_mapping_box_item_slack import *
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_slack import *
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_teams import *
+
+from box_sdk_gen.schemas.integration_mapping_teams import *
+
+from box_sdk_gen.schemas.integration_mappings_teams import *
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_teams_create_request import *
+
+from box_sdk_gen.schemas.integration_mapping_teams_create_request import *
+
+from box_sdk_gen.schemas.integration_mapping_slack_options import *
+
+from box_sdk_gen.schemas.integration_mapping_slack_create_request import *
+
+from box_sdk_gen.schemas.keyword_skill_card import *
+
+from box_sdk_gen.schemas.legal_hold_policy_mini import *
+
+from box_sdk_gen.schemas.legal_hold_policy_assignment_base import *
+
+from box_sdk_gen.schemas.metadata_base import *
+
+from box_sdk_gen.schemas.metadata import *
+
+from box_sdk_gen.schemas.metadatas import *
+
+from box_sdk_gen.schemas.metadata_full import *
+
+from box_sdk_gen.schemas.metadata_cascade_policy import *
+
+from box_sdk_gen.schemas.metadata_cascade_policies import *
+
+from box_sdk_gen.schemas.metadata_error import *
+
+from box_sdk_gen.schemas.metadata_field_filter_date_range import *
+
+from box_sdk_gen.schemas.metadata_field_filter_float_range import *
+
+from box_sdk_gen.schemas.metadata_filter import *
+
+from box_sdk_gen.schemas.metadata_instance_value import *
+
+from box_sdk_gen.schemas.metadata_query import *
+
+from box_sdk_gen.schemas.metadata_query_index import *
+
+from box_sdk_gen.schemas.metadata_template import *
+
+from box_sdk_gen.schemas.metadata_templates import *
+
+from box_sdk_gen.schemas.o_auth_2_error import *
+
+from box_sdk_gen.schemas.post_o_auth_2_revoke import *
+
+from box_sdk_gen.schemas.post_o_auth_2_token import *
+
+from box_sdk_gen.schemas.post_o_auth_2_token_refresh_access_token import *
+
+from box_sdk_gen.schemas.realtime_server import *
+
+from box_sdk_gen.schemas.realtime_servers import *
+
+from box_sdk_gen.schemas.retention_policy_base import *
+
+from box_sdk_gen.schemas.retention_policy_mini import *
+
+from box_sdk_gen.schemas.file_version_retention import *
+
+from box_sdk_gen.schemas.file_version_retentions import *
+
+from box_sdk_gen.schemas.retention_policy_assignment_base import *
+
+from box_sdk_gen.schemas.role_variable import *
+
+from box_sdk_gen.schemas.outcome import *
+
+from box_sdk_gen.schemas.session_termination_message import *
+
+from box_sdk_gen.schemas.shield_information_barrier_base import *
+
+from box_sdk_gen.schemas.shield_information_barrier_reference import *
+
+from box_sdk_gen.schemas.shield_information_barrier_report_base import *
+
+from box_sdk_gen.schemas.shield_information_barrier_report_details import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member_base import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_base import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_mini import *
+
+from box_sdk_gen.schemas.sign_request_create_signer import *
+
+from box_sdk_gen.schemas.sign_request_prefill_tag import *
+
+from box_sdk_gen.schemas.template_signer_input import *
+
+from box_sdk_gen.schemas.template_signer import *
+
+from box_sdk_gen.schemas.sign_template import *
+
+from box_sdk_gen.schemas.sign_templates import *
+
+from box_sdk_gen.schemas.sign_request_signer_input import *
+
+from box_sdk_gen.schemas.sign_request_signer import *
+
+from box_sdk_gen.schemas.sign_request_base import *
+
+from box_sdk_gen.schemas.sign_request_create_request import *
+
+from box_sdk_gen.schemas.sign_request import *
+
+from box_sdk_gen.schemas.sign_requests import *
+
+from box_sdk_gen.schemas.status_skill_card import *
+
+from box_sdk_gen.schemas.storage_policy_mini import *
+
+from box_sdk_gen.schemas.storage_policy_assignment import *
+
+from box_sdk_gen.schemas.storage_policy_assignments import *
+
+from box_sdk_gen.schemas.storage_policy import *
+
+from box_sdk_gen.schemas.storage_policies import *
+
+from box_sdk_gen.schemas.terms_of_service_base import *
+
+from box_sdk_gen.schemas.terms_of_service import *
+
+from box_sdk_gen.schemas.terms_of_services import *
+
+from box_sdk_gen.schemas.timeline_skill_card import *
+
+from box_sdk_gen.schemas.tracking_code import *
+
+from box_sdk_gen.schemas.transcript_skill_card import *
+
+from box_sdk_gen.schemas.skill_cards_metadata import *
+
+from box_sdk_gen.schemas.upload_part_mini import *
+
+from box_sdk_gen.schemas.upload_part import *
+
+from box_sdk_gen.schemas.uploaded_part import *
+
+from box_sdk_gen.schemas.upload_parts import *
+
+from box_sdk_gen.schemas.upload_session import *
+
+from box_sdk_gen.schemas.upload_url import *
+
+from box_sdk_gen.schemas.user_base import *
+
+from box_sdk_gen.schemas.user_integration_mappings import *
+
+from box_sdk_gen.schemas.integration_mapping import *
+
+from box_sdk_gen.schemas.integration_mappings import *
+
+from box_sdk_gen.schemas.user_mini import *
+
+from box_sdk_gen.schemas.user import *
+
+from box_sdk_gen.schemas.user_full import *
+
+from box_sdk_gen.schemas.users import *
+
+from box_sdk_gen.schemas.trash_web_link_restored import *
+
+from box_sdk_gen.schemas.trash_web_link import *
+
+from box_sdk_gen.schemas.trash_folder_restored import *
+
+from box_sdk_gen.schemas.trash_folder import *
+
+from box_sdk_gen.schemas.trash_file_restored import *
+
+from box_sdk_gen.schemas.trash_file import *
+
+from box_sdk_gen.schemas.terms_of_service_user_status import *
+
+from box_sdk_gen.schemas.terms_of_service_user_statuses import *
+
+from box_sdk_gen.schemas.task_assignment import *
+
+from box_sdk_gen.schemas.task_assignments import *
+
+from box_sdk_gen.schemas.task import *
+
+from box_sdk_gen.schemas.tasks import *
+
+from box_sdk_gen.schemas.retention_policy_assignment import *
+
+from box_sdk_gen.schemas.retention_policy_assignments import *
+
+from box_sdk_gen.schemas.retention_policy import *
+
+from box_sdk_gen.schemas.retention_policies import *
+
+from box_sdk_gen.schemas.legal_hold_policy import *
+
+from box_sdk_gen.schemas.legal_hold_policies import *
+
+from box_sdk_gen.schemas.invite import *
+
+from box_sdk_gen.schemas.group_membership import *
+
+from box_sdk_gen.schemas.group_memberships import *
+
+from box_sdk_gen.schemas.file_version import *
+
+from box_sdk_gen.schemas.file_version_full import *
+
+from box_sdk_gen.schemas.file_versions import *
+
+from box_sdk_gen.schemas.file_request import *
+
+from box_sdk_gen.schemas.file import *
+
+from box_sdk_gen.schemas.file_full import *
+
+from box_sdk_gen.schemas.files import *
+
+from box_sdk_gen.schemas.event_source import *
+
+from box_sdk_gen.schemas.device_pinner import *
+
+from box_sdk_gen.schemas.device_pinners import *
+
+from box_sdk_gen.schemas.comment import *
+
+from box_sdk_gen.schemas.comment_full import *
+
+from box_sdk_gen.schemas.comments import *
+
+from box_sdk_gen.schemas.collaboration_allowlist_exempt_target import *
+
+from box_sdk_gen.schemas.collaboration_allowlist_exempt_targets import *
+
+from box_sdk_gen.schemas.app_item_event_source import *
+
+from box_sdk_gen.schemas.user_collaborations import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restrictions import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member_mini import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_members import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segment import *
+
+from box_sdk_gen.schemas.shield_information_barrier_segments import *
+
+from box_sdk_gen.schemas.shield_information_barrier_report import *
+
+from box_sdk_gen.schemas.shield_information_barrier_reports import *
+
+from box_sdk_gen.schemas.shield_information_barrier import *
+
+from box_sdk_gen.schemas.shield_information_barriers import *
+
+from box_sdk_gen.schemas.folder_lock import *
+
+from box_sdk_gen.schemas.folder_locks import *
+
+from box_sdk_gen.schemas.ai_agent_allowed_entity import *
+
+from box_sdk_gen.schemas.create_ai_agent import *
+
+from box_sdk_gen.schemas.ai_single_agent_response import *
+
+from box_sdk_gen.schemas.ai_single_agent_response_full import *
+
+from box_sdk_gen.schemas.ai_multiple_agent_response import *
+
+from box_sdk_gen.schemas.user_avatar import *
+
+from box_sdk_gen.schemas.watermark import *
+
+from box_sdk_gen.schemas.web_link_base import *
+
+from box_sdk_gen.schemas.web_link_mini import *
+
+from box_sdk_gen.schemas.web_link import *
+
+from box_sdk_gen.schemas.items_offset_paginated import *
+
+from box_sdk_gen.schemas.items import *
+
+from box_sdk_gen.schemas.folder import *
+
+from box_sdk_gen.schemas.legal_hold_policy_assignment import *
+
+from box_sdk_gen.schemas.legal_hold_policy_assignments import *
+
+from box_sdk_gen.schemas.file_version_legal_hold import *
+
+from box_sdk_gen.schemas.file_version_legal_holds import *
+
+from box_sdk_gen.schemas.folder_full import *
+
+from box_sdk_gen.schemas.search_results import *
+
+from box_sdk_gen.schemas.search_result_with_shared_link import *
+
+from box_sdk_gen.schemas.search_results_with_shared_links import *
+
+from box_sdk_gen.schemas.recent_item import *
+
+from box_sdk_gen.schemas.recent_items import *
+
+from box_sdk_gen.schemas.metadata_query_results import *
+
+from box_sdk_gen.schemas.event import *
+
+from box_sdk_gen.schemas.skill_invocation import *
+
+from box_sdk_gen.schemas.events import *
+
+from box_sdk_gen.schemas.collaboration import *
+
+from box_sdk_gen.schemas.collaborations_offset_paginated import *
+
+from box_sdk_gen.schemas.collaborations import *
+
+from box_sdk_gen.schemas.app_item_association import *
+
+from box_sdk_gen.schemas.app_item_associations import *
+
+from box_sdk_gen.schemas.webhook_mini import *
+
+from box_sdk_gen.schemas.webhooks import *
+
+from box_sdk_gen.schemas.webhook import *
+
+from box_sdk_gen.schemas.webhook_invocation import *
+
+from box_sdk_gen.schemas.workflow_mini import *
+
+from box_sdk_gen.schemas.workflow import *
+
+from box_sdk_gen.schemas.workflows import *
+
+from box_sdk_gen.schemas.workflow_full import *
+
+from box_sdk_gen.schemas.zip_download import *
+
+from box_sdk_gen.schemas.zip_download_request import *
+
+from box_sdk_gen.schemas.zip_download_status import *
+
+from box_sdk_gen.schemas.v2025_r0 import *
diff --git a/box_sdk_gen/schemas/access_token.py b/box_sdk_gen/schemas/access_token.py
new file mode 100644
index 000000000..2b4082048
--- /dev/null
+++ b/box_sdk_gen/schemas/access_token.py
@@ -0,0 +1,60 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_or_folder_scope import FileOrFolderScope
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AccessTokenTokenTypeField(str, Enum):
+ BEARER = 'bearer'
+
+
+class AccessTokenIssuedTokenTypeField(str, Enum):
+ URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN = (
+ 'urn:ietf:params:oauth:token-type:access_token'
+ )
+
+
+class AccessToken(BaseObject):
+ def __init__(
+ self,
+ *,
+ access_token: Optional[str] = None,
+ expires_in: Optional[int] = None,
+ token_type: Optional[AccessTokenTokenTypeField] = None,
+ restricted_to: Optional[List[FileOrFolderScope]] = None,
+ refresh_token: Optional[str] = None,
+ issued_token_type: Optional[AccessTokenIssuedTokenTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param access_token: The requested access token., defaults to None
+ :type access_token: Optional[str], optional
+ :param expires_in: The time in seconds by which this token will expire., defaults to None
+ :type expires_in: Optional[int], optional
+ :param token_type: The type of access token returned., defaults to None
+ :type token_type: Optional[AccessTokenTokenTypeField], 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., defaults to None
+ :type restricted_to: Optional[List[FileOrFolderScope]], optional
+ :param refresh_token: The refresh token for this access token, which can be used
+ to request a new access token when the current one expires., defaults to None
+ :type refresh_token: Optional[str], optional
+ :param issued_token_type: The type of downscoped access token returned. This is only
+ returned if an access token has been downscoped., defaults to None
+ :type issued_token_type: Optional[AccessTokenIssuedTokenTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.access_token = access_token
+ self.expires_in = expires_in
+ self.token_type = token_type
+ self.restricted_to = restricted_to
+ self.refresh_token = refresh_token
+ self.issued_token_type = issued_token_type
diff --git a/box_sdk_gen/schemas/ai_agent_allowed_entity.py b/box_sdk_gen/schemas/ai_agent_allowed_entity.py
new file mode 100644
index 000000000..202cf8649
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_allowed_entity.py
@@ -0,0 +1,9 @@
+from typing import Union
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.schemas.group_base import GroupBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+AiAgentAllowedEntity = Union[UserBase, GroupBase]
diff --git a/box_sdk_gen/schemas/ai_agent_ask.py b/box_sdk_gen/schemas/ai_agent_ask.py
new file mode 100644
index 000000000..1193998b5
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_ask.py
@@ -0,0 +1,48 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool import AiAgentLongTextTool
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
+
+from box_sdk_gen.schemas.ai_agent_spreadsheet_tool import AiAgentSpreadsheetTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentAskTypeField(str, Enum):
+ AI_AGENT_ASK = 'ai_agent_ask'
+
+
+class AiAgentAsk(BaseObject):
+ _discriminator = 'type', {'ai_agent_ask'}
+
+ def __init__(
+ self,
+ *,
+ type: AiAgentAskTypeField = AiAgentAskTypeField.AI_AGENT_ASK,
+ long_text: Optional[AiAgentLongTextTool] = None,
+ basic_text: Optional[AiAgentBasicTextTool] = None,
+ spreadsheet: Optional[AiAgentSpreadsheetTool] = None,
+ long_text_multi: Optional[AiAgentLongTextTool] = None,
+ basic_text_multi: Optional[AiAgentBasicTextTool] = None,
+ basic_image: Optional[AiAgentBasicTextTool] = None,
+ basic_image_multi: Optional[AiAgentBasicTextTool] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of AI agent used to handle queries., defaults to AiAgentAskTypeField.AI_AGENT_ASK
+ :type type: AiAgentAskTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.long_text = long_text
+ self.basic_text = basic_text
+ self.spreadsheet = spreadsheet
+ self.long_text_multi = long_text_multi
+ self.basic_text_multi = basic_text_multi
+ self.basic_image = basic_image
+ self.basic_image_multi = basic_image_multi
diff --git a/box_sdk_gen/schemas/ai_agent_basic_gen_tool.py b/box_sdk_gen/schemas/ai_agent_basic_gen_tool.py
new file mode 100644
index 000000000..6aef8bb0c
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_basic_gen_tool.py
@@ -0,0 +1,69 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_text_gen import (
+ AiAgentBasicTextToolTextGen,
+)
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import (
+ AiAgentLongTextToolTextGenEmbeddingsField,
+)
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import (
+ AiAgentLongTextToolTextGen,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentBasicGenTool(AiAgentLongTextToolTextGen):
+ def __init__(
+ self,
+ *,
+ content_template: Optional[str] = None,
+ embeddings: Optional[AiAgentLongTextToolTextGenEmbeddingsField] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param content_template: How the content should be included in a request to the LLM.
+ Input for `{content}` is optional, depending on the use., defaults to None
+ :type content_template: Optional[str], optional
+ :param system_message: System messages aim at helping the LLM understand its role and what it is supposed to do.
+ The input for `{current_date}` is optional, depending on the use., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+
+ When using the `prompt_template` parameter, you **must include** input for `{user_question}`.
+ Inputs for `{current_date}` and `{content}` are optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ embeddings=embeddings,
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.content_template = content_template
diff --git a/box_sdk_gen/schemas/ai_agent_basic_text_tool.py b/box_sdk_gen/schemas/ai_agent_basic_text_tool.py
new file mode 100644
index 000000000..5c48ae509
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_basic_text_tool.py
@@ -0,0 +1,48 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentBasicTextTool(AiAgentBasicTextToolBase):
+ def __init__(
+ self,
+ *,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param system_message: System messages try to help the LLM "understand" its role and what it is supposed to do., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+ When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`.
+ `{current_date}` is optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.system_message = system_message
+ self.prompt_template = prompt_template
diff --git a/box_sdk_gen/schemas/ai_agent_basic_text_tool_base.py b/box_sdk_gen/schemas/ai_agent_basic_text_tool_base.py
new file mode 100644
index 000000000..0090d4218
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_basic_text_tool_base.py
@@ -0,0 +1,36 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentBasicTextToolBase(BaseObject):
+ def __init__(
+ self,
+ *,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.model = model
+ self.num_tokens_for_completion = num_tokens_for_completion
+ self.llm_endpoint_params = llm_endpoint_params
diff --git a/box_sdk_gen/schemas/ai_agent_basic_text_tool_text_gen.py b/box_sdk_gen/schemas/ai_agent_basic_text_tool_text_gen.py
new file mode 100644
index 000000000..2d9a73f01
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_basic_text_tool_text_gen.py
@@ -0,0 +1,50 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentBasicTextToolTextGen(AiAgentBasicTextToolBase):
+ def __init__(
+ self,
+ *,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param system_message: System messages aim at helping the LLM understand its role and what it is supposed to do.
+ The input for `{current_date}` is optional, depending on the use., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+
+ When using the `prompt_template` parameter, you **must include** input for `{user_question}`.
+ Inputs for `{current_date}` and `{content}` are optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.system_message = system_message
+ self.prompt_template = prompt_template
diff --git a/box_sdk_gen/schemas/ai_agent_extract.py b/box_sdk_gen/schemas/ai_agent_extract.py
new file mode 100644
index 000000000..02a2e34ce
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_extract.py
@@ -0,0 +1,38 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool import AiAgentLongTextTool
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentExtractTypeField(str, Enum):
+ AI_AGENT_EXTRACT = 'ai_agent_extract'
+
+
+class AiAgentExtract(BaseObject):
+ _discriminator = 'type', {'ai_agent_extract'}
+
+ def __init__(
+ self,
+ *,
+ type: AiAgentExtractTypeField = AiAgentExtractTypeField.AI_AGENT_EXTRACT,
+ long_text: Optional[AiAgentLongTextTool] = None,
+ basic_text: Optional[AiAgentBasicTextTool] = None,
+ basic_image: Optional[AiAgentBasicTextTool] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of AI agent to be used for extraction., defaults to AiAgentExtractTypeField.AI_AGENT_EXTRACT
+ :type type: AiAgentExtractTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.long_text = long_text
+ self.basic_text = basic_text
+ self.basic_image = basic_image
diff --git a/box_sdk_gen/schemas/ai_agent_extract_structured.py b/box_sdk_gen/schemas/ai_agent_extract_structured.py
new file mode 100644
index 000000000..142ae9961
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_extract_structured.py
@@ -0,0 +1,38 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool import AiAgentLongTextTool
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentExtractStructuredTypeField(str, Enum):
+ AI_AGENT_EXTRACT_STRUCTURED = 'ai_agent_extract_structured'
+
+
+class AiAgentExtractStructured(BaseObject):
+ _discriminator = 'type', {'ai_agent_extract_structured'}
+
+ def __init__(
+ self,
+ *,
+ type: AiAgentExtractStructuredTypeField = AiAgentExtractStructuredTypeField.AI_AGENT_EXTRACT_STRUCTURED,
+ long_text: Optional[AiAgentLongTextTool] = None,
+ basic_text: Optional[AiAgentBasicTextTool] = None,
+ basic_image: Optional[AiAgentBasicTextTool] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of AI agent to be used for extraction., defaults to AiAgentExtractStructuredTypeField.AI_AGENT_EXTRACT_STRUCTURED
+ :type type: AiAgentExtractStructuredTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.long_text = long_text
+ self.basic_text = basic_text
+ self.basic_image = basic_image
diff --git a/box_sdk_gen/schemas/ai_agent_info.py b/box_sdk_gen/schemas/ai_agent_info.py
new file mode 100644
index 000000000..cca80e8f4
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_info.py
@@ -0,0 +1,49 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentInfoModelsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ name: Optional[str] = None,
+ provider: Optional[str] = None,
+ supported_purpose: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param name: The name of the model used for the request., defaults to None
+ :type name: Optional[str], optional
+ :param provider: The provider that owns the model used for the request., defaults to None
+ :type provider: Optional[str], optional
+ :param supported_purpose: The supported purpose utilized by the model used for the request., defaults to None
+ :type supported_purpose: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.provider = provider
+ self.supported_purpose = supported_purpose
+
+
+class AiAgentInfo(BaseObject):
+ def __init__(
+ self,
+ *,
+ models: Optional[List[AiAgentInfoModelsField]] = None,
+ processor: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param models: The models used for the request., defaults to None
+ :type models: Optional[List[AiAgentInfoModelsField]], optional
+ :param processor: The processor used for the request., defaults to None
+ :type processor: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.models = models
+ self.processor = processor
diff --git a/box_sdk_gen/schemas/ai_agent_long_text_tool.py b/box_sdk_gen/schemas/ai_agent_long_text_tool.py
new file mode 100644
index 000000000..57773078c
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_long_text_tool.py
@@ -0,0 +1,90 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentLongTextToolEmbeddingsStrategyField(BaseObject):
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ num_tokens_per_chunk: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param id: The strategy used for the AI agent for calculating embeddings., defaults to None
+ :type id: Optional[str], optional
+ :param num_tokens_per_chunk: The number of tokens per chunk., defaults to None
+ :type num_tokens_per_chunk: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.num_tokens_per_chunk = num_tokens_per_chunk
+
+
+class AiAgentLongTextToolEmbeddingsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ model: Optional[str] = None,
+ strategy: Optional[AiAgentLongTextToolEmbeddingsStrategyField] = None,
+ **kwargs
+ ):
+ """
+ :param model: The model used for the AI agent for calculating embeddings., defaults to None
+ :type model: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.model = model
+ self.strategy = strategy
+
+
+class AiAgentLongTextTool(AiAgentBasicTextTool):
+ def __init__(
+ self,
+ *,
+ embeddings: Optional[AiAgentLongTextToolEmbeddingsField] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param system_message: System messages try to help the LLM "understand" its role and what it is supposed to do., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+ When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`.
+ `{current_date}` is optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.embeddings = embeddings
diff --git a/box_sdk_gen/schemas/ai_agent_long_text_tool_text_gen.py b/box_sdk_gen/schemas/ai_agent_long_text_tool_text_gen.py
new file mode 100644
index 000000000..445162945
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_long_text_tool_text_gen.py
@@ -0,0 +1,94 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_text_gen import (
+ AiAgentBasicTextToolTextGen,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentLongTextToolTextGenEmbeddingsStrategyField(BaseObject):
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ num_tokens_per_chunk: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param id: The strategy used for the AI agent for calculating embeddings., defaults to None
+ :type id: Optional[str], optional
+ :param num_tokens_per_chunk: The number of tokens per chunk., defaults to None
+ :type num_tokens_per_chunk: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.num_tokens_per_chunk = num_tokens_per_chunk
+
+
+class AiAgentLongTextToolTextGenEmbeddingsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ model: Optional[str] = None,
+ strategy: Optional[AiAgentLongTextToolTextGenEmbeddingsStrategyField] = None,
+ **kwargs
+ ):
+ """
+ :param model: The model used for the AI agent for calculating embeddings., defaults to None
+ :type model: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.model = model
+ self.strategy = strategy
+
+
+class AiAgentLongTextToolTextGen(AiAgentBasicTextToolTextGen):
+ def __init__(
+ self,
+ *,
+ embeddings: Optional[AiAgentLongTextToolTextGenEmbeddingsField] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param system_message: System messages aim at helping the LLM understand its role and what it is supposed to do.
+ The input for `{current_date}` is optional, depending on the use., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+
+ When using the `prompt_template` parameter, you **must include** input for `{user_question}`.
+ Inputs for `{current_date}` and `{content}` are optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.embeddings = embeddings
diff --git a/box_sdk_gen/schemas/ai_agent_reference.py b/box_sdk_gen/schemas/ai_agent_reference.py
new file mode 100644
index 000000000..bf961999e
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_reference.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentReferenceTypeField(str, Enum):
+ AI_AGENT_ID = 'ai_agent_id'
+
+
+class AiAgentReference(BaseObject):
+ _discriminator = 'type', {'ai_agent_id'}
+
+ def __init__(
+ self,
+ *,
+ type: AiAgentReferenceTypeField = AiAgentReferenceTypeField.AI_AGENT_ID,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of AI agent used to handle queries., defaults to AiAgentReferenceTypeField.AI_AGENT_ID
+ :type type: AiAgentReferenceTypeField, optional
+ :param id: The ID of an Agent., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
diff --git a/box_sdk_gen/schemas/ai_agent_spreadsheet_tool.py b/box_sdk_gen/schemas/ai_agent_spreadsheet_tool.py
new file mode 100644
index 000000000..fe7942124
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_spreadsheet_tool.py
@@ -0,0 +1,36 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentSpreadsheetTool(BaseObject):
+ def __init__(
+ self,
+ *,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param model: The model used for the AI agent for spreadsheets. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.model = model
+ self.num_tokens_for_completion = num_tokens_for_completion
+ self.llm_endpoint_params = llm_endpoint_params
diff --git a/box_sdk_gen/schemas/ai_agent_text_gen.py b/box_sdk_gen/schemas/ai_agent_text_gen.py
new file mode 100644
index 000000000..2b788eafe
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_agent_text_gen.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_agent_basic_gen_tool import AiAgentBasicGenTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAgentTextGenTypeField(str, Enum):
+ AI_AGENT_TEXT_GEN = 'ai_agent_text_gen'
+
+
+class AiAgentTextGen(BaseObject):
+ _discriminator = 'type', {'ai_agent_text_gen'}
+
+ def __init__(
+ self,
+ *,
+ type: AiAgentTextGenTypeField = AiAgentTextGenTypeField.AI_AGENT_TEXT_GEN,
+ basic_gen: Optional[AiAgentBasicGenTool] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of AI agent used for generating text., defaults to AiAgentTextGenTypeField.AI_AGENT_TEXT_GEN
+ :type type: AiAgentTextGenTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.basic_gen = basic_gen
diff --git a/box_sdk_gen/schemas/ai_ask.py b/box_sdk_gen/schemas/ai_ask.py
new file mode 100644
index 000000000..398b58d6a
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_ask.py
@@ -0,0 +1,64 @@
+from enum import Enum
+
+from typing import List
+
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_item_ask import AiItemAsk
+
+from box_sdk_gen.schemas.ai_dialogue_history import AiDialogueHistory
+
+from box_sdk_gen.schemas.ai_agent_ask import AiAgentAsk
+
+from box_sdk_gen.schemas.ai_agent_reference import AiAgentReference
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiAskModeField(str, Enum):
+ MULTIPLE_ITEM_QA = 'multiple_item_qa'
+ SINGLE_ITEM_QA = 'single_item_qa'
+
+
+class AiAsk(BaseObject):
+ def __init__(
+ self,
+ mode: AiAskModeField,
+ prompt: str,
+ items: List[AiItemAsk],
+ *,
+ dialogue_history: Optional[List[AiDialogueHistory]] = None,
+ include_citations: Optional[bool] = None,
+ ai_agent: Optional[Union[AiAgentAsk, AiAgentReference]] = None,
+ **kwargs
+ ):
+ """
+ :param mode: Box AI handles text documents with text representations up to 1MB in size, or a maximum of 25 files,
+ whichever comes first. If the text file size exceeds 1MB, the first 1MB of text representation will be processed.
+ Box AI handles image documents with a resolution of 1024 x 1024 pixels, with a maximum of 5 images or 5 pages
+ for multi-page images. If the number of image or image pages exceeds 5, the first 5 images or pages will
+ be processed. If you set mode parameter to `single_item_qa`, the items array can have one element only.
+ Currently Box AI does not support multi-modal requests. If both images and text are sent Box AI will only
+ process the text.
+ :type mode: AiAskModeField
+ :param prompt: The prompt provided by the client to be answered by the LLM.
+ The prompt's length is limited to 10000 characters.
+ :type prompt: str
+ :param items: The items to be processed by the LLM, often files.
+ :type items: List[AiItemAsk]
+ :param dialogue_history: The history of prompts and answers previously passed to the LLM. This provides additional context to the LLM in generating the response., defaults to None
+ :type dialogue_history: Optional[List[AiDialogueHistory]], optional
+ :param include_citations: A flag to indicate whether citations should be returned., defaults to None
+ :type include_citations: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.mode = mode
+ self.prompt = prompt
+ self.items = items
+ self.dialogue_history = dialogue_history
+ self.include_citations = include_citations
+ self.ai_agent = ai_agent
diff --git a/box_sdk_gen/schemas/ai_citation.py b/box_sdk_gen/schemas/ai_citation.py
new file mode 100644
index 000000000..b90376e95
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_citation.py
@@ -0,0 +1,40 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiCitationTypeField(str, Enum):
+ FILE = 'file'
+
+
+class AiCitation(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ *,
+ content: Optional[str] = None,
+ id: Optional[str] = None,
+ type: Optional[AiCitationTypeField] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param content: The specific content from where the answer was referenced., defaults to None
+ :type content: Optional[str], optional
+ :param id: The id of the item., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the item., defaults to None
+ :type type: Optional[AiCitationTypeField], optional
+ :param name: The name of the item., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.content = content
+ self.id = id
+ self.type = type
+ self.name = name
diff --git a/box_sdk_gen/schemas/ai_dialogue_history.py b/box_sdk_gen/schemas/ai_dialogue_history.py
new file mode 100644
index 000000000..778304ef7
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_dialogue_history.py
@@ -0,0 +1,30 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class AiDialogueHistory(BaseObject):
+ def __init__(
+ self,
+ *,
+ prompt: Optional[str] = None,
+ answer: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param prompt: The prompt previously provided by the client and answered by the LLM., defaults to None
+ :type prompt: Optional[str], optional
+ :param answer: The answer previously provided by the LLM., defaults to None
+ :type answer: Optional[str], optional
+ :param created_at: The ISO date formatted timestamp of when the previous answer to the prompt was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.prompt = prompt
+ self.answer = answer
+ self.created_at = created_at
diff --git a/box_sdk_gen/schemas/ai_extract.py b/box_sdk_gen/schemas/ai_extract.py
new file mode 100644
index 000000000..13096e498
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_extract.py
@@ -0,0 +1,36 @@
+from typing import List
+
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_item_base import AiItemBase
+
+from box_sdk_gen.schemas.ai_agent_reference import AiAgentReference
+
+from box_sdk_gen.schemas.ai_agent_extract import AiAgentExtract
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiExtract(BaseObject):
+ def __init__(
+ self,
+ prompt: str,
+ items: List[AiItemBase],
+ *,
+ ai_agent: Optional[Union[AiAgentReference, AiAgentExtract]] = None,
+ **kwargs
+ ):
+ """
+ :param prompt: The prompt provided to a Large Language Model (LLM) in the request. The prompt can be up to 10000 characters long and it can be an XML or a JSON schema.
+ :type prompt: str
+ :param items: The items that LLM will process. Currently, you can use files only.
+ :type items: List[AiItemBase]
+ """
+ super().__init__(**kwargs)
+ self.prompt = prompt
+ self.items = items
+ self.ai_agent = ai_agent
diff --git a/box_sdk_gen/schemas/ai_extract_response.py b/box_sdk_gen/schemas/ai_extract_response.py
new file mode 100644
index 000000000..e18207b35
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_extract_response.py
@@ -0,0 +1,8 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiExtractResponse(BaseObject):
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
diff --git a/box_sdk_gen/schemas/ai_extract_structured.py b/box_sdk_gen/schemas/ai_extract_structured.py
new file mode 100644
index 000000000..46d6e96ac
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_extract_structured.py
@@ -0,0 +1,134 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from typing import Union
+
+from box_sdk_gen.schemas.ai_item_base import AiItemBase
+
+from box_sdk_gen.schemas.ai_agent_reference import AiAgentReference
+
+from box_sdk_gen.schemas.ai_agent_extract_structured import AiAgentExtractStructured
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiExtractStructuredMetadataTemplateTypeField(str, Enum):
+ METADATA_TEMPLATE = 'metadata_template'
+
+
+class AiExtractStructuredMetadataTemplateField(BaseObject):
+ _discriminator = 'type', {'metadata_template'}
+
+ def __init__(
+ self,
+ *,
+ template_key: Optional[str] = None,
+ type: Optional[AiExtractStructuredMetadataTemplateTypeField] = None,
+ scope: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param template_key: The name of the metadata template., defaults to None
+ :type template_key: Optional[str], optional
+ :param type: Value is always `metadata_template`., defaults to None
+ :type type: Optional[AiExtractStructuredMetadataTemplateTypeField], optional
+ :param scope: The scope of the metadata template that can either be global or
+ enterprise.
+ * The **global** scope is used for templates that are
+ available to any Box enterprise.
+ * The **enterprise** scope represents templates created within a specific enterprise,
+ containing the ID of that enterprise., defaults to None
+ :type scope: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.template_key = template_key
+ self.type = type
+ self.scope = scope
+
+
+class AiExtractStructuredFieldsOptionsField(BaseObject):
+ def __init__(self, key: str, **kwargs):
+ """
+ :param key: A unique identifier for the field.
+ :type key: str
+ """
+ super().__init__(**kwargs)
+ self.key = key
+
+
+class AiExtractStructuredFieldsField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'display_name': 'displayName',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'displayName': 'display_name',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ key: str,
+ *,
+ description: Optional[str] = None,
+ display_name: Optional[str] = None,
+ prompt: Optional[str] = None,
+ type: Optional[str] = None,
+ options: Optional[List[AiExtractStructuredFieldsOptionsField]] = None,
+ **kwargs
+ ):
+ """
+ :param key: A unique identifier for the field.
+ :type key: str
+ :param description: A description of the field., defaults to None
+ :type description: Optional[str], optional
+ :param display_name: The display name of the field., defaults to None
+ :type display_name: Optional[str], optional
+ :param prompt: The context about the key that may include how to find and format it., defaults to None
+ :type prompt: Optional[str], optional
+ :param type: The type of the field. It include but is not limited to string, float, date, enum, and multiSelect., defaults to None
+ :type type: Optional[str], optional
+ :param options: A list of options for this field. This is most often used in combination with the enum and multiSelect field types., defaults to None
+ :type options: Optional[List[AiExtractStructuredFieldsOptionsField]], optional
+ """
+ super().__init__(**kwargs)
+ self.key = key
+ self.description = description
+ self.display_name = display_name
+ self.prompt = prompt
+ self.type = type
+ self.options = options
+
+
+class AiExtractStructured(BaseObject):
+ def __init__(
+ self,
+ items: List[AiItemBase],
+ *,
+ metadata_template: Optional[AiExtractStructuredMetadataTemplateField] = None,
+ fields: Optional[List[AiExtractStructuredFieldsField]] = None,
+ ai_agent: Optional[Union[AiAgentReference, AiAgentExtractStructured]] = None,
+ **kwargs
+ ):
+ """
+ :param items: The items to be processed by the LLM. Currently you can use files only.
+ :type items: List[AiItemBase]
+ :param metadata_template: The metadata template containing the fields to extract.
+ For your request to work, you must provide either `metadata_template` or `fields`, but not both., defaults to None
+ :type metadata_template: Optional[AiExtractStructuredMetadataTemplateField], optional
+ :param fields: The fields to be extracted from the provided items.
+ For your request to work, you must provide either `metadata_template` or `fields`, but not both., defaults to None
+ :type fields: Optional[List[AiExtractStructuredFieldsField]], optional
+ """
+ super().__init__(**kwargs)
+ self.items = items
+ self.metadata_template = metadata_template
+ self.fields = fields
+ self.ai_agent = ai_agent
diff --git a/box_sdk_gen/schemas/ai_extract_structured_response.py b/box_sdk_gen/schemas/ai_extract_structured_response.py
new file mode 100644
index 000000000..9c9e7f3ed
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_extract_structured_response.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_extract_response import AiExtractResponse
+
+from box_sdk_gen.schemas.ai_agent_info import AiAgentInfo
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class AiExtractStructuredResponse(BaseObject):
+ def __init__(
+ self,
+ answer: AiExtractResponse,
+ created_at: DateTime,
+ *,
+ completion_reason: Optional[str] = None,
+ ai_agent_info: Optional[AiAgentInfo] = None,
+ **kwargs
+ ):
+ """
+ :param created_at: The ISO date formatted timestamp of when the answer to the prompt was created.
+ :type created_at: DateTime
+ :param completion_reason: The reason the response finishes., defaults to None
+ :type completion_reason: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.answer = answer
+ self.created_at = created_at
+ self.completion_reason = completion_reason
+ self.ai_agent_info = ai_agent_info
diff --git a/box_sdk_gen/schemas/ai_item_ask.py b/box_sdk_gen/schemas/ai_item_ask.py
new file mode 100644
index 000000000..d2702b88c
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_item_ask.py
@@ -0,0 +1,37 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiItemAskTypeField(str, Enum):
+ FILE = 'file'
+ HUBS = 'hubs'
+
+
+class AiItemAsk(BaseObject):
+ _discriminator = 'type', {'file', 'hubs'}
+
+ def __init__(
+ self,
+ id: str,
+ type: AiItemAskTypeField,
+ *,
+ content: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the file.
+ :type id: str
+ :param type: The type of the item. A `hubs` item must be used as a single item.
+ :type type: AiItemAskTypeField
+ :param content: The content of the item, often the text representation., defaults to None
+ :type content: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.content = content
diff --git a/box_sdk_gen/schemas/ai_item_base.py b/box_sdk_gen/schemas/ai_item_base.py
new file mode 100644
index 000000000..53cd81822
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_item_base.py
@@ -0,0 +1,36 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiItemBaseTypeField(str, Enum):
+ FILE = 'file'
+
+
+class AiItemBase(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: AiItemBaseTypeField = AiItemBaseTypeField.FILE,
+ content: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the file.
+ :type id: str
+ :param type: The type of the item. Currently the value can be `file` only., defaults to AiItemBaseTypeField.FILE
+ :type type: AiItemBaseTypeField, optional
+ :param content: The content of the item, often the text representation., defaults to None
+ :type content: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.content = content
diff --git a/box_sdk_gen/schemas/ai_llm_endpoint_params.py b/box_sdk_gen/schemas/ai_llm_endpoint_params.py
new file mode 100644
index 000000000..3425b0cd3
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_llm_endpoint_params.py
@@ -0,0 +1,18 @@
+from typing import Union
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+AiLlmEndpointParams = Union[
+ AiLlmEndpointParamsOpenAi,
+ AiLlmEndpointParamsGoogle,
+ AiLlmEndpointParamsAws,
+ AiLlmEndpointParamsIbm,
+]
diff --git a/box_sdk_gen/schemas/ai_llm_endpoint_params_aws.py b/box_sdk_gen/schemas/ai_llm_endpoint_params_aws.py
new file mode 100644
index 000000000..c7ee05318
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_llm_endpoint_params_aws.py
@@ -0,0 +1,41 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiLlmEndpointParamsAwsTypeField(str, Enum):
+ AWS_PARAMS = 'aws_params'
+
+
+class AiLlmEndpointParamsAws(BaseObject):
+ _discriminator = 'type', {'aws_params'}
+
+ def __init__(
+ self,
+ *,
+ type: AiLlmEndpointParamsAwsTypeField = AiLlmEndpointParamsAwsTypeField.AWS_PARAMS,
+ temperature: Optional[float] = None,
+ top_p: Optional[float] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of the AI LLM endpoint params object for AWS.
+ This parameter is **required**., defaults to AiLlmEndpointParamsAwsTypeField.AWS_PARAMS
+ :type type: AiLlmEndpointParamsAwsTypeField, optional
+ :param temperature: What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output more random,
+ while lower values like 0.2 will make it more focused and deterministic.
+ We generally recommend altering this or `top_p` but not both., defaults to None
+ :type temperature: Optional[float], optional
+ :param top_p: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results
+ of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability
+ mass are considered. We generally recommend altering this or temperature but not both., defaults to None
+ :type top_p: Optional[float], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.temperature = temperature
+ self.top_p = top_p
diff --git a/box_sdk_gen/schemas/ai_llm_endpoint_params_google.py b/box_sdk_gen/schemas/ai_llm_endpoint_params_google.py
new file mode 100644
index 000000000..b30f28f4b
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_llm_endpoint_params_google.py
@@ -0,0 +1,43 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiLlmEndpointParamsGoogleTypeField(str, Enum):
+ GOOGLE_PARAMS = 'google_params'
+
+
+class AiLlmEndpointParamsGoogle(BaseObject):
+ _discriminator = 'type', {'google_params'}
+
+ def __init__(
+ self,
+ *,
+ type: AiLlmEndpointParamsGoogleTypeField = AiLlmEndpointParamsGoogleTypeField.GOOGLE_PARAMS,
+ temperature: Optional[float] = None,
+ top_p: Optional[float] = None,
+ top_k: Optional[float] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of the AI LLM endpoint params object for Google.
+ This parameter is **required**., defaults to AiLlmEndpointParamsGoogleTypeField.GOOGLE_PARAMS
+ :type type: AiLlmEndpointParamsGoogleTypeField, optional
+ :param temperature: The temperature is used for sampling during response generation, which occurs when `top-P` and `top-K` are applied. Temperature controls the degree of randomness in the token selection., defaults to None
+ :type temperature: Optional[float], optional
+ :param top_p: `Top-P` changes how the model selects tokens for output. Tokens are selected from the most (see `top-K`) to least probable until the sum of their probabilities equals the `top-P` value., defaults to None
+ :type top_p: Optional[float], optional
+ :param top_k: `Top-K` changes how the model selects tokens for output. A low `top-K` means the next selected token is
+ the most probable among all tokens in the model's vocabulary (also called greedy decoding),
+ while a high `top-K` means that the next token is selected from among the three most probable tokens by using temperature., defaults to None
+ :type top_k: Optional[float], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.temperature = temperature
+ self.top_p = top_p
+ self.top_k = top_k
diff --git a/box_sdk_gen/schemas/ai_llm_endpoint_params_ibm.py b/box_sdk_gen/schemas/ai_llm_endpoint_params_ibm.py
new file mode 100644
index 000000000..851bd34fe
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_llm_endpoint_params_ibm.py
@@ -0,0 +1,47 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiLlmEndpointParamsIbmTypeField(str, Enum):
+ IBM_PARAMS = 'ibm_params'
+
+
+class AiLlmEndpointParamsIbm(BaseObject):
+ _discriminator = 'type', {'ibm_params'}
+
+ def __init__(
+ self,
+ *,
+ type: AiLlmEndpointParamsIbmTypeField = AiLlmEndpointParamsIbmTypeField.IBM_PARAMS,
+ temperature: Optional[float] = None,
+ top_p: Optional[float] = None,
+ top_k: Optional[float] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of the AI LLM endpoint params object for IBM.
+ This parameter is **required**., defaults to AiLlmEndpointParamsIbmTypeField.IBM_PARAMS
+ :type type: AiLlmEndpointParamsIbmTypeField, optional
+ :param temperature: What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output more random,
+ while lower values like 0.2 will make it more focused and deterministic.
+ We generally recommend altering this or `top_p` but not both., defaults to None
+ :type temperature: Optional[float], optional
+ :param top_p: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results
+ of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability
+ mass are considered. We generally recommend altering this or temperature but not both., defaults to None
+ :type top_p: Optional[float], optional
+ :param top_k: `Top-K` changes how the model selects tokens for output. A low `top-K` means the next selected token is
+ the most probable among all tokens in the model's vocabulary (also called greedy decoding),
+ while a high `top-K` means that the next token is selected from among the three most probable tokens by using temperature., defaults to None
+ :type top_k: Optional[float], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.temperature = temperature
+ self.top_p = top_p
+ self.top_k = top_k
diff --git a/box_sdk_gen/schemas/ai_llm_endpoint_params_open_ai.py b/box_sdk_gen/schemas/ai_llm_endpoint_params_open_ai.py
new file mode 100644
index 000000000..77264f885
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_llm_endpoint_params_open_ai.py
@@ -0,0 +1,54 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiLlmEndpointParamsOpenAiTypeField(str, Enum):
+ OPENAI_PARAMS = 'openai_params'
+
+
+class AiLlmEndpointParamsOpenAi(BaseObject):
+ _discriminator = 'type', {'openai_params'}
+
+ def __init__(
+ self,
+ *,
+ type: AiLlmEndpointParamsOpenAiTypeField = AiLlmEndpointParamsOpenAiTypeField.OPENAI_PARAMS,
+ temperature: Optional[float] = None,
+ top_p: Optional[float] = None,
+ frequency_penalty: Optional[float] = None,
+ presence_penalty: Optional[float] = None,
+ stop: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of the AI LLM endpoint params object for OpenAI.
+ This parameter is **required**., defaults to AiLlmEndpointParamsOpenAiTypeField.OPENAI_PARAMS
+ :type type: AiLlmEndpointParamsOpenAiTypeField, optional
+ :param temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
+ while lower values like 0.2 will make it more focused and deterministic.
+ We generally recommend altering this or `top_p` but not both., defaults to None
+ :type temperature: Optional[float], optional
+ :param top_p: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results
+ of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability
+ mass are considered. We generally recommend altering this or temperature but not both., defaults to None
+ :type top_p: Optional[float], optional
+ :param frequency_penalty: A number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the
+ text so far, decreasing the model's likelihood to repeat the same line verbatim., defaults to None
+ :type frequency_penalty: Optional[float], optional
+ :param presence_penalty: A number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics., defaults to None
+ :type presence_penalty: Optional[float], optional
+ :param stop: Up to 4 sequences where the API will stop generating further tokens., defaults to None
+ :type stop: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.temperature = temperature
+ self.top_p = top_p
+ self.frequency_penalty = frequency_penalty
+ self.presence_penalty = presence_penalty
+ self.stop = stop
diff --git a/box_sdk_gen/schemas/ai_multiple_agent_response.py b/box_sdk_gen/schemas/ai_multiple_agent_response.py
new file mode 100644
index 000000000..fad0593d5
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_multiple_agent_response.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_single_agent_response_full import AiSingleAgentResponseFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiMultipleAgentResponse(BaseObject):
+ def __init__(
+ self,
+ entries: List[AiSingleAgentResponseFull],
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: The list of AI Agents.
+ :type entries: List[AiSingleAgentResponseFull]
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
diff --git a/box_sdk_gen/schemas/ai_response.py b/box_sdk_gen/schemas/ai_response.py
new file mode 100644
index 000000000..ff59efbc3
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_response.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_agent_info import AiAgentInfo
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class AiResponse(BaseObject):
+ def __init__(
+ self,
+ answer: str,
+ created_at: DateTime,
+ *,
+ completion_reason: Optional[str] = None,
+ ai_agent_info: Optional[AiAgentInfo] = None,
+ **kwargs
+ ):
+ """
+ :param answer: The answer provided by the LLM.
+ :type answer: str
+ :param created_at: The ISO date formatted timestamp of when the answer to the prompt was created.
+ :type created_at: DateTime
+ :param completion_reason: The reason the response finishes., defaults to None
+ :type completion_reason: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.answer = answer
+ self.created_at = created_at
+ self.completion_reason = completion_reason
+ self.ai_agent_info = ai_agent_info
diff --git a/box_sdk_gen/schemas/ai_response_full.py b/box_sdk_gen/schemas/ai_response_full.py
new file mode 100644
index 000000000..7c9a1c89f
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_response_full.py
@@ -0,0 +1,44 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.ai_agent_info import AiAgentInfo
+
+from box_sdk_gen.schemas.ai_response import AiResponse
+
+from box_sdk_gen.schemas.ai_citation import AiCitation
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiResponseFull(AiResponse):
+ def __init__(
+ self,
+ answer: str,
+ created_at: DateTime,
+ *,
+ citations: Optional[List[AiCitation]] = None,
+ completion_reason: Optional[str] = None,
+ ai_agent_info: Optional[AiAgentInfo] = None,
+ **kwargs
+ ):
+ """
+ :param answer: The answer provided by the LLM.
+ :type answer: str
+ :param created_at: The ISO date formatted timestamp of when the answer to the prompt was created.
+ :type created_at: DateTime
+ :param citations: The citations of the LLM's answer reference., defaults to None
+ :type citations: Optional[List[AiCitation]], optional
+ :param completion_reason: The reason the response finishes., defaults to None
+ :type completion_reason: Optional[str], optional
+ """
+ super().__init__(
+ answer=answer,
+ created_at=created_at,
+ completion_reason=completion_reason,
+ ai_agent_info=ai_agent_info,
+ **kwargs
+ )
+ self.citations = citations
diff --git a/box_sdk_gen/schemas/ai_single_agent_response.py b/box_sdk_gen/schemas/ai_single_agent_response.py
new file mode 100644
index 000000000..e7d778b18
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_single_agent_response.py
@@ -0,0 +1,78 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.group_base import GroupBase
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.schemas.ai_agent_allowed_entity import AiAgentAllowedEntity
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class AiSingleAgentResponseTypeField(str, Enum):
+ AI_AGENT = 'ai_agent'
+
+
+class AiSingleAgentResponse(BaseObject):
+ _discriminator = 'type', {'ai_agent'}
+
+ def __init__(
+ self,
+ id: str,
+ origin: str,
+ name: str,
+ access_state: str,
+ *,
+ type: Optional[AiSingleAgentResponseTypeField] = None,
+ created_by: Optional[UserBase] = None,
+ created_at: Optional[DateTime] = None,
+ modified_by: Optional[UserBase] = None,
+ modified_at: Optional[DateTime] = None,
+ icon_reference: Optional[str] = None,
+ allowed_entities: Optional[List[AiAgentAllowedEntity]] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier of the AI Agent.
+ :type id: str
+ :param origin: The provider of the AI Agent.
+ :type origin: str
+ :param name: The name of the AI Agent.
+ :type name: str
+ :param access_state: The state of the AI Agent. Possible values are: `enabled`, `disabled`, and `enabled_for_selected_users`.
+ :type access_state: str
+ :param type: The type of agent used to handle queries., defaults to None
+ :type type: Optional[AiSingleAgentResponseTypeField], optional
+ :param created_by: The user who created this agent., defaults to None
+ :type created_by: Optional[UserBase], optional
+ :param created_at: The ISO date-time formatted timestamp of when this AI agent was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_by: The user who most recently modified this agent., defaults to None
+ :type modified_by: Optional[UserBase], optional
+ :param modified_at: The ISO date-time formatted timestamp of when this AI agent was recently modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param icon_reference: The icon reference of the AI Agent., defaults to None
+ :type icon_reference: Optional[str], optional
+ :param allowed_entities: List of allowed users or groups., defaults to None
+ :type allowed_entities: Optional[List[AiAgentAllowedEntity]], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.origin = origin
+ self.name = name
+ self.access_state = access_state
+ self.type = type
+ self.created_by = created_by
+ self.created_at = created_at
+ self.modified_by = modified_by
+ self.modified_at = modified_at
+ self.icon_reference = icon_reference
+ self.allowed_entities = allowed_entities
diff --git a/box_sdk_gen/schemas/ai_single_agent_response_full.py b/box_sdk_gen/schemas/ai_single_agent_response_full.py
new file mode 100644
index 000000000..1898fd5e7
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_single_agent_response_full.py
@@ -0,0 +1,90 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.ai_single_agent_response import AiSingleAgentResponseTypeField
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.group_base import GroupBase
+
+from box_sdk_gen.schemas.ai_agent_allowed_entity import AiAgentAllowedEntity
+
+from box_sdk_gen.schemas.ai_single_agent_response import AiSingleAgentResponse
+
+from box_sdk_gen.schemas.ai_studio_agent_ask_response import AiStudioAgentAskResponse
+
+from box_sdk_gen.schemas.ai_studio_agent_text_gen_response import (
+ AiStudioAgentTextGenResponse,
+)
+
+from box_sdk_gen.schemas.ai_studio_agent_extract_response import (
+ AiStudioAgentExtractResponse,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiSingleAgentResponseFull(AiSingleAgentResponse):
+ def __init__(
+ self,
+ id: str,
+ origin: str,
+ name: str,
+ access_state: str,
+ *,
+ ask: Optional[AiStudioAgentAskResponse] = None,
+ text_gen: Optional[AiStudioAgentTextGenResponse] = None,
+ extract: Optional[AiStudioAgentExtractResponse] = None,
+ type: Optional[AiSingleAgentResponseTypeField] = None,
+ created_by: Optional[UserBase] = None,
+ created_at: Optional[DateTime] = None,
+ modified_by: Optional[UserBase] = None,
+ modified_at: Optional[DateTime] = None,
+ icon_reference: Optional[str] = None,
+ allowed_entities: Optional[List[AiAgentAllowedEntity]] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier of the AI Agent.
+ :type id: str
+ :param origin: The provider of the AI Agent.
+ :type origin: str
+ :param name: The name of the AI Agent.
+ :type name: str
+ :param access_state: The state of the AI Agent. Possible values are: `enabled`, `disabled`, and `enabled_for_selected_users`.
+ :type access_state: str
+ :param type: The type of agent used to handle queries., defaults to None
+ :type type: Optional[AiSingleAgentResponseTypeField], optional
+ :param created_by: The user who created this agent., defaults to None
+ :type created_by: Optional[UserBase], optional
+ :param created_at: The ISO date-time formatted timestamp of when this AI agent was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_by: The user who most recently modified this agent., defaults to None
+ :type modified_by: Optional[UserBase], optional
+ :param modified_at: The ISO date-time formatted timestamp of when this AI agent was recently modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param icon_reference: The icon reference of the AI Agent., defaults to None
+ :type icon_reference: Optional[str], optional
+ :param allowed_entities: List of allowed users or groups., defaults to None
+ :type allowed_entities: Optional[List[AiAgentAllowedEntity]], optional
+ """
+ super().__init__(
+ id=id,
+ origin=origin,
+ name=name,
+ access_state=access_state,
+ type=type,
+ created_by=created_by,
+ created_at=created_at,
+ modified_by=modified_by,
+ modified_at=modified_at,
+ icon_reference=icon_reference,
+ allowed_entities=allowed_entities,
+ **kwargs
+ )
+ self.ask = ask
+ self.text_gen = text_gen
+ self.extract = extract
diff --git a/box_sdk_gen/schemas/ai_studio_agent_ask.py b/box_sdk_gen/schemas/ai_studio_agent_ask.py
new file mode 100644
index 000000000..43f92b4d8
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_ask.py
@@ -0,0 +1,70 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_studio_agent_long_text_tool import AiStudioAgentLongTextTool
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool import (
+ AiStudioAgentBasicTextTool,
+)
+
+from box_sdk_gen.schemas.ai_studio_agent_spreadsheet_tool import (
+ AiStudioAgentSpreadsheetTool,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentAskTypeField(str, Enum):
+ AI_AGENT_ASK = 'ai_agent_ask'
+
+
+class AiStudioAgentAsk(BaseObject):
+ _discriminator = 'type', {'ai_agent_ask'}
+
+ def __init__(
+ self,
+ access_state: str,
+ description: str,
+ *,
+ type: AiStudioAgentAskTypeField = AiStudioAgentAskTypeField.AI_AGENT_ASK,
+ custom_instructions: Optional[str] = None,
+ suggested_questions: Optional[List[str]] = None,
+ long_text: Optional[AiStudioAgentLongTextTool] = None,
+ basic_text: Optional[AiStudioAgentBasicTextTool] = None,
+ basic_image: Optional[AiStudioAgentBasicTextTool] = None,
+ spreadsheet: Optional[AiStudioAgentSpreadsheetTool] = None,
+ long_text_multi: Optional[AiStudioAgentLongTextTool] = None,
+ basic_text_multi: Optional[AiStudioAgentBasicTextTool] = None,
+ basic_image_multi: Optional[AiStudioAgentBasicTextTool] = None,
+ **kwargs
+ ):
+ """
+ :param access_state: The state of the AI Agent capability. Possible values are: `enabled` and `disabled`.
+ :type access_state: str
+ :param description: The description of the AI agent.
+ :type description: str
+ :param type: The type of AI agent used to handle queries., defaults to AiStudioAgentAskTypeField.AI_AGENT_ASK
+ :type type: AiStudioAgentAskTypeField, optional
+ :param custom_instructions: Custom instructions for the AI agent., defaults to None
+ :type custom_instructions: Optional[str], optional
+ :param suggested_questions: Suggested questions for the AI agent. If null, suggested question will be generated. If empty, no suggested questions will be displayed., defaults to None
+ :type suggested_questions: Optional[List[str]], optional
+ """
+ super().__init__(**kwargs)
+ self.access_state = access_state
+ self.description = description
+ self.type = type
+ self.custom_instructions = custom_instructions
+ self.suggested_questions = suggested_questions
+ self.long_text = long_text
+ self.basic_text = basic_text
+ self.basic_image = basic_image
+ self.spreadsheet = spreadsheet
+ self.long_text_multi = long_text_multi
+ self.basic_text_multi = basic_text_multi
+ self.basic_image_multi = basic_image_multi
diff --git a/box_sdk_gen/schemas/ai_studio_agent_ask_response.py b/box_sdk_gen/schemas/ai_studio_agent_ask_response.py
new file mode 100644
index 000000000..89d100337
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_ask_response.py
@@ -0,0 +1,72 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_studio_agent_long_text_tool_response import (
+ AiStudioAgentLongTextToolResponse,
+)
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool_response import (
+ AiStudioAgentBasicTextToolResponse,
+)
+
+from box_sdk_gen.schemas.ai_studio_agent_spreadsheet_tool_response import (
+ AiStudioAgentSpreadsheetToolResponse,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentAskResponseTypeField(str, Enum):
+ AI_AGENT_ASK = 'ai_agent_ask'
+
+
+class AiStudioAgentAskResponse(BaseObject):
+ _discriminator = 'type', {'ai_agent_ask'}
+
+ def __init__(
+ self,
+ access_state: str,
+ description: str,
+ *,
+ type: AiStudioAgentAskResponseTypeField = AiStudioAgentAskResponseTypeField.AI_AGENT_ASK,
+ custom_instructions: Optional[str] = None,
+ suggested_questions: Optional[List[str]] = None,
+ long_text: Optional[AiStudioAgentLongTextToolResponse] = None,
+ basic_text: Optional[AiStudioAgentBasicTextToolResponse] = None,
+ basic_image: Optional[AiStudioAgentBasicTextToolResponse] = None,
+ spreadsheet: Optional[AiStudioAgentSpreadsheetToolResponse] = None,
+ long_text_multi: Optional[AiStudioAgentLongTextToolResponse] = None,
+ basic_text_multi: Optional[AiStudioAgentBasicTextToolResponse] = None,
+ basic_image_multi: Optional[AiStudioAgentBasicTextToolResponse] = None,
+ **kwargs
+ ):
+ """
+ :param access_state: The state of the AI Agent capability. Possible values are: `enabled` and `disabled`.
+ :type access_state: str
+ :param description: The description of the AI agent.
+ :type description: str
+ :param type: The type of AI agent used to ask questions., defaults to AiStudioAgentAskResponseTypeField.AI_AGENT_ASK
+ :type type: AiStudioAgentAskResponseTypeField, optional
+ :param custom_instructions: Custom instructions for the AI agent., defaults to None
+ :type custom_instructions: Optional[str], optional
+ :param suggested_questions: Suggested questions for the AI agent. If null, suggested question will be generated. If empty, no suggested questions will be displayed., defaults to None
+ :type suggested_questions: Optional[List[str]], optional
+ """
+ super().__init__(**kwargs)
+ self.access_state = access_state
+ self.description = description
+ self.type = type
+ self.custom_instructions = custom_instructions
+ self.suggested_questions = suggested_questions
+ self.long_text = long_text
+ self.basic_text = basic_text
+ self.basic_image = basic_image
+ self.spreadsheet = spreadsheet
+ self.long_text_multi = long_text_multi
+ self.basic_text_multi = basic_text_multi
+ self.basic_image_multi = basic_image_multi
diff --git a/box_sdk_gen/schemas/ai_studio_agent_basic_gen_tool.py b/box_sdk_gen/schemas/ai_studio_agent_basic_gen_tool.py
new file mode 100644
index 000000000..b3ed99e08
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_basic_gen_tool.py
@@ -0,0 +1,75 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_text_gen import (
+ AiAgentBasicTextToolTextGen,
+)
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import (
+ AiAgentLongTextToolTextGenEmbeddingsField,
+)
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import (
+ AiAgentLongTextToolTextGen,
+)
+
+from box_sdk_gen.schemas.ai_agent_basic_gen_tool import AiAgentBasicGenTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentBasicGenTool(AiAgentBasicGenTool):
+ def __init__(
+ self,
+ *,
+ is_custom_instructions_included: Optional[bool] = None,
+ content_template: Optional[str] = None,
+ embeddings: Optional[AiAgentLongTextToolTextGenEmbeddingsField] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param is_custom_instructions_included: True if system message contains custom instructions placeholder, false otherwise., defaults to None
+ :type is_custom_instructions_included: Optional[bool], optional
+ :param content_template: How the content should be included in a request to the LLM.
+ Input for `{content}` is optional, depending on the use., defaults to None
+ :type content_template: Optional[str], optional
+ :param system_message: System messages aim at helping the LLM understand its role and what it is supposed to do.
+ The input for `{current_date}` is optional, depending on the use., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+
+ When using the `prompt_template` parameter, you **must include** input for `{user_question}`.
+ Inputs for `{current_date}` and `{content}` are optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ content_template=content_template,
+ embeddings=embeddings,
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.is_custom_instructions_included = is_custom_instructions_included
diff --git a/box_sdk_gen/schemas/ai_studio_agent_basic_gen_tool_response.py b/box_sdk_gen/schemas/ai_studio_agent_basic_gen_tool_response.py
new file mode 100644
index 000000000..4e418497c
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_basic_gen_tool_response.py
@@ -0,0 +1,83 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_text_gen import (
+ AiAgentBasicTextToolTextGen,
+)
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import (
+ AiAgentLongTextToolTextGenEmbeddingsField,
+)
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import (
+ AiAgentLongTextToolTextGen,
+)
+
+from box_sdk_gen.schemas.ai_agent_basic_gen_tool import AiAgentBasicGenTool
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_gen_tool import AiStudioAgentBasicGenTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentBasicGenToolResponse(AiStudioAgentBasicGenTool):
+ def __init__(
+ self,
+ *,
+ warnings: Optional[List[str]] = None,
+ is_custom_instructions_included: Optional[bool] = None,
+ content_template: Optional[str] = None,
+ embeddings: Optional[AiAgentLongTextToolTextGenEmbeddingsField] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param warnings: Warnings concerning tool., defaults to None
+ :type warnings: Optional[List[str]], optional
+ :param is_custom_instructions_included: True if system message contains custom instructions placeholder, false otherwise., defaults to None
+ :type is_custom_instructions_included: Optional[bool], optional
+ :param content_template: How the content should be included in a request to the LLM.
+ Input for `{content}` is optional, depending on the use., defaults to None
+ :type content_template: Optional[str], optional
+ :param system_message: System messages aim at helping the LLM understand its role and what it is supposed to do.
+ The input for `{current_date}` is optional, depending on the use., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+
+ When using the `prompt_template` parameter, you **must include** input for `{user_question}`.
+ Inputs for `{current_date}` and `{content}` are optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ is_custom_instructions_included=is_custom_instructions_included,
+ content_template=content_template,
+ embeddings=embeddings,
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.warnings = warnings
diff --git a/box_sdk_gen/schemas/ai_studio_agent_basic_text_tool.py b/box_sdk_gen/schemas/ai_studio_agent_basic_text_tool.py
new file mode 100644
index 000000000..bb1435fe5
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_basic_text_tool.py
@@ -0,0 +1,54 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentBasicTextTool(AiAgentBasicTextTool):
+ def __init__(
+ self,
+ *,
+ is_custom_instructions_included: Optional[bool] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param is_custom_instructions_included: True if system message contains custom instructions placeholder, false otherwise., defaults to None
+ :type is_custom_instructions_included: Optional[bool], optional
+ :param system_message: System messages try to help the LLM "understand" its role and what it is supposed to do., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+ When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`.
+ `{current_date}` is optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.is_custom_instructions_included = is_custom_instructions_included
diff --git a/box_sdk_gen/schemas/ai_studio_agent_basic_text_tool_response.py b/box_sdk_gen/schemas/ai_studio_agent_basic_text_tool_response.py
new file mode 100644
index 000000000..47b4eaf25
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_basic_text_tool_response.py
@@ -0,0 +1,64 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool import (
+ AiStudioAgentBasicTextTool,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentBasicTextToolResponse(AiStudioAgentBasicTextTool):
+ def __init__(
+ self,
+ *,
+ warnings: Optional[List[str]] = None,
+ is_custom_instructions_included: Optional[bool] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param warnings: Warnings concerning tool., defaults to None
+ :type warnings: Optional[List[str]], optional
+ :param is_custom_instructions_included: True if system message contains custom instructions placeholder, false otherwise., defaults to None
+ :type is_custom_instructions_included: Optional[bool], optional
+ :param system_message: System messages try to help the LLM "understand" its role and what it is supposed to do., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+ When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`.
+ `{current_date}` is optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ is_custom_instructions_included=is_custom_instructions_included,
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.warnings = warnings
diff --git a/box_sdk_gen/schemas/ai_studio_agent_extract.py b/box_sdk_gen/schemas/ai_studio_agent_extract.py
new file mode 100644
index 000000000..1d090d2da
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_extract.py
@@ -0,0 +1,52 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_studio_agent_long_text_tool import AiStudioAgentLongTextTool
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool import (
+ AiStudioAgentBasicTextTool,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentExtractTypeField(str, Enum):
+ AI_AGENT_EXTRACT = 'ai_agent_extract'
+
+
+class AiStudioAgentExtract(BaseObject):
+ _discriminator = 'type', {'ai_agent_extract'}
+
+ def __init__(
+ self,
+ access_state: str,
+ description: str,
+ *,
+ type: AiStudioAgentExtractTypeField = AiStudioAgentExtractTypeField.AI_AGENT_EXTRACT,
+ custom_instructions: Optional[str] = None,
+ long_text: Optional[AiStudioAgentLongTextTool] = None,
+ basic_text: Optional[AiStudioAgentBasicTextTool] = None,
+ basic_image: Optional[AiStudioAgentBasicTextTool] = None,
+ **kwargs
+ ):
+ """
+ :param access_state: The state of the AI Agent capability. Possible values are: `enabled` and `disabled`.
+ :type access_state: str
+ :param description: The description of the AI agent.
+ :type description: str
+ :param type: The type of AI agent to be used for metadata extraction., defaults to AiStudioAgentExtractTypeField.AI_AGENT_EXTRACT
+ :type type: AiStudioAgentExtractTypeField, optional
+ :param custom_instructions: Custom instructions for the AI agent., defaults to None
+ :type custom_instructions: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.access_state = access_state
+ self.description = description
+ self.type = type
+ self.custom_instructions = custom_instructions
+ self.long_text = long_text
+ self.basic_text = basic_text
+ self.basic_image = basic_image
diff --git a/box_sdk_gen/schemas/ai_studio_agent_extract_response.py b/box_sdk_gen/schemas/ai_studio_agent_extract_response.py
new file mode 100644
index 000000000..81ee75993
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_extract_response.py
@@ -0,0 +1,54 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_studio_agent_long_text_tool_response import (
+ AiStudioAgentLongTextToolResponse,
+)
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool_response import (
+ AiStudioAgentBasicTextToolResponse,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentExtractResponseTypeField(str, Enum):
+ AI_AGENT_EXTRACT = 'ai_agent_extract'
+
+
+class AiStudioAgentExtractResponse(BaseObject):
+ _discriminator = 'type', {'ai_agent_extract'}
+
+ def __init__(
+ self,
+ access_state: str,
+ description: str,
+ *,
+ type: AiStudioAgentExtractResponseTypeField = AiStudioAgentExtractResponseTypeField.AI_AGENT_EXTRACT,
+ custom_instructions: Optional[str] = None,
+ long_text: Optional[AiStudioAgentLongTextToolResponse] = None,
+ basic_text: Optional[AiStudioAgentBasicTextToolResponse] = None,
+ basic_image: Optional[AiStudioAgentBasicTextToolResponse] = None,
+ **kwargs
+ ):
+ """
+ :param access_state: The state of the AI Agent capability. Possible values are: `enabled` and `disabled`.
+ :type access_state: str
+ :param description: The description of the AI agent.
+ :type description: str
+ :param type: The type of AI agent to be used for metadata extraction., defaults to AiStudioAgentExtractResponseTypeField.AI_AGENT_EXTRACT
+ :type type: AiStudioAgentExtractResponseTypeField, optional
+ :param custom_instructions: Custom instructions for the AI agent., defaults to None
+ :type custom_instructions: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.access_state = access_state
+ self.description = description
+ self.type = type
+ self.custom_instructions = custom_instructions
+ self.long_text = long_text
+ self.basic_text = basic_text
+ self.basic_image = basic_image
diff --git a/box_sdk_gen/schemas/ai_studio_agent_long_text_tool.py b/box_sdk_gen/schemas/ai_studio_agent_long_text_tool.py
new file mode 100644
index 000000000..5419f0b12
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_long_text_tool.py
@@ -0,0 +1,62 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool import (
+ AiAgentLongTextToolEmbeddingsField,
+)
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool import AiAgentLongTextTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentLongTextTool(AiAgentLongTextTool):
+ def __init__(
+ self,
+ *,
+ is_custom_instructions_included: Optional[bool] = None,
+ embeddings: Optional[AiAgentLongTextToolEmbeddingsField] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param is_custom_instructions_included: True if system message contains custom instructions placeholder, false otherwise., defaults to None
+ :type is_custom_instructions_included: Optional[bool], optional
+ :param system_message: System messages try to help the LLM "understand" its role and what it is supposed to do., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+ When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`.
+ `{current_date}` is optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ embeddings=embeddings,
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.is_custom_instructions_included = is_custom_instructions_included
diff --git a/box_sdk_gen/schemas/ai_studio_agent_long_text_tool_response.py b/box_sdk_gen/schemas/ai_studio_agent_long_text_tool_response.py
new file mode 100644
index 000000000..b521b3751
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_long_text_tool_response.py
@@ -0,0 +1,70 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
+
+from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool import (
+ AiAgentLongTextToolEmbeddingsField,
+)
+
+from box_sdk_gen.schemas.ai_agent_long_text_tool import AiAgentLongTextTool
+
+from box_sdk_gen.schemas.ai_studio_agent_long_text_tool import AiStudioAgentLongTextTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentLongTextToolResponse(AiStudioAgentLongTextTool):
+ def __init__(
+ self,
+ *,
+ warnings: Optional[List[str]] = None,
+ is_custom_instructions_included: Optional[bool] = None,
+ embeddings: Optional[AiAgentLongTextToolEmbeddingsField] = None,
+ system_message: Optional[str] = None,
+ prompt_template: Optional[str] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param warnings: Warnings concerning tool., defaults to None
+ :type warnings: Optional[List[str]], optional
+ :param is_custom_instructions_included: True if system message contains custom instructions placeholder, false otherwise., defaults to None
+ :type is_custom_instructions_included: Optional[bool], optional
+ :param system_message: System messages try to help the LLM "understand" its role and what it is supposed to do., defaults to None
+ :type system_message: Optional[str], optional
+ :param prompt_template: The prompt template contains contextual information of the request and the user prompt.
+ When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`.
+ `{current_date}` is optional, depending on the use., defaults to None
+ :type prompt_template: Optional[str], optional
+ :param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ is_custom_instructions_included=is_custom_instructions_included,
+ embeddings=embeddings,
+ system_message=system_message,
+ prompt_template=prompt_template,
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.warnings = warnings
diff --git a/box_sdk_gen/schemas/ai_studio_agent_spreadsheet_tool.py b/box_sdk_gen/schemas/ai_studio_agent_spreadsheet_tool.py
new file mode 100644
index 000000000..9d207998f
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_spreadsheet_tool.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_spreadsheet_tool import AiAgentSpreadsheetTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentSpreadsheetTool(AiAgentSpreadsheetTool):
+ def __init__(
+ self,
+ *,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param model: The model used for the AI agent for spreadsheets. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
diff --git a/box_sdk_gen/schemas/ai_studio_agent_spreadsheet_tool_response.py b/box_sdk_gen/schemas/ai_studio_agent_spreadsheet_tool_response.py
new file mode 100644
index 000000000..bf6323140
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_spreadsheet_tool_response.py
@@ -0,0 +1,48 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params_ibm import AiLlmEndpointParamsIbm
+
+from box_sdk_gen.schemas.ai_llm_endpoint_params import AiLlmEndpointParams
+
+from box_sdk_gen.schemas.ai_agent_spreadsheet_tool import AiAgentSpreadsheetTool
+
+from box_sdk_gen.schemas.ai_studio_agent_spreadsheet_tool import (
+ AiStudioAgentSpreadsheetTool,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentSpreadsheetToolResponse(AiStudioAgentSpreadsheetTool):
+ def __init__(
+ self,
+ *,
+ warnings: Optional[List[str]] = None,
+ model: Optional[str] = None,
+ num_tokens_for_completion: Optional[int] = None,
+ llm_endpoint_params: Optional[AiLlmEndpointParams] = None,
+ **kwargs
+ ):
+ """
+ :param warnings: Warnings concerning tool., defaults to None
+ :type warnings: Optional[List[str]], optional
+ :param model: The model used for the AI agent for spreadsheets. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
+ :type model: Optional[str], optional
+ :param num_tokens_for_completion: The number of tokens for completion., defaults to None
+ :type num_tokens_for_completion: Optional[int], optional
+ """
+ super().__init__(
+ model=model,
+ num_tokens_for_completion=num_tokens_for_completion,
+ llm_endpoint_params=llm_endpoint_params,
+ **kwargs
+ )
+ self.warnings = warnings
diff --git a/box_sdk_gen/schemas/ai_studio_agent_text_gen.py b/box_sdk_gen/schemas/ai_studio_agent_text_gen.py
new file mode 100644
index 000000000..c461a3761
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_text_gen.py
@@ -0,0 +1,50 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_gen_tool import AiStudioAgentBasicGenTool
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentTextGenTypeField(str, Enum):
+ AI_AGENT_TEXT_GEN = 'ai_agent_text_gen'
+
+
+class AiStudioAgentTextGen(BaseObject):
+ _discriminator = 'type', {'ai_agent_text_gen'}
+
+ def __init__(
+ self,
+ access_state: str,
+ description: str,
+ *,
+ type: AiStudioAgentTextGenTypeField = AiStudioAgentTextGenTypeField.AI_AGENT_TEXT_GEN,
+ custom_instructions: Optional[str] = None,
+ suggested_questions: Optional[List[str]] = None,
+ basic_gen: Optional[AiStudioAgentBasicGenTool] = None,
+ **kwargs
+ ):
+ """
+ :param access_state: The state of the AI Agent capability. Possible values are: `enabled` and `disabled`.
+ :type access_state: str
+ :param description: The description of the AI agent.
+ :type description: str
+ :param type: The type of AI agent used for generating text., defaults to AiStudioAgentTextGenTypeField.AI_AGENT_TEXT_GEN
+ :type type: AiStudioAgentTextGenTypeField, optional
+ :param custom_instructions: Custom instructions for the AI agent., defaults to None
+ :type custom_instructions: Optional[str], optional
+ :param suggested_questions: Suggested questions for the AI agent. If null, suggested question will be generated. If empty, no suggested questions will be displayed., defaults to None
+ :type suggested_questions: Optional[List[str]], optional
+ """
+ super().__init__(**kwargs)
+ self.access_state = access_state
+ self.description = description
+ self.type = type
+ self.custom_instructions = custom_instructions
+ self.suggested_questions = suggested_questions
+ self.basic_gen = basic_gen
diff --git a/box_sdk_gen/schemas/ai_studio_agent_text_gen_response.py b/box_sdk_gen/schemas/ai_studio_agent_text_gen_response.py
new file mode 100644
index 000000000..fdef65767
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_studio_agent_text_gen_response.py
@@ -0,0 +1,52 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.ai_studio_agent_basic_gen_tool_response import (
+ AiStudioAgentBasicGenToolResponse,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiStudioAgentTextGenResponseTypeField(str, Enum):
+ AI_AGENT_TEXT_GEN = 'ai_agent_text_gen'
+
+
+class AiStudioAgentTextGenResponse(BaseObject):
+ _discriminator = 'type', {'ai_agent_text_gen'}
+
+ def __init__(
+ self,
+ access_state: str,
+ description: str,
+ *,
+ type: AiStudioAgentTextGenResponseTypeField = AiStudioAgentTextGenResponseTypeField.AI_AGENT_TEXT_GEN,
+ custom_instructions: Optional[str] = None,
+ suggested_questions: Optional[List[str]] = None,
+ basic_gen: Optional[AiStudioAgentBasicGenToolResponse] = None,
+ **kwargs
+ ):
+ """
+ :param access_state: The state of the AI Agent capability. Possible values are: `enabled` and `disabled`.
+ :type access_state: str
+ :param description: The description of the AI agent.
+ :type description: str
+ :param type: The type of AI agent used for generating text., defaults to AiStudioAgentTextGenResponseTypeField.AI_AGENT_TEXT_GEN
+ :type type: AiStudioAgentTextGenResponseTypeField, optional
+ :param custom_instructions: Custom instructions for the AI agent., defaults to None
+ :type custom_instructions: Optional[str], optional
+ :param suggested_questions: Suggested questions for the AI agent. If null, suggested question will be generated. If empty, no suggested questions will be displayed., defaults to None
+ :type suggested_questions: Optional[List[str]], optional
+ """
+ super().__init__(**kwargs)
+ self.access_state = access_state
+ self.description = description
+ self.type = type
+ self.custom_instructions = custom_instructions
+ self.suggested_questions = suggested_questions
+ self.basic_gen = basic_gen
diff --git a/box_sdk_gen/schemas/ai_text_gen.py b/box_sdk_gen/schemas/ai_text_gen.py
new file mode 100644
index 000000000..1d62f7dcc
--- /dev/null
+++ b/box_sdk_gen/schemas/ai_text_gen.py
@@ -0,0 +1,75 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Union
+
+from box_sdk_gen.schemas.ai_dialogue_history import AiDialogueHistory
+
+from box_sdk_gen.schemas.ai_agent_reference import AiAgentReference
+
+from box_sdk_gen.schemas.ai_agent_text_gen import AiAgentTextGen
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AiTextGenItemsTypeField(str, Enum):
+ FILE = 'file'
+
+
+class AiTextGenItemsField(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: AiTextGenItemsTypeField = AiTextGenItemsTypeField.FILE,
+ content: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the item.
+ :type id: str
+ :param type: The type of the item., defaults to AiTextGenItemsTypeField.FILE
+ :type type: AiTextGenItemsTypeField, optional
+ :param content: The content to use as context for generating new text or editing existing text., defaults to None
+ :type content: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.content = content
+
+
+class AiTextGen(BaseObject):
+ def __init__(
+ self,
+ prompt: str,
+ items: List[AiTextGenItemsField],
+ *,
+ dialogue_history: Optional[List[AiDialogueHistory]] = None,
+ ai_agent: Optional[Union[AiAgentReference, AiAgentTextGen]] = None,
+ **kwargs
+ ):
+ """
+ :param prompt: The prompt provided by the client to be answered by the LLM. The prompt's length is limited to 10000 characters.
+ :type prompt: str
+ :param items: The items to be processed by the LLM, often files.
+ The array can include **exactly one** element.
+
+ **Note**: Box AI handles documents with text representations up to 1MB in size.
+ If the file size exceeds 1MB, the first 1MB of text representation will be processed.
+ :type items: List[AiTextGenItemsField]
+ :param dialogue_history: The history of prompts and answers previously passed to the LLM. This parameter provides the additional context to the LLM when generating the response., defaults to None
+ :type dialogue_history: Optional[List[AiDialogueHistory]], optional
+ """
+ super().__init__(**kwargs)
+ self.prompt = prompt
+ self.items = items
+ self.dialogue_history = dialogue_history
+ self.ai_agent = ai_agent
diff --git a/box_sdk_gen/schemas/app_item.py b/box_sdk_gen/schemas/app_item.py
new file mode 100644
index 000000000..d218c94e7
--- /dev/null
+++ b/box_sdk_gen/schemas/app_item.py
@@ -0,0 +1,34 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AppItemTypeField(str, Enum):
+ APP_ITEM = 'app_item'
+
+
+class AppItem(BaseObject):
+ _discriminator = 'type', {'app_item'}
+
+ def __init__(
+ self,
+ id: str,
+ application_type: str,
+ *,
+ type: AppItemTypeField = AppItemTypeField.APP_ITEM,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this app item.
+ :type id: str
+ :param application_type: The type of the app that owns this app item.
+ :type application_type: str
+ :param type: The value will always be `app_item`., defaults to AppItemTypeField.APP_ITEM
+ :type type: AppItemTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.application_type = application_type
+ self.type = type
diff --git a/box_sdk_gen/schemas/app_item_association.py b/box_sdk_gen/schemas/app_item_association.py
new file mode 100644
index 000000000..9981fae29
--- /dev/null
+++ b/box_sdk_gen/schemas/app_item_association.py
@@ -0,0 +1,44 @@
+from enum import Enum
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.app_item import AppItem
+
+from box_sdk_gen.schemas.file_base import FileBase
+
+from box_sdk_gen.schemas.folder_base import FolderBase
+
+from box_sdk_gen.schemas.web_link_base import WebLinkBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AppItemAssociationTypeField(str, Enum):
+ APP_ITEM_ASSOCIATION = 'app_item_association'
+
+
+class AppItemAssociation(BaseObject):
+ _discriminator = 'type', {'app_item_association'}
+
+ def __init__(
+ self,
+ id: str,
+ app_item: AppItem,
+ item: Union[FileBase, FolderBase, WebLinkBase],
+ *,
+ type: AppItemAssociationTypeField = AppItemAssociationTypeField.APP_ITEM_ASSOCIATION,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this app item association.
+ :type id: str
+ :param type: The value will always be `app_item_association`., defaults to AppItemAssociationTypeField.APP_ITEM_ASSOCIATION
+ :type type: AppItemAssociationTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.app_item = app_item
+ self.item = item
+ self.type = type
diff --git a/box_sdk_gen/schemas/app_item_associations.py b/box_sdk_gen/schemas/app_item_associations.py
new file mode 100644
index 000000000..4cb940a3b
--- /dev/null
+++ b/box_sdk_gen/schemas/app_item_associations.py
@@ -0,0 +1,36 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.app_item_association import AppItemAssociation
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AppItemAssociations(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[AppItemAssociation]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/app_item_event_source.py b/box_sdk_gen/schemas/app_item_event_source.py
new file mode 100644
index 000000000..640847d86
--- /dev/null
+++ b/box_sdk_gen/schemas/app_item_event_source.py
@@ -0,0 +1,44 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.group_mini import GroupMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class AppItemEventSourceTypeField(str, Enum):
+ APP_ITEM = 'app_item'
+
+
+class AppItemEventSource(BaseObject):
+ _discriminator = 'type', {'app_item'}
+
+ def __init__(
+ self,
+ id: str,
+ app_item_type: str,
+ *,
+ type: AppItemEventSourceTypeField = AppItemEventSourceTypeField.APP_ITEM,
+ user: Optional[UserMini] = None,
+ group: Optional[GroupMini] = None,
+ **kwargs
+ ):
+ """
+ :param id: The id of the `AppItem`.
+ :type id: str
+ :param app_item_type: The type of the `AppItem`.
+ :type app_item_type: str
+ :param type: The type of the source that this event represents. Can only be `app_item`., defaults to AppItemEventSourceTypeField.APP_ITEM
+ :type type: AppItemEventSourceTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.app_item_type = app_item_type
+ self.type = type
+ self.user = user
+ self.group = group
diff --git a/box_sdk_gen/schemas/classification.py b/box_sdk_gen/schemas/classification.py
new file mode 100644
index 000000000..54feab5c4
--- /dev/null
+++ b/box_sdk_gen/schemas/classification.py
@@ -0,0 +1,88 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ClassificationTemplateField(str, Enum):
+ SECURITYCLASSIFICATION_6VMVOCHWUWO = 'securityClassification-6VMVochwUWo'
+
+
+class Classification(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'box_security_classification_key': 'Box__Security__Classification__Key',
+ 'parent': '$parent',
+ 'template': '$template',
+ 'scope': '$scope',
+ 'version': '$version',
+ 'type': '$type',
+ 'type_version': '$typeVersion',
+ 'can_edit': '$canEdit',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'Box__Security__Classification__Key': 'box_security_classification_key',
+ '$parent': 'parent',
+ '$template': 'template',
+ '$scope': 'scope',
+ '$version': 'version',
+ '$type': 'type',
+ '$typeVersion': 'type_version',
+ '$canEdit': 'can_edit',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ box_security_classification_key: Optional[str] = None,
+ parent: Optional[str] = None,
+ template: Optional[ClassificationTemplateField] = None,
+ scope: Optional[str] = None,
+ version: Optional[int] = None,
+ type: Optional[str] = None,
+ type_version: Optional[float] = None,
+ can_edit: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param box_security_classification_key: The name of the classification applied to the item., defaults to None
+ :type box_security_classification_key: Optional[str], optional
+ :param parent: The identifier of the item that this metadata instance
+ has been attached to. This combines the `type` and the `id`
+ of the parent in the form `{type}_{id}`., defaults to None
+ :type parent: Optional[str], optional
+ :param template: The value will always be `securityClassification-6VMVochwUWo`., defaults to None
+ :type template: Optional[ClassificationTemplateField], optional
+ :param scope: The scope of the enterprise that this classification has been
+ applied for.
+
+ This will be in the format `enterprise_{enterprise_id}`., defaults to None
+ :type scope: Optional[str], optional
+ :param version: The version of the metadata instance. This version starts at 0 and
+ increases every time a classification is updated., defaults to None
+ :type version: Optional[int], optional
+ :param type: The unique ID of this classification instance. This will be include
+ the name of the classification template and a unique ID., defaults to None
+ :type type: Optional[str], optional
+ :param type_version: The version of the metadata template. This version starts at 0 and
+ increases every time the template is updated. This is mostly for internal
+ use., defaults to None
+ :type type_version: Optional[float], optional
+ :param can_edit: Whether an end user can change the classification., defaults to None
+ :type can_edit: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.box_security_classification_key = box_security_classification_key
+ self.parent = parent
+ self.template = template
+ self.scope = scope
+ self.version = version
+ self.type = type
+ self.type_version = type_version
+ self.can_edit = can_edit
diff --git a/box_sdk_gen/schemas/classification_template.py b/box_sdk_gen/schemas/classification_template.py
new file mode 100644
index 000000000..7bb03cb07
--- /dev/null
+++ b/box_sdk_gen/schemas/classification_template.py
@@ -0,0 +1,246 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ClassificationTemplateTypeField(str, Enum):
+ METADATA_TEMPLATE = 'metadata_template'
+
+
+class ClassificationTemplateTemplateKeyField(str, Enum):
+ SECURITYCLASSIFICATION_6VMVOCHWUWO = 'securityClassification-6VMVochwUWo'
+
+
+class ClassificationTemplateDisplayNameField(str, Enum):
+ CLASSIFICATION = 'Classification'
+
+
+class ClassificationTemplateFieldsTypeField(str, Enum):
+ ENUM = 'enum'
+
+
+class ClassificationTemplateFieldsKeyField(str, Enum):
+ BOX__SECURITY__CLASSIFICATION__KEY = 'Box__Security__Classification__Key'
+
+
+class ClassificationTemplateFieldsDisplayNameField(str, Enum):
+ CLASSIFICATION = 'Classification'
+
+
+class ClassificationTemplateFieldsOptionsStaticConfigClassificationField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'classification_definition': 'classificationDefinition',
+ 'color_id': 'colorID',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'classificationDefinition': 'classification_definition',
+ 'colorID': 'color_id',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ classification_definition: Optional[str] = None,
+ color_id: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param classification_definition: A longer description of the classification., defaults to None
+ :type classification_definition: Optional[str], optional
+ :param color_id: An internal Box identifier used to assign a color to
+ a classification label.
+
+ Mapping between a `colorID` and a color may change
+ without notice. Currently, the color mappings are as
+ follows.
+
+ * `0`: Yellow.
+ * `1`: Orange.
+ * `2`: Watermelon red.
+ * `3`: Purple rain.
+ * `4`: Light blue.
+ * `5`: Dark blue.
+ * `6`: Light green.
+ * `7`: Gray., defaults to None
+ :type color_id: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.classification_definition = classification_definition
+ self.color_id = color_id
+
+
+class ClassificationTemplateFieldsOptionsStaticConfigField(BaseObject):
+ def __init__(
+ self,
+ *,
+ classification: Optional[
+ ClassificationTemplateFieldsOptionsStaticConfigClassificationField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param classification: Additional information about the classification.
+
+ This is not an exclusive list of properties, and
+ more object fields might be returned. These fields
+ are used for internal Box Shield and Box Governance
+ purposes and no additional value must be derived from
+ these fields., defaults to None
+ :type classification: Optional[ClassificationTemplateFieldsOptionsStaticConfigClassificationField], optional
+ """
+ super().__init__(**kwargs)
+ self.classification = classification
+
+
+class ClassificationTemplateFieldsOptionsField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'static_config': 'staticConfig',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'staticConfig': 'static_config',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ id: str,
+ key: str,
+ *,
+ static_config: Optional[
+ ClassificationTemplateFieldsOptionsStaticConfigField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique ID of this classification.
+ :type id: str
+ :param key: The display name and key for this classification.
+ :type key: str
+ :param static_config: Additional information about the classification., defaults to None
+ :type static_config: Optional[ClassificationTemplateFieldsOptionsStaticConfigField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.key = key
+ self.static_config = static_config
+
+
+class ClassificationTemplateFieldsField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'display_name': 'displayName',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'displayName': 'display_name',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {'enum'}
+
+ def __init__(
+ self,
+ id: str,
+ options: List[ClassificationTemplateFieldsOptionsField],
+ *,
+ type: ClassificationTemplateFieldsTypeField = ClassificationTemplateFieldsTypeField.ENUM,
+ key: ClassificationTemplateFieldsKeyField = ClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY,
+ display_name: ClassificationTemplateFieldsDisplayNameField = ClassificationTemplateFieldsDisplayNameField.CLASSIFICATION,
+ hidden: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique ID of the field.
+ :type id: str
+ :param options: A list of classifications available in this enterprise.
+ :type options: List[ClassificationTemplateFieldsOptionsField]
+ :param type: The array item type., defaults to ClassificationTemplateFieldsTypeField.ENUM
+ :type type: ClassificationTemplateFieldsTypeField, optional
+ :param key: Defines classifications
+ available in the enterprise., defaults to ClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY
+ :type key: ClassificationTemplateFieldsKeyField, optional
+ :param display_name: The value will always be `Classification`., defaults to ClassificationTemplateFieldsDisplayNameField.CLASSIFICATION
+ :type display_name: ClassificationTemplateFieldsDisplayNameField, optional
+ :param hidden: Classifications are always visible to web and mobile users., defaults to None
+ :type hidden: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.options = options
+ self.type = type
+ self.key = key
+ self.display_name = display_name
+ self.hidden = hidden
+
+
+class ClassificationTemplate(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'template_key': 'templateKey',
+ 'display_name': 'displayName',
+ 'copy_instance_on_item_copy': 'copyInstanceOnItemCopy',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'templateKey': 'template_key',
+ 'displayName': 'display_name',
+ 'copyInstanceOnItemCopy': 'copy_instance_on_item_copy',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {'metadata_template'}
+
+ def __init__(
+ self,
+ id: str,
+ scope: str,
+ fields: List[ClassificationTemplateFieldsField],
+ *,
+ type: ClassificationTemplateTypeField = ClassificationTemplateTypeField.METADATA_TEMPLATE,
+ template_key: ClassificationTemplateTemplateKeyField = ClassificationTemplateTemplateKeyField.SECURITYCLASSIFICATION_6VMVOCHWUWO,
+ display_name: ClassificationTemplateDisplayNameField = ClassificationTemplateDisplayNameField.CLASSIFICATION,
+ hidden: Optional[bool] = None,
+ copy_instance_on_item_copy: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the classification template.
+ :type id: str
+ :param scope: The scope of the classification template. This is in the format
+ `enterprise_{id}` where the `id` is the enterprise ID.
+ :type scope: str
+ :param fields: A list of fields for this classification template. This includes
+ only one field, the `Box__Security__Classification__Key`, which defines
+ the different classifications available in this enterprise.
+ :type fields: List[ClassificationTemplateFieldsField]
+ :param type: The value will always be `metadata_template`., defaults to ClassificationTemplateTypeField.METADATA_TEMPLATE
+ :type type: ClassificationTemplateTypeField, optional
+ :param template_key: The value will always be `securityClassification-6VMVochwUWo`., defaults to ClassificationTemplateTemplateKeyField.SECURITYCLASSIFICATION_6VMVOCHWUWO
+ :type template_key: ClassificationTemplateTemplateKeyField, optional
+ :param display_name: The name of this template as shown in web and mobile interfaces., defaults to ClassificationTemplateDisplayNameField.CLASSIFICATION
+ :type display_name: ClassificationTemplateDisplayNameField, optional
+ :param hidden: Determines if the
+ template is always available in web and mobile interfaces., defaults to None
+ :type hidden: Optional[bool], optional
+ :param copy_instance_on_item_copy: Determines if
+ classifications are
+ copied along when the file or folder is
+ copied., defaults to None
+ :type copy_instance_on_item_copy: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.scope = scope
+ self.fields = fields
+ self.type = type
+ self.template_key = template_key
+ self.display_name = display_name
+ self.hidden = hidden
+ self.copy_instance_on_item_copy = copy_instance_on_item_copy
diff --git a/box_sdk_gen/schemas/client_error.py b/box_sdk_gen/schemas/client_error.py
new file mode 100644
index 000000000..fce9bae17
--- /dev/null
+++ b/box_sdk_gen/schemas/client_error.py
@@ -0,0 +1,77 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ClientErrorTypeField(str, Enum):
+ ERROR = 'error'
+
+
+class ClientErrorCodeField(str, Enum):
+ CREATED = 'created'
+ ACCEPTED = 'accepted'
+ NO_CONTENT = 'no_content'
+ REDIRECT = 'redirect'
+ NOT_MODIFIED = 'not_modified'
+ BAD_REQUEST = 'bad_request'
+ UNAUTHORIZED = 'unauthorized'
+ FORBIDDEN = 'forbidden'
+ NOT_FOUND = 'not_found'
+ METHOD_NOT_ALLOWED = 'method_not_allowed'
+ CONFLICT = 'conflict'
+ PRECONDITION_FAILED = 'precondition_failed'
+ TOO_MANY_REQUESTS = 'too_many_requests'
+ INTERNAL_SERVER_ERROR = 'internal_server_error'
+ UNAVAILABLE = 'unavailable'
+ ITEM_NAME_INVALID = 'item_name_invalid'
+ INSUFFICIENT_SCOPE = 'insufficient_scope'
+
+
+class ClientError(BaseObject):
+ _discriminator = 'type', {'error'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[ClientErrorTypeField] = None,
+ status: Optional[int] = None,
+ code: Optional[ClientErrorCodeField] = None,
+ message: Optional[str] = None,
+ context_info: Optional[Dict] = None,
+ help_url: Optional[str] = None,
+ request_id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `error`., defaults to None
+ :type type: Optional[ClientErrorTypeField], optional
+ :param status: The HTTP status of the response., defaults to None
+ :type status: Optional[int], optional
+ :param code: A Box-specific error code., defaults to None
+ :type code: Optional[ClientErrorCodeField], optional
+ :param message: A short message describing the error., defaults to None
+ :type message: Optional[str], optional
+ :param context_info: A free-form object that contains additional context
+ about the error. The possible fields are defined on
+ a per-endpoint basis. `message` is only one example., defaults to None
+ :type context_info: Optional[Dict], optional
+ :param help_url: A URL that links to more information about why this error occurred., defaults to None
+ :type help_url: Optional[str], optional
+ :param request_id: A unique identifier for this response, which can be used
+ when contacting Box support., defaults to None
+ :type request_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.status = status
+ self.code = code
+ self.message = message
+ self.context_info = context_info
+ self.help_url = help_url
+ self.request_id = request_id
diff --git a/box_sdk_gen/schemas/collaboration.py b/box_sdk_gen/schemas/collaboration.py
new file mode 100644
index 000000000..7d81fae09
--- /dev/null
+++ b/box_sdk_gen/schemas/collaboration.py
@@ -0,0 +1,220 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Union
+
+from box_sdk_gen.schemas.file import File
+
+from box_sdk_gen.schemas.folder import Folder
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.schemas.app_item import AppItem
+
+from box_sdk_gen.schemas.user_collaborations import UserCollaborations
+
+from box_sdk_gen.schemas.group_mini import GroupMini
+
+from box_sdk_gen.schemas.terms_of_service_base import TermsOfServiceBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class CollaborationTypeField(str, Enum):
+ COLLABORATION = 'collaboration'
+
+
+class CollaborationRoleField(str, Enum):
+ EDITOR = 'editor'
+ VIEWER = 'viewer'
+ PREVIEWER = 'previewer'
+ UPLOADER = 'uploader'
+ PREVIEWER_UPLOADER = 'previewer uploader'
+ VIEWER_UPLOADER = 'viewer uploader'
+ CO_OWNER = 'co-owner'
+ OWNER = 'owner'
+
+
+class CollaborationStatusField(str, Enum):
+ ACCEPTED = 'accepted'
+ PENDING = 'pending'
+ REJECTED = 'rejected'
+
+
+class CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField(
+ BaseObject
+):
+ def __init__(
+ self,
+ *,
+ is_accepted: Optional[bool] = None,
+ terms_of_service: Optional[TermsOfServiceBase] = None,
+ **kwargs
+ ):
+ """
+ :param is_accepted: Whether or not the terms of service have been accepted. The
+ field is `null` when there is no terms of service required., defaults to None
+ :type is_accepted: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.is_accepted = is_accepted
+ self.terms_of_service = terms_of_service
+
+
+class CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField(
+ BaseObject
+):
+ def __init__(
+ self,
+ *,
+ enterprise_has_strong_password_required_for_external_users: Optional[
+ bool
+ ] = None,
+ user_has_strong_password: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param enterprise_has_strong_password_required_for_external_users: Whether or not the enterprise that owns the content requires
+ a strong password to collaborate on the content, or enforces
+ an exposed password detection for the external collaborators., defaults to None
+ :type enterprise_has_strong_password_required_for_external_users: Optional[bool], optional
+ :param user_has_strong_password: Whether or not the user has a strong and not exposed password set
+ for their account. The field is `null` when a strong password is
+ not required., defaults to None
+ :type user_has_strong_password: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.enterprise_has_strong_password_required_for_external_users = (
+ enterprise_has_strong_password_required_for_external_users
+ )
+ self.user_has_strong_password = user_has_strong_password
+
+
+class CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField(
+ BaseObject
+):
+ def __init__(
+ self,
+ *,
+ enterprise_has_two_factor_auth_enabled: Optional[bool] = None,
+ user_has_two_factor_authentication_enabled: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param enterprise_has_two_factor_auth_enabled: Whether or not the enterprise that owns the content requires
+ two-factor authentication to be enabled in order to
+ collaborate on the content., defaults to None
+ :type enterprise_has_two_factor_auth_enabled: Optional[bool], optional
+ :param user_has_two_factor_authentication_enabled: Whether or not the user has two-factor authentication
+ enabled. The field is `null` when two-factor
+ authentication is not required., defaults to None
+ :type user_has_two_factor_authentication_enabled: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.enterprise_has_two_factor_auth_enabled = (
+ enterprise_has_two_factor_auth_enabled
+ )
+ self.user_has_two_factor_authentication_enabled = (
+ user_has_two_factor_authentication_enabled
+ )
+
+
+class CollaborationAcceptanceRequirementsStatusField(BaseObject):
+ def __init__(
+ self,
+ *,
+ terms_of_service_requirement: Optional[
+ CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField
+ ] = None,
+ strong_password_requirement: Optional[
+ CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField
+ ] = None,
+ two_factor_authentication_requirement: Optional[
+ CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField
+ ] = None,
+ **kwargs
+ ):
+ super().__init__(**kwargs)
+ self.terms_of_service_requirement = terms_of_service_requirement
+ self.strong_password_requirement = strong_password_requirement
+ self.two_factor_authentication_requirement = (
+ two_factor_authentication_requirement
+ )
+
+
+class Collaboration(BaseObject):
+ _discriminator = 'type', {'collaboration'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CollaborationTypeField = CollaborationTypeField.COLLABORATION,
+ item: Optional[Union[File, Folder, WebLink]] = None,
+ app_item: Optional[AppItem] = None,
+ accessible_by: Optional[Union[UserCollaborations, GroupMini]] = None,
+ invite_email: Optional[str] = None,
+ role: Optional[CollaborationRoleField] = None,
+ expires_at: Optional[DateTime] = None,
+ is_access_only: Optional[bool] = None,
+ status: Optional[CollaborationStatusField] = None,
+ acknowledged_at: Optional[DateTime] = None,
+ created_by: Optional[UserCollaborations] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ acceptance_requirements_status: Optional[
+ CollaborationAcceptanceRequirementsStatusField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this collaboration.
+ :type id: str
+ :param type: The value will always be `collaboration`., defaults to CollaborationTypeField.COLLABORATION
+ :type type: CollaborationTypeField, optional
+ :param invite_email: The email address used to invite an unregistered collaborator, if
+ they are not a registered user., defaults to None
+ :type invite_email: Optional[str], optional
+ :param role: The level of access granted., defaults to None
+ :type role: Optional[CollaborationRoleField], optional
+ :param expires_at: When the collaboration will expire, or `null` if no expiration
+ date is set., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ :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
+ see the the path to the root folder for the
+ shared item., defaults to None
+ :type is_access_only: Optional[bool], optional
+ :param status: The status of the collaboration invitation. If the status
+ is `pending`, `login` and `name` return an empty string., defaults to None
+ :type status: Optional[CollaborationStatusField], optional
+ :param acknowledged_at: When the `status` of the collaboration object changed to
+ `accepted` or `rejected`., defaults to None
+ :type acknowledged_at: Optional[DateTime], optional
+ :param created_at: When the collaboration object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the collaboration object was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.item = item
+ self.app_item = app_item
+ self.accessible_by = accessible_by
+ self.invite_email = invite_email
+ self.role = role
+ self.expires_at = expires_at
+ self.is_access_only = is_access_only
+ self.status = status
+ self.acknowledged_at = acknowledged_at
+ self.created_by = created_by
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.acceptance_requirements_status = acceptance_requirements_status
diff --git a/box_sdk_gen/schemas/collaboration_allowlist_entries.py b/box_sdk_gen/schemas/collaboration_allowlist_entries.py
new file mode 100644
index 000000000..6d15e2629
--- /dev/null
+++ b/box_sdk_gen/schemas/collaboration_allowlist_entries.py
@@ -0,0 +1,40 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.collaboration_allowlist_entry import (
+ CollaborationAllowlistEntry,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CollaborationAllowlistEntries(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[CollaborationAllowlistEntry]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of allowed collaboration domains., defaults to None
+ :type entries: Optional[List[CollaborationAllowlistEntry]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/collaboration_allowlist_entry.py b/box_sdk_gen/schemas/collaboration_allowlist_entry.py
new file mode 100644
index 000000000..341f79c9d
--- /dev/null
+++ b/box_sdk_gen/schemas/collaboration_allowlist_entry.py
@@ -0,0 +1,83 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class CollaborationAllowlistEntryTypeField(str, Enum):
+ COLLABORATION_WHITELIST_ENTRY = 'collaboration_whitelist_entry'
+
+
+class CollaborationAllowlistEntryDirectionField(str, Enum):
+ INBOUND = 'inbound'
+ OUTBOUND = 'outbound'
+ BOTH = 'both'
+
+
+class CollaborationAllowlistEntryEnterpriseTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class CollaborationAllowlistEntryEnterpriseField(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[CollaborationAllowlistEntryEnterpriseTypeField] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[CollaborationAllowlistEntryEnterpriseTypeField], optional
+ :param name: The name of the enterprise., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+
+
+class CollaborationAllowlistEntry(BaseObject):
+ _discriminator = 'type', {'collaboration_whitelist_entry'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[CollaborationAllowlistEntryTypeField] = None,
+ domain: Optional[str] = None,
+ direction: Optional[CollaborationAllowlistEntryDirectionField] = None,
+ enterprise: Optional[CollaborationAllowlistEntryEnterpriseField] = None,
+ created_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this entry., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `collaboration_whitelist_entry`., defaults to None
+ :type type: Optional[CollaborationAllowlistEntryTypeField], optional
+ :param domain: The whitelisted domain., defaults to None
+ :type domain: Optional[str], optional
+ :param direction: The direction of the collaborations to allow., defaults to None
+ :type direction: Optional[CollaborationAllowlistEntryDirectionField], optional
+ :param created_at: The time the entry was created at., defaults to None
+ :type created_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.domain = domain
+ self.direction = direction
+ self.enterprise = enterprise
+ self.created_at = created_at
diff --git a/box_sdk_gen/schemas/collaboration_allowlist_exempt_target.py b/box_sdk_gen/schemas/collaboration_allowlist_exempt_target.py
new file mode 100644
index 000000000..ab1c17e38
--- /dev/null
+++ b/box_sdk_gen/schemas/collaboration_allowlist_exempt_target.py
@@ -0,0 +1,77 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class CollaborationAllowlistExemptTargetTypeField(str, Enum):
+ COLLABORATION_WHITELIST_EXEMPT_TARGET = 'collaboration_whitelist_exempt_target'
+
+
+class CollaborationAllowlistExemptTargetEnterpriseTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class CollaborationAllowlistExemptTargetEnterpriseField(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[CollaborationAllowlistExemptTargetEnterpriseTypeField] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[CollaborationAllowlistExemptTargetEnterpriseTypeField], optional
+ :param name: The name of the enterprise., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+
+
+class CollaborationAllowlistExemptTarget(BaseObject):
+ _discriminator = 'type', {'collaboration_whitelist_exempt_target'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[CollaborationAllowlistExemptTargetTypeField] = None,
+ enterprise: Optional[CollaborationAllowlistExemptTargetEnterpriseField] = None,
+ user: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this exemption., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `collaboration_whitelist_exempt_target`., defaults to None
+ :type type: Optional[CollaborationAllowlistExemptTargetTypeField], optional
+ :param created_at: The time the entry was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The time the entry was modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.enterprise = enterprise
+ self.user = user
+ self.created_at = created_at
+ self.modified_at = modified_at
diff --git a/box_sdk_gen/schemas/collaboration_allowlist_exempt_targets.py b/box_sdk_gen/schemas/collaboration_allowlist_exempt_targets.py
new file mode 100644
index 000000000..0c5fbc3a4
--- /dev/null
+++ b/box_sdk_gen/schemas/collaboration_allowlist_exempt_targets.py
@@ -0,0 +1,42 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.collaboration_allowlist_exempt_target import (
+ CollaborationAllowlistExemptTarget,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CollaborationAllowlistExemptTargets(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[CollaborationAllowlistExemptTarget]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of users exempt from any of the restrictions
+ imposed by the list of allowed collaboration domains
+ for this enterprise., defaults to None
+ :type entries: Optional[List[CollaborationAllowlistExemptTarget]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/collaborations.py b/box_sdk_gen/schemas/collaborations.py
new file mode 100644
index 000000000..5ee9a17f8
--- /dev/null
+++ b/box_sdk_gen/schemas/collaborations.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.collaboration import Collaboration
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Collaborations(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[Collaboration]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of collaborations., defaults to None
+ :type entries: Optional[List[Collaboration]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/collaborations_offset_paginated.py b/box_sdk_gen/schemas/collaborations_offset_paginated.py
new file mode 100644
index 000000000..91538ad37
--- /dev/null
+++ b/box_sdk_gen/schemas/collaborations_offset_paginated.py
@@ -0,0 +1,47 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.collaboration import Collaboration
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CollaborationsOffsetPaginated(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ entries: Optional[List[Collaboration]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param entries: A list of collaborations., defaults to None
+ :type entries: Optional[List[Collaboration]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/collaborator_variable.py b/box_sdk_gen/schemas/collaborator_variable.py
new file mode 100644
index 000000000..440ccf79c
--- /dev/null
+++ b/box_sdk_gen/schemas/collaborator_variable.py
@@ -0,0 +1,68 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CollaboratorVariableTypeField(str, Enum):
+ VARIABLE = 'variable'
+
+
+class CollaboratorVariableVariableTypeField(str, Enum):
+ USER_LIST = 'user_list'
+
+
+class CollaboratorVariableVariableValueTypeField(str, Enum):
+ USER = 'user'
+
+
+class CollaboratorVariableVariableValueField(BaseObject):
+ _discriminator = 'type', {'user'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: CollaboratorVariableVariableValueTypeField = CollaboratorVariableVariableValueTypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: User's ID.
+ :type id: str
+ :param type: The object type., defaults to CollaboratorVariableVariableValueTypeField.USER
+ :type type: CollaboratorVariableVariableValueTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class CollaboratorVariable(BaseObject):
+ _discriminator = 'type', {'variable'}
+
+ def __init__(
+ self,
+ variable_value: List[CollaboratorVariableVariableValueField],
+ *,
+ type: CollaboratorVariableTypeField = CollaboratorVariableTypeField.VARIABLE,
+ variable_type: CollaboratorVariableVariableTypeField = CollaboratorVariableVariableTypeField.USER_LIST,
+ **kwargs
+ ):
+ """
+ :param variable_value: A list of user IDs.
+ :type variable_value: List[CollaboratorVariableVariableValueField]
+ :param type: Collaborator
+ object type., defaults to CollaboratorVariableTypeField.VARIABLE
+ :type type: CollaboratorVariableTypeField, optional
+ :param variable_type: Variable type
+ for the Collaborator
+ object., defaults to CollaboratorVariableVariableTypeField.USER_LIST
+ :type variable_type: CollaboratorVariableVariableTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.variable_value = variable_value
+ self.type = type
+ self.variable_type = variable_type
diff --git a/box_sdk_gen/schemas/collection.py b/box_sdk_gen/schemas/collection.py
new file mode 100644
index 000000000..d55609279
--- /dev/null
+++ b/box_sdk_gen/schemas/collection.py
@@ -0,0 +1,50 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CollectionTypeField(str, Enum):
+ COLLECTION = 'collection'
+
+
+class CollectionNameField(str, Enum):
+ FAVORITES = 'Favorites'
+
+
+class CollectionCollectionTypeField(str, Enum):
+ FAVORITES = 'favorites'
+
+
+class Collection(BaseObject):
+ _discriminator = 'type', {'collection'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[CollectionTypeField] = None,
+ name: Optional[CollectionNameField] = None,
+ collection_type: Optional[CollectionCollectionTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this collection., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `collection`., defaults to None
+ :type type: Optional[CollectionTypeField], optional
+ :param name: The name of the collection., defaults to None
+ :type name: Optional[CollectionNameField], optional
+ :param collection_type: The type of the collection. This is used to
+ determine the proper visual treatment for
+ collections., defaults to None
+ :type collection_type: Optional[CollectionCollectionTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+ self.collection_type = collection_type
diff --git a/box_sdk_gen/schemas/collections.py b/box_sdk_gen/schemas/collections.py
new file mode 100644
index 000000000..b64669f5d
--- /dev/null
+++ b/box_sdk_gen/schemas/collections.py
@@ -0,0 +1,80 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.collection import Collection
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CollectionsOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class CollectionsOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[CollectionsOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[CollectionsOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class Collections(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[CollectionsOrderField]] = None,
+ entries: Optional[List[Collection]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[CollectionsOrderField]], optional
+ :param entries: A list of collections., defaults to None
+ :type entries: Optional[List[Collection]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/comment.py b/box_sdk_gen/schemas/comment.py
new file mode 100644
index 000000000..a67ba328f
--- /dev/null
+++ b/box_sdk_gen/schemas/comment.py
@@ -0,0 +1,66 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.comment_base import CommentBaseTypeField
+
+from box_sdk_gen.schemas.comment_base import CommentBase
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class CommentItemField(BaseObject):
+ def __init__(
+ self, *, id: Optional[str] = None, type: Optional[str] = None, **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type for this object., defaults to None
+ :type type: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class Comment(CommentBase):
+ def __init__(
+ self,
+ *,
+ is_reply_comment: Optional[bool] = None,
+ message: Optional[str] = None,
+ created_by: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ item: Optional[CommentItemField] = None,
+ id: Optional[str] = None,
+ type: Optional[CommentBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param is_reply_comment: Whether or not this comment is a reply to another
+ comment., defaults to None
+ :type is_reply_comment: Optional[bool], optional
+ :param message: The text of the comment, as provided by the user., defaults to None
+ :type message: Optional[str], optional
+ :param created_at: The time this comment was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The time this comment was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param id: The unique identifier for this comment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `comment`., defaults to None
+ :type type: Optional[CommentBaseTypeField], optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.is_reply_comment = is_reply_comment
+ self.message = message
+ self.created_by = created_by
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.item = item
diff --git a/box_sdk_gen/schemas/comment_base.py b/box_sdk_gen/schemas/comment_base.py
new file mode 100644
index 000000000..bb5761693
--- /dev/null
+++ b/box_sdk_gen/schemas/comment_base.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CommentBaseTypeField(str, Enum):
+ COMMENT = 'comment'
+
+
+class CommentBase(BaseObject):
+ _discriminator = 'type', {'comment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[CommentBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this comment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `comment`., defaults to None
+ :type type: Optional[CommentBaseTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/comment_full.py b/box_sdk_gen/schemas/comment_full.py
new file mode 100644
index 000000000..1b3b7b69f
--- /dev/null
+++ b/box_sdk_gen/schemas/comment_full.py
@@ -0,0 +1,64 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.comment_base import CommentBaseTypeField
+
+from box_sdk_gen.schemas.comment_base import CommentBase
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.comment import CommentItemField
+
+from box_sdk_gen.schemas.comment import Comment
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CommentFull(Comment):
+ def __init__(
+ self,
+ *,
+ tagged_message: Optional[str] = None,
+ is_reply_comment: Optional[bool] = None,
+ message: Optional[str] = None,
+ created_by: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ item: Optional[CommentItemField] = None,
+ id: Optional[str] = None,
+ type: Optional[CommentBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param tagged_message: The string representing the comment text with
+ @mentions included. @mention format is @[id:username]
+ where `id` is user's Box ID and `username` is
+ their display name., defaults to None
+ :type tagged_message: Optional[str], optional
+ :param is_reply_comment: Whether or not this comment is a reply to another
+ comment., defaults to None
+ :type is_reply_comment: Optional[bool], optional
+ :param message: The text of the comment, as provided by the user., defaults to None
+ :type message: Optional[str], optional
+ :param created_at: The time this comment was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The time this comment was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param id: The unique identifier for this comment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `comment`., defaults to None
+ :type type: Optional[CommentBaseTypeField], optional
+ """
+ super().__init__(
+ is_reply_comment=is_reply_comment,
+ message=message,
+ created_by=created_by,
+ created_at=created_at,
+ modified_at=modified_at,
+ item=item,
+ id=id,
+ type=type,
+ **kwargs
+ )
+ self.tagged_message = tagged_message
diff --git a/box_sdk_gen/schemas/comments.py b/box_sdk_gen/schemas/comments.py
new file mode 100644
index 000000000..979b5afb4
--- /dev/null
+++ b/box_sdk_gen/schemas/comments.py
@@ -0,0 +1,80 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.comment_full import CommentFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CommentsOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class CommentsOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[CommentsOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[CommentsOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class Comments(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[CommentsOrderField]] = None,
+ entries: Optional[List[CommentFull]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[CommentsOrderField]], optional
+ :param entries: A list of comments., defaults to None
+ :type entries: Optional[List[CommentFull]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/completion_rule_variable.py b/box_sdk_gen/schemas/completion_rule_variable.py
new file mode 100644
index 000000000..67b818f3f
--- /dev/null
+++ b/box_sdk_gen/schemas/completion_rule_variable.py
@@ -0,0 +1,48 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CompletionRuleVariableTypeField(str, Enum):
+ VARIABLE = 'variable'
+
+
+class CompletionRuleVariableVariableTypeField(str, Enum):
+ TASK_COMPLETION_RULE = 'task_completion_rule'
+
+
+class CompletionRuleVariableVariableValueField(str, Enum):
+ ALL_ASSIGNEES = 'all_assignees'
+ ANY_ASSIGNEES = 'any_assignees'
+
+
+class CompletionRuleVariable(BaseObject):
+ _discriminator = 'type', {'variable'}
+
+ def __init__(
+ self,
+ variable_value: CompletionRuleVariableVariableValueField,
+ *,
+ type: CompletionRuleVariableTypeField = CompletionRuleVariableTypeField.VARIABLE,
+ variable_type: CompletionRuleVariableVariableTypeField = CompletionRuleVariableVariableTypeField.TASK_COMPLETION_RULE,
+ **kwargs
+ ):
+ """
+ :param variable_value: Variable
+ values for a completion
+ rule.
+ :type variable_value: CompletionRuleVariableVariableValueField
+ :param type: Completion
+ Rule object type., defaults to CompletionRuleVariableTypeField.VARIABLE
+ :type type: CompletionRuleVariableTypeField, optional
+ :param variable_type: Variable type
+ for the Completion
+ Rule object., defaults to CompletionRuleVariableVariableTypeField.TASK_COMPLETION_RULE
+ :type variable_type: CompletionRuleVariableVariableTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.variable_value = variable_value
+ self.type = type
+ self.variable_type = variable_type
diff --git a/box_sdk_gen/schemas/conflict_error.py b/box_sdk_gen/schemas/conflict_error.py
new file mode 100644
index 000000000..4ac1341c5
--- /dev/null
+++ b/box_sdk_gen/schemas/conflict_error.py
@@ -0,0 +1,71 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from box_sdk_gen.schemas.client_error import ClientErrorTypeField
+
+from box_sdk_gen.schemas.client_error import ClientErrorCodeField
+
+from box_sdk_gen.schemas.client_error import ClientError
+
+from box_sdk_gen.schemas.file_conflict import FileConflict
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ConflictErrorContextInfoField(BaseObject):
+ def __init__(self, *, conflicts: Optional[List[FileConflict]] = None, **kwargs):
+ """
+ :param conflicts: A list of the file conflicts that caused this error., defaults to None
+ :type conflicts: Optional[List[FileConflict]], optional
+ """
+ super().__init__(**kwargs)
+ self.conflicts = conflicts
+
+
+class ConflictError(ClientError):
+ def __init__(
+ self,
+ *,
+ type: Optional[ClientErrorTypeField] = None,
+ status: Optional[int] = None,
+ code: Optional[ClientErrorCodeField] = None,
+ message: Optional[str] = None,
+ context_info: Optional[Dict] = None,
+ help_url: Optional[str] = None,
+ request_id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `error`., defaults to None
+ :type type: Optional[ClientErrorTypeField], optional
+ :param status: The HTTP status of the response., defaults to None
+ :type status: Optional[int], optional
+ :param code: A Box-specific error code., defaults to None
+ :type code: Optional[ClientErrorCodeField], optional
+ :param message: A short message describing the error., defaults to None
+ :type message: Optional[str], optional
+ :param context_info: A free-form object that contains additional context
+ about the error. The possible fields are defined on
+ a per-endpoint basis. `message` is only one example., defaults to None
+ :type context_info: Optional[Dict], optional
+ :param help_url: A URL that links to more information about why this error occurred., defaults to None
+ :type help_url: Optional[str], optional
+ :param request_id: A unique identifier for this response, which can be used
+ when contacting Box support., defaults to None
+ :type request_id: Optional[str], optional
+ """
+ super().__init__(
+ type=type,
+ status=status,
+ code=code,
+ message=message,
+ context_info=context_info,
+ help_url=help_url,
+ request_id=request_id,
+ **kwargs
+ )
diff --git a/box_sdk_gen/schemas/create_ai_agent.py b/box_sdk_gen/schemas/create_ai_agent.py
new file mode 100644
index 000000000..caa2a694d
--- /dev/null
+++ b/box_sdk_gen/schemas/create_ai_agent.py
@@ -0,0 +1,65 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.schemas.group_base import GroupBase
+
+from box_sdk_gen.schemas.ai_agent_allowed_entity import AiAgentAllowedEntity
+
+from box_sdk_gen.schemas.ai_studio_agent_ask import AiStudioAgentAsk
+
+from box_sdk_gen.schemas.ai_studio_agent_text_gen import AiStudioAgentTextGen
+
+from box_sdk_gen.schemas.ai_studio_agent_extract import AiStudioAgentExtract
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class CreateAiAgentTypeField(str, Enum):
+ AI_AGENT = 'ai_agent'
+
+
+class CreateAiAgent(BaseObject):
+ _discriminator = 'type', {'ai_agent'}
+
+ def __init__(
+ self,
+ name: str,
+ access_state: str,
+ *,
+ type: CreateAiAgentTypeField = CreateAiAgentTypeField.AI_AGENT,
+ icon_reference: Optional[str] = None,
+ allowed_entities: Optional[List[AiAgentAllowedEntity]] = None,
+ ask: Optional[AiStudioAgentAsk] = None,
+ text_gen: Optional[AiStudioAgentTextGen] = None,
+ extract: Optional[AiStudioAgentExtract] = None,
+ **kwargs
+ ):
+ """
+ :param name: The name of the AI Agent.
+ :type name: str
+ :param access_state: The state of the AI Agent. Possible values are: `enabled`, `disabled`, and `enabled_for_selected_users`.
+ :type access_state: str
+ :param type: The type of agent used to handle queries., defaults to CreateAiAgentTypeField.AI_AGENT
+ :type type: CreateAiAgentTypeField, optional
+ :param icon_reference: The icon reference of the AI Agent. It should have format of the URL `https://cdn01.boxcdn.net/app-assets/aistudio/avatars/`
+ where possible values of `file_name` are: `logo_boxAi.png`,`logo_stamp.png`,`logo_legal.png`,`logo_finance.png`,`logo_config.png`,`logo_handshake.png`,`logo_analytics.png`,`logo_classification.png`., defaults to None
+ :type icon_reference: Optional[str], optional
+ :param allowed_entities: List of allowed users or groups., defaults to None
+ :type allowed_entities: Optional[List[AiAgentAllowedEntity]], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.access_state = access_state
+ self.type = type
+ self.icon_reference = icon_reference
+ self.allowed_entities = allowed_entities
+ self.ask = ask
+ self.text_gen = text_gen
+ self.extract = extract
diff --git a/box_sdk_gen/schemas/device_pinner.py b/box_sdk_gen/schemas/device_pinner.py
new file mode 100644
index 000000000..97652f005
--- /dev/null
+++ b/box_sdk_gen/schemas/device_pinner.py
@@ -0,0 +1,40 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DevicePinnerTypeField(str, Enum):
+ DEVICE_PINNER = 'device_pinner'
+
+
+class DevicePinner(BaseObject):
+ _discriminator = 'type', {'device_pinner'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[DevicePinnerTypeField] = None,
+ owned_by: Optional[UserMini] = None,
+ product_name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this device pin., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `device_pinner`., defaults to None
+ :type type: Optional[DevicePinnerTypeField], optional
+ :param product_name: The type of device being pinned., defaults to None
+ :type product_name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.owned_by = owned_by
+ self.product_name = product_name
diff --git a/box_sdk_gen/schemas/device_pinners.py b/box_sdk_gen/schemas/device_pinners.py
new file mode 100644
index 000000000..3ad323efa
--- /dev/null
+++ b/box_sdk_gen/schemas/device_pinners.py
@@ -0,0 +1,68 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.device_pinner import DevicePinner
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DevicePinnersOrderByField(str, Enum):
+ ID = 'id'
+
+
+class DevicePinnersOrderDirectionField(str, Enum):
+ ASC = 'asc'
+ DESC = 'desc'
+
+
+class DevicePinnersOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[DevicePinnersOrderByField] = None,
+ direction: Optional[DevicePinnersOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field that is ordered by., defaults to None
+ :type by: Optional[DevicePinnersOrderByField], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[DevicePinnersOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class DevicePinners(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[DevicePinner]] = None,
+ limit: Optional[int] = None,
+ next_marker: Optional[int] = None,
+ order: Optional[List[DevicePinnersOrderField]] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list of device pins., defaults to None
+ :type entries: Optional[List[DevicePinner]], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[int], optional
+ :param order: The order by which items are returned., defaults to None
+ :type order: Optional[List[DevicePinnersOrderField]], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
+ self.order = order
diff --git a/box_sdk_gen/schemas/email_alias.py b/box_sdk_gen/schemas/email_alias.py
new file mode 100644
index 000000000..b8355f6e5
--- /dev/null
+++ b/box_sdk_gen/schemas/email_alias.py
@@ -0,0 +1,40 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class EmailAliasTypeField(str, Enum):
+ EMAIL_ALIAS = 'email_alias'
+
+
+class EmailAlias(BaseObject):
+ _discriminator = 'type', {'email_alias'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[EmailAliasTypeField] = None,
+ email: Optional[str] = None,
+ is_confirmed: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `email_alias`., defaults to None
+ :type type: Optional[EmailAliasTypeField], optional
+ :param email: The email address., defaults to None
+ :type email: Optional[str], optional
+ :param is_confirmed: Whether the email address has been confirmed., defaults to None
+ :type is_confirmed: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.email = email
+ self.is_confirmed = is_confirmed
diff --git a/box_sdk_gen/schemas/email_aliases.py b/box_sdk_gen/schemas/email_aliases.py
new file mode 100644
index 000000000..d359665b3
--- /dev/null
+++ b/box_sdk_gen/schemas/email_aliases.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.email_alias import EmailAlias
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class EmailAliases(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ entries: Optional[List[EmailAlias]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: The number of email aliases., defaults to None
+ :type total_count: Optional[int], optional
+ :param entries: A list of email aliases., defaults to None
+ :type entries: Optional[List[EmailAlias]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/enterprise_base.py b/box_sdk_gen/schemas/enterprise_base.py
new file mode 100644
index 000000000..70868168b
--- /dev/null
+++ b/box_sdk_gen/schemas/enterprise_base.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class EnterpriseBaseTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class EnterpriseBase(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[EnterpriseBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[EnterpriseBaseTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/event.py b/box_sdk_gen/schemas/event.py
new file mode 100644
index 000000000..9a1a87cec
--- /dev/null
+++ b/box_sdk_gen/schemas/event.py
@@ -0,0 +1,241 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Union
+
+from typing import Dict
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.user import User
+
+from box_sdk_gen.schemas.event_source import EventSource
+
+from box_sdk_gen.schemas.file import File
+
+from box_sdk_gen.schemas.folder import Folder
+
+from box_sdk_gen.schemas.app_item_event_source import AppItemEventSource
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class EventEventTypeField(str, Enum):
+ ACCESS_GRANTED = 'ACCESS_GRANTED'
+ ACCESS_REVOKED = 'ACCESS_REVOKED'
+ ADD_DEVICE_ASSOCIATION = 'ADD_DEVICE_ASSOCIATION'
+ ADD_LOGIN_ACTIVITY_DEVICE = 'ADD_LOGIN_ACTIVITY_DEVICE'
+ ADMIN_LOGIN = 'ADMIN_LOGIN'
+ APPLICATION_CREATED = 'APPLICATION_CREATED'
+ APPLICATION_PUBLIC_KEY_ADDED = 'APPLICATION_PUBLIC_KEY_ADDED'
+ APPLICATION_PUBLIC_KEY_DELETED = 'APPLICATION_PUBLIC_KEY_DELETED'
+ CHANGE_ADMIN_ROLE = 'CHANGE_ADMIN_ROLE'
+ CHANGE_FOLDER_PERMISSION = 'CHANGE_FOLDER_PERMISSION'
+ COLLABORATION_ACCEPT = 'COLLABORATION_ACCEPT'
+ COLLABORATION_EXPIRATION = 'COLLABORATION_EXPIRATION'
+ COLLABORATION_INVITE = 'COLLABORATION_INVITE'
+ COLLABORATION_REMOVE = 'COLLABORATION_REMOVE'
+ COLLABORATION_ROLE_CHANGE = 'COLLABORATION_ROLE_CHANGE'
+ COLLAB_ADD_COLLABORATOR = 'COLLAB_ADD_COLLABORATOR'
+ COLLAB_INVITE_COLLABORATOR = 'COLLAB_INVITE_COLLABORATOR'
+ COLLAB_REMOVE_COLLABORATOR = 'COLLAB_REMOVE_COLLABORATOR'
+ COLLAB_ROLE_CHANGE = 'COLLAB_ROLE_CHANGE'
+ COMMENT_CREATE = 'COMMENT_CREATE'
+ COMMENT_DELETE = 'COMMENT_DELETE'
+ CONTENT_ACCESS = 'CONTENT_ACCESS'
+ CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY = (
+ 'CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY'
+ )
+ CONTENT_WORKFLOW_AUTOMATION_ADD = 'CONTENT_WORKFLOW_AUTOMATION_ADD'
+ CONTENT_WORKFLOW_AUTOMATION_DELETE = 'CONTENT_WORKFLOW_AUTOMATION_DELETE'
+ CONTENT_WORKFLOW_POLICY_ADD = 'CONTENT_WORKFLOW_POLICY_ADD'
+ CONTENT_WORKFLOW_SHARING_POLICY_VIOLATION = (
+ 'CONTENT_WORKFLOW_SHARING_POLICY_VIOLATION'
+ )
+ CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION = (
+ 'CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION'
+ )
+ COPY = 'COPY'
+ DATA_RETENTION_CREATE_RETENTION = 'DATA_RETENTION_CREATE_RETENTION'
+ DATA_RETENTION_REMOVE_RETENTION = 'DATA_RETENTION_REMOVE_RETENTION'
+ DELETE = 'DELETE'
+ DELETE_USER = 'DELETE_USER'
+ DEVICE_TRUST_CHECK_FAILED = 'DEVICE_TRUST_CHECK_FAILED'
+ DOWNLOAD = 'DOWNLOAD'
+ EDIT = 'EDIT'
+ EDIT_USER = 'EDIT_USER'
+ EDR_CROWDSTRIKE_DEVICE_DETECTED = 'EDR_CROWDSTRIKE_DEVICE_DETECTED'
+ EDR_CROWDSTRIKE_NO_BOX_TOOLS = 'EDR_CROWDSTRIKE_NO_BOX_TOOLS'
+ EDR_CROWDSTRIKE_BOX_TOOLS_OUTDATED = 'EDR_CROWDSTRIKE_BOX_TOOLS_OUTDATED'
+ EDR_CROWDSTRIKE_DRIVE_OUTDATED = 'EDR_CROWDSTRIKE_DRIVE_OUTDATED'
+ EDR_CROWDSTRIKE_ACCESS_ALLOWED_NO_CROWDSTRIKE_DEVICE = (
+ 'EDR_CROWDSTRIKE_ACCESS_ALLOWED_NO_CROWDSTRIKE_DEVICE'
+ )
+ EDR_CROWDSTRIKE_ACCESS_REVOKED = 'EDR_CROWDSTRIKE_ACCESS_REVOKED'
+ EMAIL_ALIAS_CONFIRM = 'EMAIL_ALIAS_CONFIRM'
+ EMAIL_ALIAS_REMOVE = 'EMAIL_ALIAS_REMOVE'
+ ENABLE_TWO_FACTOR_AUTH = 'ENABLE_TWO_FACTOR_AUTH'
+ ENTERPRISE_APP_AUTHORIZATION_UPDATE = 'ENTERPRISE_APP_AUTHORIZATION_UPDATE'
+ FAILED_LOGIN = 'FAILED_LOGIN'
+ FILE_MARKED_MALICIOUS = 'FILE_MARKED_MALICIOUS'
+ FILE_WATERMARKED_DOWNLOAD = 'FILE_WATERMARKED_DOWNLOAD'
+ GROUP_ADD_ITEM = 'GROUP_ADD_ITEM'
+ GROUP_ADD_USER = 'GROUP_ADD_USER'
+ GROUP_CREATION = 'GROUP_CREATION'
+ GROUP_DELETION = 'GROUP_DELETION'
+ GROUP_EDITED = 'GROUP_EDITED'
+ GROUP_REMOVE_ITEM = 'GROUP_REMOVE_ITEM'
+ GROUP_REMOVE_USER = 'GROUP_REMOVE_USER'
+ ITEM_COPY = 'ITEM_COPY'
+ ITEM_CREATE = 'ITEM_CREATE'
+ ITEM_DOWNLOAD = 'ITEM_DOWNLOAD'
+ ITEM_EMAIL_SEND = 'ITEM_EMAIL_SEND'
+ ITEM_MAKE_CURRENT_VERSION = 'ITEM_MAKE_CURRENT_VERSION'
+ ITEM_MODIFY = 'ITEM_MODIFY'
+ ITEM_MOVE = 'ITEM_MOVE'
+ ITEM_OPEN = 'ITEM_OPEN'
+ ITEM_PREVIEW = 'ITEM_PREVIEW'
+ ITEM_RENAME = 'ITEM_RENAME'
+ ITEM_SHARED = 'ITEM_SHARED'
+ ITEM_SHARED_CREATE = 'ITEM_SHARED_CREATE'
+ ITEM_SHARED_UNSHARE = 'ITEM_SHARED_UNSHARE'
+ ITEM_SHARED_UPDATE = 'ITEM_SHARED_UPDATE'
+ ITEM_SYNC = 'ITEM_SYNC'
+ ITEM_TRASH = 'ITEM_TRASH'
+ ITEM_UNDELETE_VIA_TRASH = 'ITEM_UNDELETE_VIA_TRASH'
+ ITEM_UNSYNC = 'ITEM_UNSYNC'
+ ITEM_UPLOAD = 'ITEM_UPLOAD'
+ LEGAL_HOLD_ASSIGNMENT_CREATE = 'LEGAL_HOLD_ASSIGNMENT_CREATE'
+ LEGAL_HOLD_ASSIGNMENT_DELETE = 'LEGAL_HOLD_ASSIGNMENT_DELETE'
+ LEGAL_HOLD_POLICY_CREATE = 'LEGAL_HOLD_POLICY_CREATE'
+ LEGAL_HOLD_POLICY_DELETE = 'LEGAL_HOLD_POLICY_DELETE'
+ LEGAL_HOLD_POLICY_UPDATE = 'LEGAL_HOLD_POLICY_UPDATE'
+ LOCK = 'LOCK'
+ LOCK_CREATE = 'LOCK_CREATE'
+ LOCK_DESTROY = 'LOCK_DESTROY'
+ LOGIN = 'LOGIN'
+ MASTER_INVITE_ACCEPT = 'MASTER_INVITE_ACCEPT'
+ MASTER_INVITE_REJECT = 'MASTER_INVITE_REJECT'
+ METADATA_INSTANCE_CREATE = 'METADATA_INSTANCE_CREATE'
+ METADATA_INSTANCE_DELETE = 'METADATA_INSTANCE_DELETE'
+ METADATA_INSTANCE_UPDATE = 'METADATA_INSTANCE_UPDATE'
+ METADATA_TEMPLATE_CREATE = 'METADATA_TEMPLATE_CREATE'
+ METADATA_TEMPLATE_DELETE = 'METADATA_TEMPLATE_DELETE'
+ METADATA_TEMPLATE_UPDATE = 'METADATA_TEMPLATE_UPDATE'
+ MOVE = 'MOVE'
+ NEW_USER = 'NEW_USER'
+ PREVIEW = 'PREVIEW'
+ REMOVE_DEVICE_ASSOCIATION = 'REMOVE_DEVICE_ASSOCIATION'
+ REMOVE_LOGIN_ACTIVITY_DEVICE = 'REMOVE_LOGIN_ACTIVITY_DEVICE'
+ RENAME = 'RENAME'
+ RETENTION_POLICY_ASSIGNMENT_ADD = 'RETENTION_POLICY_ASSIGNMENT_ADD'
+ SHARE = 'SHARE'
+ SHARED_LINK_SEND = 'SHARED_LINK_SEND'
+ SHARE_EXPIRATION = 'SHARE_EXPIRATION'
+ SHIELD_ALERT = 'SHIELD_ALERT'
+ SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED = 'SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED'
+ SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED_MISSING_JUSTIFICATION = (
+ 'SHIELD_EXTERNAL_COLLAB_ACCESS_BLOCKED_MISSING_JUSTIFICATION'
+ )
+ SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED = 'SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED'
+ SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED_MISSING_JUSTIFICATION = (
+ 'SHIELD_EXTERNAL_COLLAB_INVITE_BLOCKED_MISSING_JUSTIFICATION'
+ )
+ SHIELD_JUSTIFICATION_APPROVAL = 'SHIELD_JUSTIFICATION_APPROVAL'
+ SHIELD_SHARED_LINK_ACCESS_BLOCKED = 'SHIELD_SHARED_LINK_ACCESS_BLOCKED'
+ SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_CREATE = (
+ 'SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_CREATE'
+ )
+ SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_UPDATE = (
+ 'SHIELD_SHARED_LINK_STATUS_RESTRICTED_ON_UPDATE'
+ )
+ SIGN_DOCUMENT_ASSIGNED = 'SIGN_DOCUMENT_ASSIGNED'
+ SIGN_DOCUMENT_CANCELLED = 'SIGN_DOCUMENT_CANCELLED'
+ SIGN_DOCUMENT_COMPLETED = 'SIGN_DOCUMENT_COMPLETED'
+ SIGN_DOCUMENT_CONVERTED = 'SIGN_DOCUMENT_CONVERTED'
+ SIGN_DOCUMENT_CREATED = 'SIGN_DOCUMENT_CREATED'
+ SIGN_DOCUMENT_DECLINED = 'SIGN_DOCUMENT_DECLINED'
+ SIGN_DOCUMENT_EXPIRED = 'SIGN_DOCUMENT_EXPIRED'
+ SIGN_DOCUMENT_SIGNED = 'SIGN_DOCUMENT_SIGNED'
+ SIGN_DOCUMENT_VIEWED_BY_SIGNED = 'SIGN_DOCUMENT_VIEWED_BY_SIGNED'
+ SIGNER_DOWNLOADED = 'SIGNER_DOWNLOADED'
+ SIGNER_FORWARDED = 'SIGNER_FORWARDED'
+ STORAGE_EXPIRATION = 'STORAGE_EXPIRATION'
+ TAG_ITEM_CREATE = 'TAG_ITEM_CREATE'
+ TASK_ASSIGNMENT_CREATE = 'TASK_ASSIGNMENT_CREATE'
+ TASK_ASSIGNMENT_DELETE = 'TASK_ASSIGNMENT_DELETE'
+ TASK_ASSIGNMENT_UPDATE = 'TASK_ASSIGNMENT_UPDATE'
+ TASK_CREATE = 'TASK_CREATE'
+ TASK_UPDATE = 'TASK_UPDATE'
+ TERMS_OF_SERVICE_ACCEPT = 'TERMS_OF_SERVICE_ACCEPT'
+ TERMS_OF_SERVICE_REJECT = 'TERMS_OF_SERVICE_REJECT'
+ UNDELETE = 'UNDELETE'
+ UNLOCK = 'UNLOCK'
+ UNSHARE = 'UNSHARE'
+ UPDATE_COLLABORATION_EXPIRATION = 'UPDATE_COLLABORATION_EXPIRATION'
+ UPDATE_SHARE_EXPIRATION = 'UPDATE_SHARE_EXPIRATION'
+ UPLOAD = 'UPLOAD'
+ USER_AUTHENTICATE_OAUTH2_ACCESS_TOKEN_CREATE = (
+ 'USER_AUTHENTICATE_OAUTH2_ACCESS_TOKEN_CREATE'
+ )
+ WATERMARK_LABEL_CREATE = 'WATERMARK_LABEL_CREATE'
+ WATERMARK_LABEL_DELETE = 'WATERMARK_LABEL_DELETE'
+
+
+class EventAdditionalDetailsField(BaseObject):
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+
+
+class Event(BaseObject):
+ def __init__(
+ self,
+ *,
+ type: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ recorded_at: Optional[DateTime] = None,
+ event_id: Optional[str] = None,
+ created_by: Optional[UserMini] = None,
+ event_type: Optional[EventEventTypeField] = None,
+ session_id: Optional[str] = None,
+ source: Optional[
+ Union[User, EventSource, File, Folder, Dict, AppItemEventSource]
+ ] = None,
+ additional_details: Optional[EventAdditionalDetailsField] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `event`., defaults to None
+ :type type: Optional[str], optional
+ :param created_at: When the event object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param recorded_at: When the event object was recorded in database., defaults to None
+ :type recorded_at: Optional[DateTime], optional
+ :param event_id: The ID of the event object. You can use this to detect duplicate events., defaults to None
+ :type event_id: Optional[str], optional
+ :param session_id: The session of the user that performed the action. Not all events will
+ populate this attribute., defaults to None
+ :type session_id: Optional[str], optional
+ :param additional_details: This object provides additional information about the event if available.
+
+ This can include how a user performed an event as well as additional
+ information to correlate an event to external KeySafe logs. Not all events
+ have an `additional_details` object. This object is only available in the
+ Enterprise Events., defaults to None
+ :type additional_details: Optional[EventAdditionalDetailsField], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.created_at = created_at
+ self.recorded_at = recorded_at
+ self.event_id = event_id
+ self.created_by = created_by
+ self.event_type = event_type
+ self.session_id = session_id
+ self.source = source
+ self.additional_details = additional_details
diff --git a/box_sdk_gen/schemas/event_source.py b/box_sdk_gen/schemas/event_source.py
new file mode 100644
index 000000000..513744f4c
--- /dev/null
+++ b/box_sdk_gen/schemas/event_source.py
@@ -0,0 +1,63 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class EventSourceItemTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class EventSourceClassificationField(BaseObject):
+ def __init__(self, *, name: Optional[str] = None, **kwargs):
+ """
+ :param name: The classification's name., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+
+
+class EventSource(BaseObject):
+ _discriminator = 'item_type', {'file', 'folder'}
+
+ def __init__(
+ self,
+ item_type: EventSourceItemTypeField,
+ item_id: str,
+ item_name: str,
+ *,
+ classification: Optional[EventSourceClassificationField] = None,
+ parent: Optional[FolderMini] = None,
+ owned_by: Optional[UserMini] = None,
+ **kwargs
+ ):
+ """
+ :param item_type: The type of the item that the event
+ represents. Can be `file` or `folder`.
+ :type item_type: EventSourceItemTypeField
+ :param item_id: The unique identifier that represents the
+ item.
+ :type item_id: str
+ :param item_name: The name of the item.
+ :type item_name: str
+ :param classification: The object containing classification information for the item that
+ triggered the event. This field will not appear if the item does not
+ have a classification set., defaults to None
+ :type classification: Optional[EventSourceClassificationField], optional
+ """
+ super().__init__(**kwargs)
+ self.item_type = item_type
+ self.item_id = item_id
+ self.item_name = item_name
+ self.classification = classification
+ self.parent = parent
+ self.owned_by = owned_by
diff --git a/box_sdk_gen/schemas/events.py b/box_sdk_gen/schemas/events.py
new file mode 100644
index 000000000..2e2e14a8d
--- /dev/null
+++ b/box_sdk_gen/schemas/events.py
@@ -0,0 +1,35 @@
+from typing import Optional
+
+from typing import Union
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.event import Event
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Events(BaseObject):
+ def __init__(
+ self,
+ *,
+ chunk_size: Optional[int] = None,
+ next_stream_position: Optional[Union[str, int]] = None,
+ entries: Optional[List[Event]] = None,
+ **kwargs
+ ):
+ """
+ :param chunk_size: The number of events returned in this response., defaults to None
+ :type chunk_size: Optional[int], optional
+ :param next_stream_position: The stream position of the start of the next page (chunk)
+ of events., defaults to None
+ :type next_stream_position: Optional[Union[str, int]], optional
+ :param entries: A list of events., defaults to None
+ :type entries: Optional[List[Event]], optional
+ """
+ super().__init__(**kwargs)
+ self.chunk_size = chunk_size
+ self.next_stream_position = next_stream_position
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/file.py b/box_sdk_gen/schemas/file.py
new file mode 100644
index 000000000..2e9344e88
--- /dev/null
+++ b/box_sdk_gen/schemas/file.py
@@ -0,0 +1,278 @@
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.schemas.file_base import FileBaseTypeField
+
+from box_sdk_gen.schemas.file_base import FileBase
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FilePathCollectionField(BaseObject):
+ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs):
+ """
+ :param total_count: The number of folders in this list.
+ :type total_count: int
+ :param entries: The parent folders for this item.
+ :type entries: List[FolderMini]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class FileSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class FileSharedLinkEffectiveAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class FileSharedLinkEffectivePermissionField(str, Enum):
+ CAN_EDIT = 'can_edit'
+ CAN_DOWNLOAD = 'can_download'
+ CAN_PREVIEW = 'can_preview'
+ NO_ACCESS = 'no_access'
+
+
+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
+ shared links on folders, this also applies to any items in the folder.
+
+ This value can be set to `true` when the effective access level is
+ set to `open` or `company`, not `collaborators`.
+ :type can_download: bool
+ :param can_preview: Defines if the shared link allows for the item to be previewed.
+
+ This value is always `true`. For shared links on folders this also
+ applies to any items in the folder.
+ :type can_preview: bool
+ :param can_edit: Defines if the shared link allows for the item to be edited.
+
+ This value can only be `true` if `can_download` is also `true` and if
+ the item has a type of `file`.
+ :type can_edit: bool
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class FileSharedLinkField(BaseObject):
+ def __init__(
+ self,
+ url: str,
+ 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[FileSharedLinkAccessField] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[FileSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param url: The URL that can be used to access the item on Box.
+
+ This URL will display the item in Box's preview UI where the file
+ can be downloaded if allowed.
+
+ This URL will continue to work even when a custom `vanity_url`
+ has been set for this shared link.
+ :type url: str
+ :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: 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: 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.
+ :type download_count: int
+ :param preview_count: The number of times this item has been previewed.
+ :type preview_count: int
+ :param download_url: A URL that can be used to download the file. This URL can be used in
+ a browser to download the file. This URL includes the file
+ extension so that the file will be saved with the right file type.
+
+ This property will be `null` for folders., defaults to None
+ :type download_url: Optional[str], optional
+ :param vanity_url: The "Custom URL" that can also be used to preview the item on Box. Custom
+ URLs can only be created or modified in the Box Web application., defaults to None
+ :type vanity_url: Optional[str], optional
+ :param vanity_name: The custom name of a shared link, as used in the `vanity_url` field., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param access: The access level for this shared link.
+
+ * `open` - provides access to this item to anyone with this link
+ * `company` - only provides access to this item to people the same company
+ * `collaborators` - only provides access to this item to people who are
+ 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., defaults to None
+ :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., defaults to None
+ :type unshared_at: Optional[DateTime], 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., defaults to None
+ :type permissions: Optional[FileSharedLinkPermissionsField], optional
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.effective_access = effective_access
+ self.effective_permission = effective_permission
+ self.is_password_enabled = is_password_enabled
+ self.download_count = download_count
+ self.preview_count = preview_count
+ self.download_url = download_url
+ self.vanity_url = vanity_url
+ self.vanity_name = vanity_name
+ self.access = access
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class FileItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class File(FileMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ description: Optional[str] = None,
+ size: Optional[int] = None,
+ path_collection: Optional[FilePathCollectionField] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ trashed_at: Optional[DateTime] = None,
+ purged_at: Optional[DateTime] = None,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ created_by: Optional[UserMini] = None,
+ modified_by: Optional[UserMini] = None,
+ owned_by: Optional[UserMini] = None,
+ shared_link: Optional[FileSharedLinkField] = None,
+ parent: Optional[FolderMini] = None,
+ item_status: Optional[FileItemStatusField] = None,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ sha_1: Optional[str] = None,
+ file_version: Optional[FileVersionMini] = None,
+ etag: Optional[str] = None,
+ type: FileBaseTypeField = FileBaseTypeField.FILE,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent 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`.
+ :type id: str
+ :param description: The optional description of this file.
+ If the description exceeds 255 characters, the first 255 characters
+ are set as a file description and the rest of it is ignored., defaults to None
+ :type description: Optional[str], optional
+ :param size: The file size in bytes. Be careful parsing this integer as it can
+ get very large and cause an integer overflow., defaults to None
+ :type size: Optional[int], optional
+ :param created_at: The date and time when the file was created on Box., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The date and time when the file was last updated on Box., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param trashed_at: The time at which this file was put in the trash., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param purged_at: The time at which this file is expected to be purged
+ from the trash., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param content_created_at: The date and time at which this file was originally
+ created, which might be before it was uploaded to Box., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: The date and time at which this file was last updated,
+ which might be before it was uploaded to Box., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ :param item_status: Defines if this item has been deleted or not.
+
+ * `active` when the item has is not in the trash
+ * `trashed` when the item has been moved to the trash but not deleted
+ * `deleted` when the item has been permanently deleted., defaults to None
+ :type item_status: Optional[FileItemStatusField], optional
+ :param name: The name of the file., defaults to None
+ :type name: Optional[str], optional
+ :param sha_1: The SHA1 hash of the file. This can be used to compare the contents
+ of a file on Box with a local file., defaults to None
+ :type sha_1: Optional[str], optional
+ :param etag: The HTTP `etag` of this file. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the file if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `file`., defaults to FileBaseTypeField.FILE
+ :type type: FileBaseTypeField, optional
+ """
+ super().__init__(
+ id=id,
+ sequence_id=sequence_id,
+ name=name,
+ sha_1=sha_1,
+ file_version=file_version,
+ etag=etag,
+ type=type,
+ **kwargs
+ )
+ self.description = description
+ self.size = size
+ self.path_collection = path_collection
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.content_created_at = content_created_at
+ self.content_modified_at = content_modified_at
+ self.created_by = created_by
+ self.modified_by = modified_by
+ self.owned_by = owned_by
+ self.shared_link = shared_link
+ self.parent = parent
+ self.item_status = item_status
diff --git a/box_sdk_gen/schemas/file_base.py b/box_sdk_gen/schemas/file_base.py
new file mode 100644
index 000000000..aa2c63a0f
--- /dev/null
+++ b/box_sdk_gen/schemas/file_base.py
@@ -0,0 +1,44 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileBaseTypeField(str, Enum):
+ FILE = 'file'
+
+
+class FileBase(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ etag: Optional[str] = None,
+ type: FileBaseTypeField = FileBaseTypeField.FILE,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent 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`.
+ :type id: str
+ :param etag: The HTTP `etag` of this file. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the file if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `file`., defaults to FileBaseTypeField.FILE
+ :type type: FileBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.etag = etag
+ self.type = type
diff --git a/box_sdk_gen/schemas/file_conflict.py b/box_sdk_gen/schemas/file_conflict.py
new file mode 100644
index 000000000..5e88917fe
--- /dev/null
+++ b/box_sdk_gen/schemas/file_conflict.py
@@ -0,0 +1,57 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.file_base import FileBaseTypeField
+
+from box_sdk_gen.schemas.file_base import FileBase
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileConflict(FileMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ sha_1: Optional[str] = None,
+ file_version: Optional[FileVersionMini] = None,
+ etag: Optional[str] = None,
+ type: FileBaseTypeField = FileBaseTypeField.FILE,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent 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`.
+ :type id: str
+ :param name: The name of the file., defaults to None
+ :type name: Optional[str], optional
+ :param sha_1: The SHA1 hash of the file. This can be used to compare the contents
+ of a file on Box with a local file., defaults to None
+ :type sha_1: Optional[str], optional
+ :param etag: The HTTP `etag` of this file. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the file if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `file`., defaults to FileBaseTypeField.FILE
+ :type type: FileBaseTypeField, optional
+ """
+ super().__init__(
+ id=id,
+ sequence_id=sequence_id,
+ name=name,
+ sha_1=sha_1,
+ file_version=file_version,
+ etag=etag,
+ type=type,
+ **kwargs
+ )
diff --git a/box_sdk_gen/schemas/file_full.py b/box_sdk_gen/schemas/file_full.py
new file mode 100644
index 000000000..ce0b75c1e
--- /dev/null
+++ b/box_sdk_gen/schemas/file_full.py
@@ -0,0 +1,577 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.file_base import FileBaseTypeField
+
+from box_sdk_gen.schemas.file_base import FileBase
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.file import FilePathCollectionField
+
+from box_sdk_gen.schemas.file import FileSharedLinkField
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.file import FileItemStatusField
+
+from box_sdk_gen.schemas.file import File
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.file_or_folder_scope import FileOrFolderScope
+
+from box_sdk_gen.schemas.metadata_full import MetadataFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FileFullPermissionsField(BaseObject):
+ def __init__(
+ self,
+ can_delete: bool,
+ can_download: bool,
+ can_invite_collaborator: bool,
+ can_rename: bool,
+ can_set_share_access: bool,
+ can_share: bool,
+ can_annotate: bool,
+ can_comment: bool,
+ can_preview: bool,
+ can_upload: bool,
+ can_view_annotations_all: bool,
+ can_view_annotations_self: bool,
+ **kwargs
+ ):
+ """
+ :param can_delete: Specifies if the current user can delete this item.
+ :type can_delete: bool
+ :param can_download: Specifies if the current user can download this item.
+ :type can_download: bool
+ :param can_invite_collaborator: Specifies if the current user can invite new
+ users to collaborate on this item, and if the user can
+ update the role of a user already collaborated on this
+ item.
+ :type can_invite_collaborator: bool
+ :param can_rename: Specifies if the user can rename this item.
+ :type can_rename: bool
+ :param can_set_share_access: Specifies if the user can change the access level of an
+ existing shared link on this item.
+ :type can_set_share_access: bool
+ :param can_share: Specifies if the user can create a shared link for this item.
+ :type can_share: bool
+ :param can_annotate: Specifies if the user can place annotations on this file.
+ :type can_annotate: bool
+ :param can_comment: Specifies if the user can place comments on this file.
+ :type can_comment: bool
+ :param can_preview: Specifies if the user can preview this file.
+ :type can_preview: bool
+ :param can_upload: Specifies if the user can upload a new version of this file.
+ :type can_upload: bool
+ :param can_view_annotations_all: Specifies if the user view all annotations placed on this file.
+ :type can_view_annotations_all: bool
+ :param can_view_annotations_self: Specifies if the user view annotations placed by themselves
+ on this file.
+ :type can_view_annotations_self: bool
+ """
+ super().__init__(**kwargs)
+ self.can_delete = can_delete
+ self.can_download = can_download
+ self.can_invite_collaborator = can_invite_collaborator
+ self.can_rename = can_rename
+ self.can_set_share_access = can_set_share_access
+ self.can_share = can_share
+ self.can_annotate = can_annotate
+ self.can_comment = can_comment
+ self.can_preview = can_preview
+ self.can_upload = can_upload
+ self.can_view_annotations_all = can_view_annotations_all
+ self.can_view_annotations_self = can_view_annotations_self
+
+
+class FileFullLockTypeField(str, Enum):
+ LOCK = 'lock'
+
+
+class FileFullLockAppTypeField(str, Enum):
+ GSUITE = 'gsuite'
+ OFFICE_WOPI = 'office_wopi'
+ OFFICE_WOPIPLUS = 'office_wopiplus'
+ OTHER = 'other'
+
+
+class FileFullLockField(BaseObject):
+ _discriminator = 'type', {'lock'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[FileFullLockTypeField] = None,
+ created_by: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ expired_at: Optional[DateTime] = None,
+ is_download_prevented: Optional[bool] = None,
+ app_type: Optional[FileFullLockAppTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this lock., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `lock`., defaults to None
+ :type type: Optional[FileFullLockTypeField], optional
+ :param created_at: The time this lock was created at., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param expired_at: The time this lock is to expire at, which might be in the past., defaults to None
+ :type expired_at: Optional[DateTime], optional
+ :param is_download_prevented: Whether or not the file can be downloaded while locked., defaults to None
+ :type is_download_prevented: Optional[bool], optional
+ :param app_type: If the lock is managed by an application rather than a user, this
+ 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., defaults to None
+ :type app_type: Optional[FileFullLockAppTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.created_by = created_by
+ self.created_at = created_at
+ self.expired_at = expired_at
+ self.is_download_prevented = is_download_prevented
+ self.app_type = app_type
+
+
+class FileFullExpiringEmbedLinkTokenTypeField(str, Enum):
+ BEARER = 'bearer'
+
+
+class FileFullExpiringEmbedLinkField(BaseObject):
+ def __init__(
+ self,
+ *,
+ access_token: Optional[str] = None,
+ expires_in: Optional[int] = None,
+ token_type: Optional[FileFullExpiringEmbedLinkTokenTypeField] = None,
+ restricted_to: Optional[List[FileOrFolderScope]] = None,
+ url: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param access_token: The requested access token., defaults to None
+ :type access_token: Optional[str], optional
+ :param expires_in: The time in seconds by which this token will expire., defaults to None
+ :type expires_in: Optional[int], optional
+ :param token_type: The type of access token returned., defaults to None
+ :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., defaults to None
+ :type restricted_to: Optional[List[FileOrFolderScope]], optional
+ :param url: The actual expiring embed URL for this file, constructed
+ from the file ID and access tokens specified in this object., defaults to None
+ :type url: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.access_token = access_token
+ self.expires_in = expires_in
+ self.token_type = token_type
+ self.restricted_to = restricted_to
+ self.url = url
+
+
+class FileFullWatermarkInfoField(BaseObject):
+ def __init__(self, *, is_watermarked: Optional[bool] = None, **kwargs):
+ """
+ :param is_watermarked: Specifies if this item has a watermark applied., defaults to None
+ :type is_watermarked: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.is_watermarked = is_watermarked
+
+
+class FileFullAllowedInviteeRolesField(str, Enum):
+ EDITOR = 'editor'
+ VIEWER = 'viewer'
+ PREVIEWER = 'previewer'
+ UPLOADER = 'uploader'
+ PREVIEWER_UPLOADER = 'previewer uploader'
+ VIEWER_UPLOADER = 'viewer uploader'
+ CO_OWNER = 'co-owner'
+
+
+class FileFullMetadataField(BaseObject):
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+ self.extra_data = kwargs
+
+
+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.
+ Make sure to make an authenticated API call to this endpoint.
+
+ This URL is a template and will require the `{+asset_path}` to
+ be replaced by a path. In general, for unpaged representations
+ it can be replaced by an empty string.
+
+ For paged representations, replace the `{+asset_path}` with the
+ page to request plus the extension for the file, for example
+ `1.pdf`.
+
+ When requesting the download URL the following additional
+ query params can be passed along.
+
+ * `set_content_disposition_type` - Sets the
+ `Content-Disposition` header in the API response with the
+ specified disposition type of either `inline` or `attachment`.
+ If not supplied, the `Content-Disposition` header is not
+ included in the response.
+
+ * `set_content_disposition_filename` - Allows the application to
+ define the representation's file name used in the
+ `Content-Disposition` header. If not defined, the filename
+ is derived from the source file name in Box combined with the
+ extension of the representation., defaults to None
+ :type url_template: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.url_template = url_template
+
+
+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
+ representation. Make sure to make an authenticated API call
+ to this endpoint., defaults to None
+ :type url: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.url = url
+
+
+class FileFullRepresentationsEntriesPropertiesField(BaseObject):
+ def __init__(
+ self,
+ *,
+ dimensions: Optional[str] = None,
+ paged: Optional[str] = None,
+ thumb: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param dimensions: The width by height size of this representation in pixels., defaults to None
+ :type dimensions: Optional[str], optional
+ :param paged: Indicates if the representation is build up out of multiple
+ pages., defaults to None
+ :type paged: Optional[str], optional
+ :param thumb: Indicates if the representation can be used as a thumbnail of
+ the file., defaults to None
+ :type thumb: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.dimensions = dimensions
+ self.paged = paged
+ self.thumb = thumb
+
+
+class FileFullRepresentationsEntriesStatusStateField(str, Enum):
+ SUCCESS = 'success'
+ VIEWABLE = 'viewable'
+ PENDING = 'pending'
+ NONE = 'none'
+
+
+class FileFullRepresentationsEntriesStatusField(BaseObject):
+ def __init__(
+ self,
+ *,
+ state: Optional[FileFullRepresentationsEntriesStatusStateField] = None,
+ **kwargs
+ ):
+ """
+ :param state: The status of the representation.
+
+ * `success` defines the representation as ready to be viewed.
+ * `viewable` defines a video to be ready for viewing.
+ * `pending` defines the representation as to be generated. Retry
+ this endpoint to re-check the status.
+ * `none` defines that the representation will be created when
+ requested. Request the URL defined in the `info` object to
+ trigger this generation., defaults to None
+ :type state: Optional[FileFullRepresentationsEntriesStatusStateField], optional
+ """
+ super().__init__(**kwargs)
+ self.state = state
+
+
+class FileFullRepresentationsEntriesField(BaseObject):
+ def __init__(
+ self,
+ *,
+ content: Optional[FileFullRepresentationsEntriesContentField] = None,
+ info: Optional[FileFullRepresentationsEntriesInfoField] = None,
+ properties: Optional[FileFullRepresentationsEntriesPropertiesField] = None,
+ representation: Optional[str] = None,
+ status: Optional[FileFullRepresentationsEntriesStatusField] = None,
+ **kwargs
+ ):
+ """
+ :param content: An object containing the URL that can be used to actually fetch
+ the representation., defaults to None
+ :type content: Optional[FileFullRepresentationsEntriesContentField], optional
+ :param info: An object containing the URL that can be used to fetch more info
+ on this representation., defaults to None
+ :type info: Optional[FileFullRepresentationsEntriesInfoField], optional
+ :param properties: An object containing the size and type of this presentation., defaults to None
+ :type properties: Optional[FileFullRepresentationsEntriesPropertiesField], optional
+ :param representation: Indicates the file type of the returned representation., defaults to None
+ :type representation: Optional[str], optional
+ :param status: An object containing the status of this representation., defaults to None
+ :type status: Optional[FileFullRepresentationsEntriesStatusField], optional
+ """
+ super().__init__(**kwargs)
+ self.content = content
+ self.info = info
+ self.properties = properties
+ self.representation = representation
+ self.status = status
+
+
+class FileFullRepresentationsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[FileFullRepresentationsEntriesField]] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list of files., defaults to None
+ :type entries: Optional[List[FileFullRepresentationsEntriesField]], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+
+
+class FileFullClassificationField(BaseObject):
+ def __init__(
+ self,
+ *,
+ name: Optional[str] = None,
+ definition: Optional[str] = None,
+ color: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param name: The name of the classification., defaults to None
+ :type name: Optional[str], optional
+ :param definition: An explanation of the meaning of this classification., defaults to None
+ :type definition: Optional[str], optional
+ :param color: The color that is used to display the
+ classification label in a user-interface. Colors are defined by the admin
+ or co-admin who created the classification in the Box web app., defaults to None
+ :type color: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.definition = definition
+ self.color = color
+
+
+class FileFullSharedLinkPermissionOptionsField(str, Enum):
+ CAN_PREVIEW = 'can_preview'
+ CAN_DOWNLOAD = 'can_download'
+ CAN_EDIT = 'can_edit'
+
+
+class FileFull(File):
+ def __init__(
+ self,
+ id: str,
+ *,
+ version_number: Optional[str] = None,
+ comment_count: Optional[int] = None,
+ permissions: Optional[FileFullPermissionsField] = None,
+ tags: Optional[List[str]] = None,
+ lock: Optional[FileFullLockField] = None,
+ extension: Optional[str] = None,
+ is_package: Optional[bool] = None,
+ expiring_embed_link: Optional[FileFullExpiringEmbedLinkField] = None,
+ watermark_info: Optional[FileFullWatermarkInfoField] = None,
+ is_accessible_via_shared_link: Optional[bool] = None,
+ allowed_invitee_roles: Optional[List[FileFullAllowedInviteeRolesField]] = None,
+ is_externally_owned: Optional[bool] = None,
+ has_collaborations: Optional[bool] = None,
+ metadata: Optional[FileFullMetadataField] = None,
+ expires_at: Optional[DateTime] = None,
+ representations: Optional[FileFullRepresentationsField] = None,
+ classification: Optional[FileFullClassificationField] = None,
+ uploader_display_name: Optional[str] = None,
+ disposition_at: Optional[DateTime] = None,
+ shared_link_permission_options: Optional[
+ List[FileFullSharedLinkPermissionOptionsField]
+ ] = None,
+ is_associated_with_app_item: Optional[bool] = None,
+ description: Optional[str] = None,
+ size: Optional[int] = None,
+ path_collection: Optional[FilePathCollectionField] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ trashed_at: Optional[DateTime] = None,
+ purged_at: Optional[DateTime] = None,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ created_by: Optional[UserMini] = None,
+ modified_by: Optional[UserMini] = None,
+ owned_by: Optional[UserMini] = None,
+ shared_link: Optional[FileSharedLinkField] = None,
+ parent: Optional[FolderMini] = None,
+ item_status: Optional[FileItemStatusField] = None,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ sha_1: Optional[str] = None,
+ file_version: Optional[FileVersionMini] = None,
+ etag: Optional[str] = None,
+ type: FileBaseTypeField = FileBaseTypeField.FILE,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent 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`.
+ :type id: str
+ :param version_number: The version number of this file., defaults to None
+ :type version_number: Optional[str], optional
+ :param comment_count: The number of comments on this file., defaults to None
+ :type comment_count: Optional[int], optional
+ :param extension: Indicates the (optional) file extension for this file. By default,
+ this is set to an empty string., defaults to None
+ :type extension: Optional[str], optional
+ :param is_package: Indicates if the file is a package. Packages are commonly used
+ by Mac Applications and can include iWork files., defaults to None
+ :type is_package: Optional[bool], optional
+ :param is_accessible_via_shared_link: Specifies if the file can be accessed
+ via the direct shared link or a shared link
+ to a parent folder., defaults to None
+ :type is_accessible_via_shared_link: Optional[bool], optional
+ :param allowed_invitee_roles: A list of the types of roles that user can be invited at
+ when sharing this file., defaults to None
+ :type allowed_invitee_roles: Optional[List[FileFullAllowedInviteeRolesField]], optional
+ :param is_externally_owned: Specifies if this file is owned by a user outside of the
+ authenticated enterprise., defaults to None
+ :type is_externally_owned: Optional[bool], optional
+ :param has_collaborations: Specifies if this file has any other collaborators., defaults to None
+ :type has_collaborations: Optional[bool], optional
+ :param expires_at: When the file will automatically be deleted., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ :param disposition_at: The retention expiration timestamp for the given file., defaults to None
+ :type disposition_at: Optional[DateTime], optional
+ :param shared_link_permission_options: A list of the types of roles that user can be invited at
+ when sharing this file., defaults to None
+ :type shared_link_permission_options: Optional[List[FileFullSharedLinkPermissionOptionsField]], optional
+ :param is_associated_with_app_item: This field will return true if the file or any ancestor of the file
+ is associated with at least one app item. Note that this will return
+ true even if the context user does not have access to the app item(s)
+ associated with the file., defaults to None
+ :type is_associated_with_app_item: Optional[bool], optional
+ :param description: The optional description of this file.
+ If the description exceeds 255 characters, the first 255 characters
+ are set as a file description and the rest of it is ignored., defaults to None
+ :type description: Optional[str], optional
+ :param size: The file size in bytes. Be careful parsing this integer as it can
+ get very large and cause an integer overflow., defaults to None
+ :type size: Optional[int], optional
+ :param created_at: The date and time when the file was created on Box., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The date and time when the file was last updated on Box., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param trashed_at: The time at which this file was put in the trash., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param purged_at: The time at which this file is expected to be purged
+ from the trash., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param content_created_at: The date and time at which this file was originally
+ created, which might be before it was uploaded to Box., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: The date and time at which this file was last updated,
+ which might be before it was uploaded to Box., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ :param item_status: Defines if this item has been deleted or not.
+
+ * `active` when the item has is not in the trash
+ * `trashed` when the item has been moved to the trash but not deleted
+ * `deleted` when the item has been permanently deleted., defaults to None
+ :type item_status: Optional[FileItemStatusField], optional
+ :param name: The name of the file., defaults to None
+ :type name: Optional[str], optional
+ :param sha_1: The SHA1 hash of the file. This can be used to compare the contents
+ of a file on Box with a local file., defaults to None
+ :type sha_1: Optional[str], optional
+ :param etag: The HTTP `etag` of this file. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the file if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `file`., defaults to FileBaseTypeField.FILE
+ :type type: FileBaseTypeField, optional
+ """
+ super().__init__(
+ id=id,
+ description=description,
+ size=size,
+ path_collection=path_collection,
+ created_at=created_at,
+ modified_at=modified_at,
+ trashed_at=trashed_at,
+ purged_at=purged_at,
+ content_created_at=content_created_at,
+ content_modified_at=content_modified_at,
+ created_by=created_by,
+ modified_by=modified_by,
+ owned_by=owned_by,
+ shared_link=shared_link,
+ parent=parent,
+ item_status=item_status,
+ sequence_id=sequence_id,
+ name=name,
+ sha_1=sha_1,
+ file_version=file_version,
+ etag=etag,
+ type=type,
+ **kwargs
+ )
+ self.version_number = version_number
+ self.comment_count = comment_count
+ self.permissions = permissions
+ self.tags = tags
+ self.lock = lock
+ self.extension = extension
+ self.is_package = is_package
+ self.expiring_embed_link = expiring_embed_link
+ self.watermark_info = watermark_info
+ self.is_accessible_via_shared_link = is_accessible_via_shared_link
+ self.allowed_invitee_roles = allowed_invitee_roles
+ self.is_externally_owned = is_externally_owned
+ self.has_collaborations = has_collaborations
+ self.metadata = metadata
+ self.expires_at = expires_at
+ self.representations = representations
+ self.classification = classification
+ self.uploader_display_name = uploader_display_name
+ self.disposition_at = disposition_at
+ self.shared_link_permission_options = shared_link_permission_options
+ self.is_associated_with_app_item = is_associated_with_app_item
diff --git a/box_sdk_gen/schemas/file_mini.py b/box_sdk_gen/schemas/file_mini.py
new file mode 100644
index 000000000..c8b72f4e7
--- /dev/null
+++ b/box_sdk_gen/schemas/file_mini.py
@@ -0,0 +1,61 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.schemas.file_base import FileBaseTypeField
+
+from box_sdk_gen.schemas.file_base import FileBase
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileMini(FileBase):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'sha_1': 'sha1',
+ **FileBase._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'sha1': 'sha_1',
+ **FileBase._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ sha_1: Optional[str] = None,
+ file_version: Optional[FileVersionMini] = None,
+ etag: Optional[str] = None,
+ type: FileBaseTypeField = FileBaseTypeField.FILE,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent 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`.
+ :type id: str
+ :param name: The name of the file., defaults to None
+ :type name: Optional[str], optional
+ :param sha_1: The SHA1 hash of the file. This can be used to compare the contents
+ of a file on Box with a local file., defaults to None
+ :type sha_1: Optional[str], optional
+ :param etag: The HTTP `etag` of this file. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the file if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `file`., defaults to FileBaseTypeField.FILE
+ :type type: FileBaseTypeField, optional
+ """
+ super().__init__(id=id, etag=etag, type=type, **kwargs)
+ self.sequence_id = sequence_id
+ self.name = name
+ self.sha_1 = sha_1
+ self.file_version = file_version
diff --git a/box_sdk_gen/schemas/file_or_folder_scope.py b/box_sdk_gen/schemas/file_or_folder_scope.py
new file mode 100644
index 000000000..fe5956598
--- /dev/null
+++ b/box_sdk_gen/schemas/file_or_folder_scope.py
@@ -0,0 +1,47 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileOrFolderScopeScopeField(str, Enum):
+ ANNOTATION_EDIT = 'annotation_edit'
+ ANNOTATION_VIEW_ALL = 'annotation_view_all'
+ ANNOTATION_VIEW_SELF = 'annotation_view_self'
+ BASE_EXPLORER = 'base_explorer'
+ BASE_PICKER = 'base_picker'
+ BASE_PREVIEW = 'base_preview'
+ BASE_UPLOAD = 'base_upload'
+ ITEM_DELETE = 'item_delete'
+ ITEM_DOWNLOAD = 'item_download'
+ ITEM_PREVIEW = 'item_preview'
+ ITEM_RENAME = 'item_rename'
+ ITEM_SHARE = 'item_share'
+ ITEM_UPLOAD = 'item_upload'
+ ITEM_READ = 'item_read'
+
+
+class FileOrFolderScope(BaseObject):
+ def __init__(
+ self,
+ *,
+ scope: Optional[FileOrFolderScopeScopeField] = None,
+ object: Optional[Union[FolderMini, FileMini]] = None,
+ **kwargs
+ ):
+ """
+ :param scope: The scopes for the resource access., defaults to None
+ :type scope: Optional[FileOrFolderScopeScopeField], optional
+ """
+ super().__init__(**kwargs)
+ self.scope = scope
+ self.object = object
diff --git a/box_sdk_gen/schemas/file_request.py b/box_sdk_gen/schemas/file_request.py
new file mode 100644
index 000000000..ea17ff10a
--- /dev/null
+++ b/box_sdk_gen/schemas/file_request.py
@@ -0,0 +1,129 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FileRequestTypeField(str, Enum):
+ FILE_REQUEST = 'file_request'
+
+
+class FileRequestStatusField(str, Enum):
+ ACTIVE = 'active'
+ INACTIVE = 'inactive'
+
+
+class FileRequest(BaseObject):
+ _discriminator = 'type', {'file_request'}
+
+ def __init__(
+ self,
+ id: str,
+ folder: FolderMini,
+ created_at: DateTime,
+ updated_at: DateTime,
+ *,
+ type: FileRequestTypeField = FileRequestTypeField.FILE_REQUEST,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ status: Optional[FileRequestStatusField] = None,
+ is_email_required: Optional[bool] = None,
+ is_description_required: Optional[bool] = None,
+ expires_at: Optional[DateTime] = None,
+ url: Optional[str] = None,
+ etag: Optional[str] = None,
+ created_by: Optional[UserMini] = None,
+ updated_by: Optional[UserMini] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this file request.
+ :type id: str
+ :param created_at: The date and time when the file request was created.
+ :type created_at: DateTime
+ :param updated_at: The date and time when the file request was last updated.
+ :type updated_at: DateTime
+ :param type: The value will always be `file_request`., defaults to FileRequestTypeField.FILE_REQUEST
+ :type type: FileRequestTypeField, optional
+ :param title: The title of file request. This is shown
+ in the Box UI to users uploading files.
+
+ This defaults to title of the file request that was
+ copied to create this file request., defaults to None
+ :type title: Optional[str], optional
+ :param description: The optional description of this file request. This is
+ shown in the Box UI to users uploading files.
+
+ This defaults to description of the file request that was
+ copied to create this file request., defaults to None
+ :type description: Optional[str], optional
+ :param status: The status of the file request. This defaults
+ to `active`.
+
+ 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 defaults to status of file request that was
+ copied to create this file request., defaults to None
+ :type status: Optional[FileRequestStatusField], 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
+ an email field on the file request form.
+
+ This defaults to setting of file request that was
+ copied to create this file request., defaults to None
+ :type is_email_required: Optional[bool], optional
+ :param is_description_required: Whether a file request submitter is required to provide
+ a description of the files they are submitting.
+
+ When this setting is set to true, the Box UI will show
+ a description field on the file request form.
+
+ This defaults to setting of file request that was
+ copied to create this file request., defaults to None
+ :type is_description_required: Optional[bool], optional
+ :param expires_at: The date after which a file request will no longer accept new
+ submissions.
+
+ After this date, the `status` will automatically be set to
+ `inactive`., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ :param url: The generated URL for this file request. This URL can be shared
+ with users to let them upload files to the associated folder., defaults to None
+ :type url: Optional[str], optional
+ :param etag: The HTTP `etag` of this file. This can be used in combination with
+ the `If-Match` header when updating a file request. By providing that
+ header, a change will only be performed on the file request if the `etag`
+ on the file request still matches the `etag` provided in the `If-Match`
+ header., defaults to None
+ :type etag: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.folder = folder
+ self.created_at = created_at
+ self.updated_at = updated_at
+ self.type = type
+ self.title = title
+ self.description = description
+ self.status = status
+ self.is_email_required = is_email_required
+ self.is_description_required = is_description_required
+ self.expires_at = expires_at
+ self.url = url
+ self.etag = etag
+ self.created_by = created_by
+ self.updated_by = updated_by
diff --git a/box_sdk_gen/schemas/file_request_copy_request.py b/box_sdk_gen/schemas/file_request_copy_request.py
new file mode 100644
index 000000000..93fc86e18
--- /dev/null
+++ b/box_sdk_gen/schemas/file_request_copy_request.py
@@ -0,0 +1,113 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_request_update_request import (
+ FileRequestUpdateRequestStatusField,
+)
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.file_request_update_request import FileRequestUpdateRequest
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileRequestCopyRequestFolderTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class FileRequestCopyRequestFolderField(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: Optional[FileRequestCopyRequestFolderTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the folder to associate the new
+ file request to.
+ :type id: str
+ :param type: The value will always be `folder`., defaults to None
+ :type type: Optional[FileRequestCopyRequestFolderTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class FileRequestCopyRequest(FileRequestUpdateRequest):
+ def __init__(
+ self,
+ folder: FileRequestCopyRequestFolderField,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ status: Optional[FileRequestUpdateRequestStatusField] = None,
+ is_email_required: Optional[bool] = None,
+ is_description_required: Optional[bool] = None,
+ expires_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param folder: The folder to associate the new file request to.
+ :type folder: FileRequestCopyRequestFolderField
+ :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., defaults to None
+ :type title: Optional[str], optional
+ :param description: 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., defaults to None
+ :type description: Optional[str], optional
+ :param status: 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., defaults to None
+ :type status: Optional[FileRequestUpdateRequestStatusField], 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
+ an email field on the file request form.
+
+ This will default to the value on the existing file request., defaults to None
+ :type is_email_required: Optional[bool], optional
+ :param is_description_required: Whether a file request submitter is required to provide
+ a description of the files they are submitting.
+
+ When this setting is set to true, the Box UI will show
+ a description field on the file request form.
+
+ This will default to the value on the existing file request., defaults to None
+ :type is_description_required: Optional[bool], optional
+ :param expires_at: The date after which a file request will no longer accept new
+ submissions.
+
+ After this date, the `status` will automatically be set to
+ `inactive`.
+
+ This will default to the value on the existing file request., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ """
+ super().__init__(
+ title=title,
+ description=description,
+ status=status,
+ is_email_required=is_email_required,
+ is_description_required=is_description_required,
+ expires_at=expires_at,
+ **kwargs
+ )
+ self.folder = folder
diff --git a/box_sdk_gen/schemas/file_request_update_request.py b/box_sdk_gen/schemas/file_request_update_request.py
new file mode 100644
index 000000000..e496d6124
--- /dev/null
+++ b/box_sdk_gen/schemas/file_request_update_request.py
@@ -0,0 +1,80 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FileRequestUpdateRequestStatusField(str, Enum):
+ ACTIVE = 'active'
+ INACTIVE = 'inactive'
+
+
+class FileRequestUpdateRequest(BaseObject):
+ def __init__(
+ self,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ status: Optional[FileRequestUpdateRequestStatusField] = None,
+ is_email_required: Optional[bool] = None,
+ is_description_required: Optional[bool] = None,
+ expires_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :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., defaults to None
+ :type title: Optional[str], optional
+ :param description: 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., defaults to None
+ :type description: Optional[str], optional
+ :param status: 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., defaults to None
+ :type status: Optional[FileRequestUpdateRequestStatusField], 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
+ an email field on the file request form.
+
+ This will default to the value on the existing file request., defaults to None
+ :type is_email_required: Optional[bool], optional
+ :param is_description_required: Whether a file request submitter is required to provide
+ a description of the files they are submitting.
+
+ When this setting is set to true, the Box UI will show
+ a description field on the file request form.
+
+ This will default to the value on the existing file request., defaults to None
+ :type is_description_required: Optional[bool], optional
+ :param expires_at: The date after which a file request will no longer accept new
+ submissions.
+
+ After this date, the `status` will automatically be set to
+ `inactive`.
+
+ This will default to the value on the existing file request., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.title = title
+ self.description = description
+ self.status = status
+ self.is_email_required = is_email_required
+ self.is_description_required = is_description_required
+ self.expires_at = expires_at
diff --git a/box_sdk_gen/schemas/file_version.py b/box_sdk_gen/schemas/file_version.py
new file mode 100644
index 000000000..3b213fb07
--- /dev/null
+++ b/box_sdk_gen/schemas/file_version.py
@@ -0,0 +1,69 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.file_version_base import FileVersionBaseTypeField
+
+from box_sdk_gen.schemas.file_version_base import FileVersionBase
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FileVersion(FileVersionMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ size: Optional[int] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ modified_by: Optional[UserMini] = None,
+ trashed_at: Optional[DateTime] = None,
+ trashed_by: Optional[UserMini] = None,
+ restored_at: Optional[DateTime] = None,
+ restored_by: Optional[UserMini] = None,
+ purged_at: Optional[DateTime] = None,
+ uploader_display_name: Optional[str] = None,
+ sha_1: Optional[str] = None,
+ type: FileVersionBaseTypeField = FileVersionBaseTypeField.FILE_VERSION,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a file version.
+ :type id: str
+ :param name: The name of the file version., defaults to None
+ :type name: Optional[str], optional
+ :param size: Size of the file version in bytes., defaults to None
+ :type size: Optional[int], optional
+ :param created_at: When the file version object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the file version object was last updated., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param trashed_at: When the file version object was trashed., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param restored_at: When the file version was restored from the trash., defaults to None
+ :type restored_at: Optional[DateTime], optional
+ :param purged_at: When the file version object will be permanently deleted., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param sha_1: The SHA1 hash of this version of the file., defaults to None
+ :type sha_1: Optional[str], optional
+ :param type: The value will always be `file_version`., defaults to FileVersionBaseTypeField.FILE_VERSION
+ :type type: FileVersionBaseTypeField, optional
+ """
+ super().__init__(id=id, sha_1=sha_1, type=type, **kwargs)
+ self.name = name
+ self.size = size
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.modified_by = modified_by
+ self.trashed_at = trashed_at
+ self.trashed_by = trashed_by
+ self.restored_at = restored_at
+ self.restored_by = restored_by
+ self.purged_at = purged_at
+ self.uploader_display_name = uploader_display_name
diff --git a/box_sdk_gen/schemas/file_version_base.py b/box_sdk_gen/schemas/file_version_base.py
new file mode 100644
index 000000000..d6fba5be6
--- /dev/null
+++ b/box_sdk_gen/schemas/file_version_base.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileVersionBaseTypeField(str, Enum):
+ FILE_VERSION = 'file_version'
+
+
+class FileVersionBase(BaseObject):
+ _discriminator = 'type', {'file_version'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: FileVersionBaseTypeField = FileVersionBaseTypeField.FILE_VERSION,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a file version.
+ :type id: str
+ :param type: The value will always be `file_version`., defaults to FileVersionBaseTypeField.FILE_VERSION
+ :type type: FileVersionBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/file_version_full.py b/box_sdk_gen/schemas/file_version_full.py
new file mode 100644
index 000000000..7d778bd3a
--- /dev/null
+++ b/box_sdk_gen/schemas/file_version_full.py
@@ -0,0 +1,80 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.file_version_base import FileVersionBaseTypeField
+
+from box_sdk_gen.schemas.file_version_base import FileVersionBase
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.file_version import FileVersion
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileVersionFull(FileVersion):
+ def __init__(
+ self,
+ id: str,
+ *,
+ version_number: Optional[str] = None,
+ name: Optional[str] = None,
+ size: Optional[int] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ modified_by: Optional[UserMini] = None,
+ trashed_at: Optional[DateTime] = None,
+ trashed_by: Optional[UserMini] = None,
+ restored_at: Optional[DateTime] = None,
+ restored_by: Optional[UserMini] = None,
+ purged_at: Optional[DateTime] = None,
+ uploader_display_name: Optional[str] = None,
+ sha_1: Optional[str] = None,
+ type: FileVersionBaseTypeField = FileVersionBaseTypeField.FILE_VERSION,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a file version.
+ :type id: str
+ :param version_number: The version number of this file version., defaults to None
+ :type version_number: Optional[str], optional
+ :param name: The name of the file version., defaults to None
+ :type name: Optional[str], optional
+ :param size: Size of the file version in bytes., defaults to None
+ :type size: Optional[int], optional
+ :param created_at: When the file version object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the file version object was last updated., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param trashed_at: When the file version object was trashed., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param restored_at: When the file version was restored from the trash., defaults to None
+ :type restored_at: Optional[DateTime], optional
+ :param purged_at: When the file version object will be permanently deleted., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param sha_1: The SHA1 hash of this version of the file., defaults to None
+ :type sha_1: Optional[str], optional
+ :param type: The value will always be `file_version`., defaults to FileVersionBaseTypeField.FILE_VERSION
+ :type type: FileVersionBaseTypeField, optional
+ """
+ super().__init__(
+ id=id,
+ name=name,
+ size=size,
+ created_at=created_at,
+ modified_at=modified_at,
+ modified_by=modified_by,
+ trashed_at=trashed_at,
+ trashed_by=trashed_by,
+ restored_at=restored_at,
+ restored_by=restored_by,
+ purged_at=purged_at,
+ uploader_display_name=uploader_display_name,
+ sha_1=sha_1,
+ type=type,
+ **kwargs
+ )
+ self.version_number = version_number
diff --git a/box_sdk_gen/schemas/file_version_legal_hold.py b/box_sdk_gen/schemas/file_version_legal_hold.py
new file mode 100644
index 000000000..67da341f4
--- /dev/null
+++ b/box_sdk_gen/schemas/file_version_legal_hold.py
@@ -0,0 +1,55 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.legal_hold_policy_assignment import LegalHoldPolicyAssignment
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FileVersionLegalHoldTypeField(str, Enum):
+ FILE_VERSION_LEGAL_HOLD = 'file_version_legal_hold'
+
+
+class FileVersionLegalHold(BaseObject):
+ _discriminator = 'type', {'file_version_legal_hold'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[FileVersionLegalHoldTypeField] = None,
+ file_version: Optional[FileVersionMini] = None,
+ file: Optional[FileMini] = None,
+ legal_hold_policy_assignments: Optional[List[LegalHoldPolicyAssignment]] = None,
+ deleted_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this file version legal hold., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `file_version_legal_hold`., defaults to None
+ :type type: Optional[FileVersionLegalHoldTypeField], optional
+ :param legal_hold_policy_assignments: List of assignments contributing to this Hold., defaults to None
+ :type legal_hold_policy_assignments: Optional[List[LegalHoldPolicyAssignment]], optional
+ :param deleted_at: Time that this File-Version-Legal-Hold was
+ deleted., defaults to None
+ :type deleted_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.file_version = file_version
+ self.file = file
+ self.legal_hold_policy_assignments = legal_hold_policy_assignments
+ self.deleted_at = deleted_at
diff --git a/box_sdk_gen/schemas/file_version_legal_holds.py b/box_sdk_gen/schemas/file_version_legal_holds.py
new file mode 100644
index 000000000..fcf4c11dd
--- /dev/null
+++ b/box_sdk_gen/schemas/file_version_legal_holds.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_version_legal_hold import FileVersionLegalHold
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileVersionLegalHolds(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[FileVersionLegalHold]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of file version legal holds., defaults to None
+ :type entries: Optional[List[FileVersionLegalHold]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/file_version_mini.py b/box_sdk_gen/schemas/file_version_mini.py
new file mode 100644
index 000000000..d4c03e4c9
--- /dev/null
+++ b/box_sdk_gen/schemas/file_version_mini.py
@@ -0,0 +1,39 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.schemas.file_version_base import FileVersionBaseTypeField
+
+from box_sdk_gen.schemas.file_version_base import FileVersionBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileVersionMini(FileVersionBase):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'sha_1': 'sha1',
+ **FileVersionBase._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'sha1': 'sha_1',
+ **FileVersionBase._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ sha_1: Optional[str] = None,
+ type: FileVersionBaseTypeField = FileVersionBaseTypeField.FILE_VERSION,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a file version.
+ :type id: str
+ :param sha_1: The SHA1 hash of this version of the file., defaults to None
+ :type sha_1: Optional[str], optional
+ :param type: The value will always be `file_version`., defaults to FileVersionBaseTypeField.FILE_VERSION
+ :type type: FileVersionBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.sha_1 = sha_1
diff --git a/box_sdk_gen/schemas/file_version_retention.py b/box_sdk_gen/schemas/file_version_retention.py
new file mode 100644
index 000000000..3321cc4f7
--- /dev/null
+++ b/box_sdk_gen/schemas/file_version_retention.py
@@ -0,0 +1,56 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.retention_policy_mini import RetentionPolicyMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FileVersionRetentionTypeField(str, Enum):
+ FILE_VERSION_RETENTION = 'file_version_retention'
+
+
+class FileVersionRetention(BaseObject):
+ _discriminator = 'type', {'file_version_retention'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[FileVersionRetentionTypeField] = None,
+ file_version: Optional[FileVersionMini] = None,
+ file: Optional[FileMini] = None,
+ applied_at: Optional[DateTime] = None,
+ disposition_at: Optional[DateTime] = None,
+ winning_retention_policy: Optional[RetentionPolicyMini] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this file version retention., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `file_version_retention`., defaults to None
+ :type type: Optional[FileVersionRetentionTypeField], optional
+ :param applied_at: When this file version retention object was
+ created., defaults to None
+ :type applied_at: Optional[DateTime], optional
+ :param disposition_at: When the retention expires on this file
+ version retention., defaults to None
+ :type disposition_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.file_version = file_version
+ self.file = file
+ self.applied_at = applied_at
+ self.disposition_at = disposition_at
+ self.winning_retention_policy = winning_retention_policy
diff --git a/box_sdk_gen/schemas/file_version_retentions.py b/box_sdk_gen/schemas/file_version_retentions.py
new file mode 100644
index 000000000..e83034c38
--- /dev/null
+++ b/box_sdk_gen/schemas/file_version_retentions.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_version_retention import FileVersionRetention
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileVersionRetentions(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[FileVersionRetention]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of file version retentions., defaults to None
+ :type entries: Optional[List[FileVersionRetention]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/file_versions.py b/box_sdk_gen/schemas/file_versions.py
new file mode 100644
index 000000000..494f249cd
--- /dev/null
+++ b/box_sdk_gen/schemas/file_versions.py
@@ -0,0 +1,80 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.file_version_full import FileVersionFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileVersionsOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class FileVersionsOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[FileVersionsOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[FileVersionsOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class FileVersions(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[FileVersionsOrderField]] = None,
+ entries: Optional[List[FileVersionFull]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[FileVersionsOrderField]], optional
+ :param entries: A list of file versions., defaults to None
+ :type entries: Optional[List[FileVersionFull]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/files.py b/box_sdk_gen/schemas/files.py
new file mode 100644
index 000000000..428c1fcab
--- /dev/null
+++ b/box_sdk_gen/schemas/files.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Files(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ entries: Optional[List[FileFull]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: The number of files., defaults to None
+ :type total_count: Optional[int], optional
+ :param entries: A list of files., defaults to None
+ :type entries: Optional[List[FileFull]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/files_on_hold.py b/box_sdk_gen/schemas/files_on_hold.py
new file mode 100644
index 000000000..9918c0066
--- /dev/null
+++ b/box_sdk_gen/schemas/files_on_hold.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FilesOnHold(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[FileMini]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of files., defaults to None
+ :type entries: Optional[List[FileMini]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/files_under_retention.py b/box_sdk_gen/schemas/files_under_retention.py
new file mode 100644
index 000000000..6b2211a75
--- /dev/null
+++ b/box_sdk_gen/schemas/files_under_retention.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FilesUnderRetention(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[FileMini]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of files., defaults to None
+ :type entries: Optional[List[FileMini]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/folder.py b/box_sdk_gen/schemas/folder.py
new file mode 100644
index 000000000..a0330bec5
--- /dev/null
+++ b/box_sdk_gen/schemas/folder.py
@@ -0,0 +1,313 @@
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.schemas.folder_base import FolderBaseTypeField
+
+from box_sdk_gen.schemas.folder_base import FolderBase
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.items import Items
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FolderPathCollectionField(BaseObject):
+ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs):
+ """
+ :param total_count: The number of folders in this list.
+ :type total_count: int
+ :param entries: The parent folders for this item.
+ :type entries: List[FolderMini]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class FolderSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class FolderSharedLinkEffectiveAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class FolderSharedLinkEffectivePermissionField(str, Enum):
+ CAN_EDIT = 'can_edit'
+ CAN_DOWNLOAD = 'can_download'
+ CAN_PREVIEW = 'can_preview'
+ NO_ACCESS = 'no_access'
+
+
+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
+ shared links on folders, this also applies to any items in the folder.
+
+ This value can be set to `true` when the effective access level is
+ set to `open` or `company`, not `collaborators`.
+ :type can_download: bool
+ :param can_preview: Defines if the shared link allows for the item to be previewed.
+
+ This value is always `true`. For shared links on folders this also
+ applies to any items in the folder.
+ :type can_preview: bool
+ :param can_edit: Defines if the shared link allows for the item to be edited.
+
+ This value can only be `true` if `can_download` is also `true` and if
+ the item has a type of `file`.
+ :type can_edit: bool
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class FolderSharedLinkField(BaseObject):
+ def __init__(
+ self,
+ url: str,
+ 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[FolderSharedLinkAccessField] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[FolderSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param url: The URL that can be used to access the item on Box.
+
+ This URL will display the item in Box's preview UI where the file
+ can be downloaded if allowed.
+
+ This URL will continue to work even when a custom `vanity_url`
+ has been set for this shared link.
+ :type url: str
+ :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: 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: 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.
+ :type download_count: int
+ :param preview_count: The number of times this item has been previewed.
+ :type preview_count: int
+ :param download_url: A URL that can be used to download the file. This URL can be used in
+ a browser to download the file. This URL includes the file
+ extension so that the file will be saved with the right file type.
+
+ This property will be `null` for folders., defaults to None
+ :type download_url: Optional[str], optional
+ :param vanity_url: The "Custom URL" that can also be used to preview the item on Box. Custom
+ URLs can only be created or modified in the Box Web application., defaults to None
+ :type vanity_url: Optional[str], optional
+ :param vanity_name: The custom name of a shared link, as used in the `vanity_url` field., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param access: The access level for this shared link.
+
+ * `open` - provides access to this item to anyone with this link
+ * `company` - only provides access to this item to people the same company
+ * `collaborators` - only provides access to this item to people who are
+ 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., defaults to None
+ :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., defaults to None
+ :type unshared_at: Optional[DateTime], 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., defaults to None
+ :type permissions: Optional[FolderSharedLinkPermissionsField], optional
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.effective_access = effective_access
+ self.effective_permission = effective_permission
+ self.is_password_enabled = is_password_enabled
+ self.download_count = download_count
+ self.preview_count = preview_count
+ self.download_url = download_url
+ self.vanity_url = vanity_url
+ self.vanity_name = vanity_name
+ self.access = access
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class FolderFolderUploadEmailAccessField(str, Enum):
+ OPEN = 'open'
+ COLLABORATORS = 'collaborators'
+
+
+class FolderFolderUploadEmailField(BaseObject):
+ def __init__(
+ self,
+ *,
+ access: Optional[FolderFolderUploadEmailAccessField] = None,
+ email: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param access: When this parameter has been set, users can email files
+ to the email address that has been automatically
+ created for this folder.
+
+ To create an email address, set this property either when
+ creating or updating the folder.
+
+ When set to `collaborators`, only emails from registered email
+ addresses for collaborators will be accepted. This includes
+ any email aliases a user might have registered.
+
+ When set to `open` it will accept emails from any email
+ address., defaults to None
+ :type access: Optional[FolderFolderUploadEmailAccessField], optional
+ :param email: The optional upload email address for this folder., defaults to None
+ :type email: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.access = access
+ self.email = email
+
+
+class FolderItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class Folder(FolderMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ description: Optional[str] = None,
+ size: Optional[int] = None,
+ path_collection: Optional[FolderPathCollectionField] = None,
+ created_by: Optional[UserMini] = None,
+ modified_by: Optional[UserMini] = None,
+ trashed_at: Optional[DateTime] = None,
+ purged_at: Optional[DateTime] = None,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ owned_by: Optional[UserMini] = None,
+ shared_link: Optional[FolderSharedLinkField] = None,
+ folder_upload_email: Optional[FolderFolderUploadEmailField] = None,
+ parent: Optional[FolderMini] = None,
+ item_status: Optional[FolderItemStatusField] = None,
+ item_collection: Optional[Items] = None,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ etag: Optional[str] = None,
+ type: FolderBaseTypeField = FolderBaseTypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a folder.
+
+ The ID for any folder can be determined
+ by visiting a folder in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/folders/123`
+ the `folder_id` is `123`.
+ :type id: str
+ :param created_at: The date and time when the folder was created. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The date and time when the folder was last updated. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param size: The folder size in bytes.
+
+ Be careful parsing this integer as its
+ value can get very large., defaults to None
+ :type size: Optional[int], optional
+ :param trashed_at: The time at which this folder was put in the trash., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param purged_at: The time at which this folder is expected to be purged
+ from the trash., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param content_created_at: The date and time at which this folder was originally
+ created., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: The date and time at which this folder was last updated., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ :param folder_upload_email: The `folder_upload_email` parameter is not `null` if one of the following options is **true**:
+
+ * The **Allow uploads to this folder via email** and the **Only allow email uploads from collaborators in this folder** are [enabled for a folder in the Admin Console](https://support.box.com/hc/en-us/articles/360043697534-Upload-to-Box-Through-Email), and the user has at least **Upload** permissions granted.
+
+ * The **Allow uploads to this folder via email** setting is enabled for a folder in the Admin Console, and the **Only allow email uploads from collaborators in this folder** setting is deactivated (unchecked).
+
+ If the conditions are not met, the parameter will have the following value: `folder_upload_email: null`., defaults to None
+ :type folder_upload_email: Optional[FolderFolderUploadEmailField], optional
+ :param item_status: Defines if this item has been deleted or not.
+
+ * `active` when the item has is not in the trash
+ * `trashed` when the item has been moved to the trash but not deleted
+ * `deleted` when the item has been permanently deleted., defaults to None
+ :type item_status: Optional[FolderItemStatusField], optional
+ :param name: The name of the folder., defaults to None
+ :type name: Optional[str], optional
+ :param etag: The HTTP `etag` of this folder. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the folder if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `folder`., defaults to FolderBaseTypeField.FOLDER
+ :type type: FolderBaseTypeField, optional
+ """
+ super().__init__(
+ id=id, sequence_id=sequence_id, name=name, etag=etag, type=type, **kwargs
+ )
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.description = description
+ self.size = size
+ self.path_collection = path_collection
+ self.created_by = created_by
+ self.modified_by = modified_by
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.content_created_at = content_created_at
+ self.content_modified_at = content_modified_at
+ self.owned_by = owned_by
+ self.shared_link = shared_link
+ self.folder_upload_email = folder_upload_email
+ self.parent = parent
+ self.item_status = item_status
+ self.item_collection = item_collection
diff --git a/box_sdk_gen/schemas/folder_base.py b/box_sdk_gen/schemas/folder_base.py
new file mode 100644
index 000000000..251e11c9d
--- /dev/null
+++ b/box_sdk_gen/schemas/folder_base.py
@@ -0,0 +1,44 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FolderBaseTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class FolderBase(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ etag: Optional[str] = None,
+ type: FolderBaseTypeField = FolderBaseTypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a folder.
+
+ The ID for any folder can be determined
+ by visiting a folder in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/folders/123`
+ the `folder_id` is `123`.
+ :type id: str
+ :param etag: The HTTP `etag` of this folder. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the folder if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `folder`., defaults to FolderBaseTypeField.FOLDER
+ :type type: FolderBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.etag = etag
+ self.type = type
diff --git a/box_sdk_gen/schemas/folder_full.py b/box_sdk_gen/schemas/folder_full.py
new file mode 100644
index 000000000..dff8b9f69
--- /dev/null
+++ b/box_sdk_gen/schemas/folder_full.py
@@ -0,0 +1,314 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.folder_base import FolderBaseTypeField
+
+from box_sdk_gen.schemas.folder_base import FolderBase
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.folder import FolderPathCollectionField
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.folder import FolderSharedLinkField
+
+from box_sdk_gen.schemas.folder import FolderFolderUploadEmailField
+
+from box_sdk_gen.schemas.folder import FolderItemStatusField
+
+from box_sdk_gen.schemas.items import Items
+
+from box_sdk_gen.schemas.folder import Folder
+
+from box_sdk_gen.schemas.metadata_full import MetadataFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FolderFullSyncStateField(str, Enum):
+ SYNCED = 'synced'
+ NOT_SYNCED = 'not_synced'
+ PARTIALLY_SYNCED = 'partially_synced'
+
+
+class FolderFullPermissionsField(BaseObject):
+ def __init__(
+ self,
+ can_delete: bool,
+ can_download: bool,
+ can_invite_collaborator: bool,
+ can_rename: bool,
+ can_set_share_access: bool,
+ can_share: bool,
+ can_upload: bool,
+ **kwargs
+ ):
+ """
+ :param can_delete: Specifies if the current user can delete this item.
+ :type can_delete: bool
+ :param can_download: Specifies if the current user can download this item.
+ :type can_download: bool
+ :param can_invite_collaborator: Specifies if the current user can invite new
+ users to collaborate on this item, and if the user can
+ update the role of a user already collaborated on this
+ item.
+ :type can_invite_collaborator: bool
+ :param can_rename: Specifies if the user can rename this item.
+ :type can_rename: bool
+ :param can_set_share_access: Specifies if the user can change the access level of an
+ existing shared link on this item.
+ :type can_set_share_access: bool
+ :param can_share: Specifies if the user can create a shared link for this item.
+ :type can_share: bool
+ :param can_upload: Specifies if the user can upload into this folder.
+ :type can_upload: bool
+ """
+ super().__init__(**kwargs)
+ self.can_delete = can_delete
+ self.can_download = can_download
+ self.can_invite_collaborator = can_invite_collaborator
+ self.can_rename = can_rename
+ self.can_set_share_access = can_set_share_access
+ self.can_share = can_share
+ self.can_upload = can_upload
+
+
+class FolderFullMetadataField(BaseObject):
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+ self.extra_data = kwargs
+
+
+class FolderFullAllowedSharedLinkAccessLevelsField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class FolderFullAllowedInviteeRolesField(str, Enum):
+ EDITOR = 'editor'
+ VIEWER = 'viewer'
+ PREVIEWER = 'previewer'
+ UPLOADER = 'uploader'
+ PREVIEWER_UPLOADER = 'previewer uploader'
+ VIEWER_UPLOADER = 'viewer uploader'
+ CO_OWNER = 'co-owner'
+
+
+class FolderFullWatermarkInfoField(BaseObject):
+ def __init__(self, *, is_watermarked: Optional[bool] = None, **kwargs):
+ """
+ :param is_watermarked: Specifies if this item has a watermark applied., defaults to None
+ :type is_watermarked: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.is_watermarked = is_watermarked
+
+
+class FolderFullClassificationField(BaseObject):
+ def __init__(
+ self,
+ *,
+ name: Optional[str] = None,
+ definition: Optional[str] = None,
+ color: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param name: The name of the classification., defaults to None
+ :type name: Optional[str], optional
+ :param definition: An explanation of the meaning of this classification., defaults to None
+ :type definition: Optional[str], optional
+ :param color: The color that is used to display the
+ classification label in a user-interface. Colors are defined by the admin
+ or co-admin who created the classification in the Box web app., defaults to None
+ :type color: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.definition = definition
+ self.color = color
+
+
+class FolderFull(Folder):
+ def __init__(
+ self,
+ id: str,
+ *,
+ sync_state: Optional[FolderFullSyncStateField] = None,
+ has_collaborations: Optional[bool] = None,
+ permissions: Optional[FolderFullPermissionsField] = None,
+ tags: Optional[List[str]] = None,
+ can_non_owners_invite: Optional[bool] = None,
+ is_externally_owned: Optional[bool] = None,
+ metadata: Optional[FolderFullMetadataField] = None,
+ is_collaboration_restricted_to_enterprise: Optional[bool] = None,
+ allowed_shared_link_access_levels: Optional[
+ List[FolderFullAllowedSharedLinkAccessLevelsField]
+ ] = None,
+ allowed_invitee_roles: Optional[
+ List[FolderFullAllowedInviteeRolesField]
+ ] = None,
+ watermark_info: Optional[FolderFullWatermarkInfoField] = None,
+ is_accessible_via_shared_link: Optional[bool] = None,
+ can_non_owners_view_collaborators: Optional[bool] = None,
+ classification: Optional[FolderFullClassificationField] = None,
+ is_associated_with_app_item: Optional[bool] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ description: Optional[str] = None,
+ size: Optional[int] = None,
+ path_collection: Optional[FolderPathCollectionField] = None,
+ created_by: Optional[UserMini] = None,
+ modified_by: Optional[UserMini] = None,
+ trashed_at: Optional[DateTime] = None,
+ purged_at: Optional[DateTime] = None,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ owned_by: Optional[UserMini] = None,
+ shared_link: Optional[FolderSharedLinkField] = None,
+ folder_upload_email: Optional[FolderFolderUploadEmailField] = None,
+ parent: Optional[FolderMini] = None,
+ item_status: Optional[FolderItemStatusField] = None,
+ item_collection: Optional[Items] = None,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ etag: Optional[str] = None,
+ type: FolderBaseTypeField = FolderBaseTypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a folder.
+
+ The ID for any folder can be determined
+ by visiting a folder in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/folders/123`
+ the `folder_id` is `123`.
+ :type id: str
+ :param has_collaborations: Specifies if this folder has any other collaborators., defaults to None
+ :type has_collaborations: Optional[bool], optional
+ :param is_externally_owned: Specifies if this folder is owned by a user outside of the
+ authenticated enterprise., defaults to None
+ :type is_externally_owned: Optional[bool], optional
+ :param allowed_shared_link_access_levels: A list of access levels that are available
+ for this folder.
+
+ For some folders, like the root folder, this will always
+ be an empty list as sharing is not allowed at that level., defaults to None
+ :type allowed_shared_link_access_levels: Optional[List[FolderFullAllowedSharedLinkAccessLevelsField]], optional
+ :param allowed_invitee_roles: A list of the types of roles that user can be invited at
+ when sharing this folder., defaults to None
+ :type allowed_invitee_roles: Optional[List[FolderFullAllowedInviteeRolesField]], optional
+ :param is_accessible_via_shared_link: Specifies if the folder can be accessed
+ with the direct shared link or a shared link
+ to a parent folder., defaults to None
+ :type is_accessible_via_shared_link: Optional[bool], optional
+ :param can_non_owners_view_collaborators: Specifies if collaborators who are not owners
+ of this folder are restricted from viewing other
+ collaborations on this folder.
+
+ It also restricts non-owners from inviting new
+ collaborators., defaults to None
+ :type can_non_owners_view_collaborators: Optional[bool], optional
+ :param is_associated_with_app_item: This field will return true if the folder or any ancestor of the
+ folder is associated with at least one app item. Note that this will
+ return true even if the context user does not have access to the
+ app item(s) associated with the folder., defaults to None
+ :type is_associated_with_app_item: Optional[bool], optional
+ :param created_at: The date and time when the folder was created. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The date and time when the folder was last updated. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param size: The folder size in bytes.
+
+ Be careful parsing this integer as its
+ value can get very large., defaults to None
+ :type size: Optional[int], optional
+ :param trashed_at: The time at which this folder was put in the trash., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param purged_at: The time at which this folder is expected to be purged
+ from the trash., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param content_created_at: The date and time at which this folder was originally
+ created., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: The date and time at which this folder was last updated., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ :param folder_upload_email: The `folder_upload_email` parameter is not `null` if one of the following options is **true**:
+
+ * The **Allow uploads to this folder via email** and the **Only allow email uploads from collaborators in this folder** are [enabled for a folder in the Admin Console](https://support.box.com/hc/en-us/articles/360043697534-Upload-to-Box-Through-Email), and the user has at least **Upload** permissions granted.
+
+ * The **Allow uploads to this folder via email** setting is enabled for a folder in the Admin Console, and the **Only allow email uploads from collaborators in this folder** setting is deactivated (unchecked).
+
+ If the conditions are not met, the parameter will have the following value: `folder_upload_email: null`., defaults to None
+ :type folder_upload_email: Optional[FolderFolderUploadEmailField], optional
+ :param item_status: Defines if this item has been deleted or not.
+
+ * `active` when the item has is not in the trash
+ * `trashed` when the item has been moved to the trash but not deleted
+ * `deleted` when the item has been permanently deleted., defaults to None
+ :type item_status: Optional[FolderItemStatusField], optional
+ :param name: The name of the folder., defaults to None
+ :type name: Optional[str], optional
+ :param etag: The HTTP `etag` of this folder. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the folder if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `folder`., defaults to FolderBaseTypeField.FOLDER
+ :type type: FolderBaseTypeField, optional
+ """
+ super().__init__(
+ id=id,
+ created_at=created_at,
+ modified_at=modified_at,
+ description=description,
+ size=size,
+ path_collection=path_collection,
+ created_by=created_by,
+ modified_by=modified_by,
+ trashed_at=trashed_at,
+ purged_at=purged_at,
+ content_created_at=content_created_at,
+ content_modified_at=content_modified_at,
+ owned_by=owned_by,
+ shared_link=shared_link,
+ folder_upload_email=folder_upload_email,
+ parent=parent,
+ item_status=item_status,
+ item_collection=item_collection,
+ sequence_id=sequence_id,
+ name=name,
+ etag=etag,
+ type=type,
+ **kwargs
+ )
+ self.sync_state = sync_state
+ self.has_collaborations = has_collaborations
+ self.permissions = permissions
+ self.tags = tags
+ self.can_non_owners_invite = can_non_owners_invite
+ self.is_externally_owned = is_externally_owned
+ self.metadata = metadata
+ self.is_collaboration_restricted_to_enterprise = (
+ is_collaboration_restricted_to_enterprise
+ )
+ self.allowed_shared_link_access_levels = allowed_shared_link_access_levels
+ self.allowed_invitee_roles = allowed_invitee_roles
+ self.watermark_info = watermark_info
+ self.is_accessible_via_shared_link = is_accessible_via_shared_link
+ self.can_non_owners_view_collaborators = can_non_owners_view_collaborators
+ self.classification = classification
+ self.is_associated_with_app_item = is_associated_with_app_item
diff --git a/box_sdk_gen/schemas/folder_lock.py b/box_sdk_gen/schemas/folder_lock.py
new file mode 100644
index 000000000..ab97830ae
--- /dev/null
+++ b/box_sdk_gen/schemas/folder_lock.py
@@ -0,0 +1,61 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class FolderLockLockedOperationsField(BaseObject):
+ def __init__(self, move: bool, delete: bool, **kwargs):
+ """
+ :param move: Whether moving the folder is restricted.
+ :type move: bool
+ :param delete: Whether deleting the folder is restricted.
+ :type delete: bool
+ """
+ super().__init__(**kwargs)
+ self.move = move
+ self.delete = delete
+
+
+class FolderLock(BaseObject):
+ def __init__(
+ self,
+ *,
+ folder: Optional[FolderMini] = None,
+ id: Optional[str] = None,
+ type: Optional[str] = None,
+ created_by: Optional[UserBase] = None,
+ created_at: Optional[DateTime] = None,
+ locked_operations: Optional[FolderLockLockedOperationsField] = None,
+ lock_type: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this folder lock., defaults to None
+ :type id: Optional[str], optional
+ :param type: The object type, always `folder_lock`., defaults to None
+ :type type: Optional[str], optional
+ :param created_at: When the folder lock object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param locked_operations: The operations that have been locked. Currently the `move`
+ and `delete` operations cannot be locked separately, and both need to be
+ set to `true`., defaults to None
+ :type locked_operations: Optional[FolderLockLockedOperationsField], optional
+ :param lock_type: The lock type, always `freeze`., defaults to None
+ :type lock_type: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.folder = folder
+ self.id = id
+ self.type = type
+ self.created_by = created_by
+ self.created_at = created_at
+ self.locked_operations = locked_operations
+ self.lock_type = lock_type
diff --git a/box_sdk_gen/schemas/folder_locks.py b/box_sdk_gen/schemas/folder_locks.py
new file mode 100644
index 000000000..6f0ca8c5f
--- /dev/null
+++ b/box_sdk_gen/schemas/folder_locks.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.folder_lock import FolderLock
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FolderLocks(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[FolderLock]] = None,
+ limit: Optional[str] = None,
+ next_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list of folder locks., defaults to None
+ :type entries: Optional[List[FolderLock]], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[str], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
diff --git a/box_sdk_gen/schemas/folder_mini.py b/box_sdk_gen/schemas/folder_mini.py
new file mode 100644
index 000000000..1e7d71a14
--- /dev/null
+++ b/box_sdk_gen/schemas/folder_mini.py
@@ -0,0 +1,41 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.folder_base import FolderBaseTypeField
+
+from box_sdk_gen.schemas.folder_base import FolderBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FolderMini(FolderBase):
+ def __init__(
+ self,
+ id: str,
+ *,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ etag: Optional[str] = None,
+ type: FolderBaseTypeField = FolderBaseTypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a folder.
+
+ The ID for any folder can be determined
+ by visiting a folder in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/folders/123`
+ the `folder_id` is `123`.
+ :type id: str
+ :param name: The name of the folder., defaults to None
+ :type name: Optional[str], optional
+ :param etag: The HTTP `etag` of this folder. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the folder if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `folder`., defaults to FolderBaseTypeField.FOLDER
+ :type type: FolderBaseTypeField, optional
+ """
+ super().__init__(id=id, etag=etag, type=type, **kwargs)
+ self.sequence_id = sequence_id
+ self.name = name
diff --git a/box_sdk_gen/schemas/folder_reference.py b/box_sdk_gen/schemas/folder_reference.py
new file mode 100644
index 000000000..a99575569
--- /dev/null
+++ b/box_sdk_gen/schemas/folder_reference.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FolderReferenceTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class FolderReference(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: FolderReferenceTypeField = FolderReferenceTypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: ID of the folder.
+ :type id: str
+ :param type: The value will always be `folder`., defaults to FolderReferenceTypeField.FOLDER
+ :type type: FolderReferenceTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/generic_source.py b/box_sdk_gen/schemas/generic_source.py
new file mode 100644
index 000000000..e476ab914
--- /dev/null
+++ b/box_sdk_gen/schemas/generic_source.py
@@ -0,0 +1 @@
+from box_sdk_gen.box.errors import BoxSDKError
diff --git a/box_sdk_gen/schemas/group.py b/box_sdk_gen/schemas/group.py
new file mode 100644
index 000000000..fbb2fdc88
--- /dev/null
+++ b/box_sdk_gen/schemas/group.py
@@ -0,0 +1,44 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.group_base import GroupBaseTypeField
+
+from box_sdk_gen.schemas.group_base import GroupBase
+
+from box_sdk_gen.schemas.group_mini import GroupMiniGroupTypeField
+
+from box_sdk_gen.schemas.group_mini import GroupMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class Group(GroupMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ name: Optional[str] = None,
+ group_type: Optional[GroupMiniGroupTypeField] = None,
+ type: GroupBaseTypeField = GroupBaseTypeField.GROUP,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object.
+ :type id: str
+ :param created_at: When the group object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the group object was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param name: The name of the group., defaults to None
+ :type name: Optional[str], optional
+ :param group_type: The type of the group., defaults to None
+ :type group_type: Optional[GroupMiniGroupTypeField], optional
+ :param type: The value will always be `group`., defaults to GroupBaseTypeField.GROUP
+ :type type: GroupBaseTypeField, optional
+ """
+ super().__init__(id=id, name=name, group_type=group_type, type=type, **kwargs)
+ self.created_at = created_at
+ self.modified_at = modified_at
diff --git a/box_sdk_gen/schemas/group_base.py b/box_sdk_gen/schemas/group_base.py
new file mode 100644
index 000000000..38cf63cd1
--- /dev/null
+++ b/box_sdk_gen/schemas/group_base.py
@@ -0,0 +1,26 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class GroupBaseTypeField(str, Enum):
+ GROUP = 'group'
+
+
+class GroupBase(BaseObject):
+ _discriminator = 'type', {'group'}
+
+ def __init__(
+ self, id: str, *, type: GroupBaseTypeField = GroupBaseTypeField.GROUP, **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object.
+ :type id: str
+ :param type: The value will always be `group`., defaults to GroupBaseTypeField.GROUP
+ :type type: GroupBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/group_full.py b/box_sdk_gen/schemas/group_full.py
new file mode 100644
index 000000000..c0503abfa
--- /dev/null
+++ b/box_sdk_gen/schemas/group_full.py
@@ -0,0 +1,128 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.group_base import GroupBaseTypeField
+
+from box_sdk_gen.schemas.group_base import GroupBase
+
+from box_sdk_gen.schemas.group_mini import GroupMiniGroupTypeField
+
+from box_sdk_gen.schemas.group_mini import GroupMini
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.group import Group
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class GroupFullInvitabilityLevelField(str, Enum):
+ ADMINS_ONLY = 'admins_only'
+ ADMINS_AND_MEMBERS = 'admins_and_members'
+ ALL_MANAGED_USERS = 'all_managed_users'
+
+
+class GroupFullMemberViewabilityLevelField(str, Enum):
+ ADMINS_ONLY = 'admins_only'
+ ADMINS_AND_MEMBERS = 'admins_and_members'
+ ALL_MANAGED_USERS = 'all_managed_users'
+
+
+class GroupFullPermissionsField(BaseObject):
+ def __init__(self, *, can_invite_as_collaborator: Optional[bool] = None, **kwargs):
+ """
+ :param can_invite_as_collaborator: Specifies if the user can invite the group to collaborate on any items., defaults to None
+ :type can_invite_as_collaborator: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.can_invite_as_collaborator = can_invite_as_collaborator
+
+
+class GroupFull(Group):
+ def __init__(
+ self,
+ id: str,
+ *,
+ provenance: Optional[str] = None,
+ external_sync_identifier: Optional[str] = None,
+ description: Optional[str] = None,
+ invitability_level: Optional[GroupFullInvitabilityLevelField] = None,
+ member_viewability_level: Optional[GroupFullMemberViewabilityLevelField] = None,
+ permissions: Optional[GroupFullPermissionsField] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ name: Optional[str] = None,
+ group_type: Optional[GroupMiniGroupTypeField] = None,
+ type: GroupBaseTypeField = GroupBaseTypeField.GROUP,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object.
+ :type id: str
+ :param provenance: Keeps track of which external source this group is
+ coming from (e.g. "Active Directory", "Google Groups",
+ "Facebook Groups"). Setting this will
+ also prevent Box users from editing the group name
+ and its members directly via the Box web application.
+ This is desirable for one-way syncing of groups., defaults to None
+ :type provenance: Optional[str], optional
+ :param external_sync_identifier: 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., defaults to None
+ :type external_sync_identifier: Optional[str], optional
+ :param description: Human readable description of the group., defaults to None
+ :type description: Optional[str], optional
+ :param invitability_level: Specifies who can invite the group to collaborate
+ on items.
+
+ 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., defaults to None
+ :type invitability_level: Optional[GroupFullInvitabilityLevelField], optional
+ :param member_viewability_level: Specifies who can view the members of the group
+ (Get Memberships for 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., defaults to None
+ :type member_viewability_level: Optional[GroupFullMemberViewabilityLevelField], optional
+ :param created_at: When the group object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the group object was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param name: The name of the group., defaults to None
+ :type name: Optional[str], optional
+ :param group_type: The type of the group., defaults to None
+ :type group_type: Optional[GroupMiniGroupTypeField], optional
+ :param type: The value will always be `group`., defaults to GroupBaseTypeField.GROUP
+ :type type: GroupBaseTypeField, optional
+ """
+ super().__init__(
+ id=id,
+ created_at=created_at,
+ modified_at=modified_at,
+ name=name,
+ group_type=group_type,
+ type=type,
+ **kwargs
+ )
+ self.provenance = provenance
+ self.external_sync_identifier = external_sync_identifier
+ self.description = description
+ self.invitability_level = invitability_level
+ self.member_viewability_level = member_viewability_level
+ self.permissions = permissions
diff --git a/box_sdk_gen/schemas/group_membership.py b/box_sdk_gen/schemas/group_membership.py
new file mode 100644
index 000000000..48cc01ea6
--- /dev/null
+++ b/box_sdk_gen/schemas/group_membership.py
@@ -0,0 +1,59 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.group_mini import GroupMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class GroupMembershipTypeField(str, Enum):
+ GROUP_MEMBERSHIP = 'group_membership'
+
+
+class GroupMembershipRoleField(str, Enum):
+ MEMBER = 'member'
+ ADMIN = 'admin'
+
+
+class GroupMembership(BaseObject):
+ _discriminator = 'type', {'group_membership'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[GroupMembershipTypeField] = None,
+ user: Optional[UserMini] = None,
+ group: Optional[GroupMini] = None,
+ role: Optional[GroupMembershipRoleField] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this group membership., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `group_membership`., defaults to None
+ :type type: Optional[GroupMembershipTypeField], optional
+ :param role: The role of the user in the group., defaults to None
+ :type role: Optional[GroupMembershipRoleField], optional
+ :param created_at: The time this membership was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The time this membership was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.user = user
+ self.group = group
+ self.role = role
+ self.created_at = created_at
+ self.modified_at = modified_at
diff --git a/box_sdk_gen/schemas/group_memberships.py b/box_sdk_gen/schemas/group_memberships.py
new file mode 100644
index 000000000..a5b402504
--- /dev/null
+++ b/box_sdk_gen/schemas/group_memberships.py
@@ -0,0 +1,80 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.group_membership import GroupMembership
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class GroupMembershipsOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class GroupMembershipsOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[GroupMembershipsOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[GroupMembershipsOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class GroupMemberships(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[GroupMembershipsOrderField]] = None,
+ entries: Optional[List[GroupMembership]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[GroupMembershipsOrderField]], optional
+ :param entries: A list of group memberships., defaults to None
+ :type entries: Optional[List[GroupMembership]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/group_mini.py b/box_sdk_gen/schemas/group_mini.py
new file mode 100644
index 000000000..a05571868
--- /dev/null
+++ b/box_sdk_gen/schemas/group_mini.py
@@ -0,0 +1,39 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.schemas.group_base import GroupBaseTypeField
+
+from box_sdk_gen.schemas.group_base import GroupBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class GroupMiniGroupTypeField(str, Enum):
+ MANAGED_GROUP = 'managed_group'
+ ALL_USERS_GROUP = 'all_users_group'
+
+
+class GroupMini(GroupBase):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ group_type: Optional[GroupMiniGroupTypeField] = None,
+ type: GroupBaseTypeField = GroupBaseTypeField.GROUP,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object.
+ :type id: str
+ :param name: The name of the group., defaults to None
+ :type name: Optional[str], optional
+ :param group_type: The type of the group., defaults to None
+ :type group_type: Optional[GroupMiniGroupTypeField], optional
+ :param type: The value will always be `group`., defaults to GroupBaseTypeField.GROUP
+ :type type: GroupBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.name = name
+ self.group_type = group_type
diff --git a/box_sdk_gen/schemas/groups.py b/box_sdk_gen/schemas/groups.py
new file mode 100644
index 000000000..76f8a6c13
--- /dev/null
+++ b/box_sdk_gen/schemas/groups.py
@@ -0,0 +1,80 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.group_full import GroupFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class GroupsOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class GroupsOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[GroupsOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[GroupsOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class Groups(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[GroupsOrderField]] = None,
+ entries: Optional[List[GroupFull]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[GroupsOrderField]], optional
+ :param entries: A list of groups., defaults to None
+ :type entries: Optional[List[GroupFull]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/integration_mapping.py b/box_sdk_gen/schemas/integration_mapping.py
new file mode 100644
index 000000000..6c2df8e31
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping.py
@@ -0,0 +1,90 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.schemas.integration_mapping_base import IntegrationMappingBaseTypeField
+
+from box_sdk_gen.schemas.integration_mapping_base import IntegrationMappingBase
+
+from box_sdk_gen.schemas.integration_mapping_slack_options import (
+ IntegrationMappingSlackOptions,
+)
+
+from box_sdk_gen.schemas.user_integration_mappings import UserIntegrationMappings
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_slack import (
+ IntegrationMappingPartnerItemSlack,
+)
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class IntegrationMappingIntegrationTypeField(str, Enum):
+ SLACK = 'slack'
+
+
+class IntegrationMapping(IntegrationMappingBase):
+ def __init__(
+ self,
+ partner_item: Union[IntegrationMappingPartnerItemSlack],
+ box_item: FolderMini,
+ id: str,
+ *,
+ integration_type: Optional[IntegrationMappingIntegrationTypeField] = None,
+ is_manually_created: Optional[bool] = None,
+ options: Optional[IntegrationMappingSlackOptions] = None,
+ created_by: Optional[UserIntegrationMappings] = None,
+ modified_by: Optional[UserIntegrationMappings] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ type: IntegrationMappingBaseTypeField = IntegrationMappingBaseTypeField.INTEGRATION_MAPPING,
+ **kwargs
+ ):
+ """
+ :param partner_item: Mapped item object for Slack.
+ :type partner_item: Union[IntegrationMappingPartnerItemSlack]
+ :param box_item: The Box folder, to which the object from the
+ partner app domain (referenced in `partner_item_id`) is mapped.
+ :type box_item: FolderMini
+ :param id: A unique identifier of a folder mapping
+ (part of a composite key together
+ with `integration_type`).
+ :type id: str
+ :param integration_type: Identifies the Box partner app,
+ with which the mapping is associated.
+ Currently only supports Slack.
+ (part of the composite key together with `id`)., defaults to None
+ :type integration_type: Optional[IntegrationMappingIntegrationTypeField], optional
+ :param is_manually_created: Identifies whether the mapping has
+ been manually set
+ (as opposed to being automatically created)., defaults to None
+ :type is_manually_created: Optional[bool], optional
+ :param created_by: An object representing the user who
+ created the integration mapping., defaults to None
+ :type created_by: Optional[UserIntegrationMappings], optional
+ :param modified_by: The user who
+ last modified the integration mapping., defaults to None
+ :type modified_by: Optional[UserIntegrationMappings], optional
+ :param created_at: When the integration mapping object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the integration mapping object was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param type: Mapping type., defaults to IntegrationMappingBaseTypeField.INTEGRATION_MAPPING
+ :type type: IntegrationMappingBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.partner_item = partner_item
+ self.box_item = box_item
+ self.integration_type = integration_type
+ self.is_manually_created = is_manually_created
+ self.options = options
+ self.created_by = created_by
+ self.modified_by = modified_by
+ self.created_at = created_at
+ self.modified_at = modified_at
diff --git a/box_sdk_gen/schemas/integration_mapping_base.py b/box_sdk_gen/schemas/integration_mapping_base.py
new file mode 100644
index 000000000..eb53aadb0
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_base.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingBaseTypeField(str, Enum):
+ INTEGRATION_MAPPING = 'integration_mapping'
+
+
+class IntegrationMappingBase(BaseObject):
+ _discriminator = 'type', {'integration_mapping'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: IntegrationMappingBaseTypeField = IntegrationMappingBaseTypeField.INTEGRATION_MAPPING,
+ **kwargs
+ ):
+ """
+ :param id: A unique identifier of a folder mapping
+ (part of a composite key together
+ with `integration_type`).
+ :type id: str
+ :param type: Mapping type., defaults to IntegrationMappingBaseTypeField.INTEGRATION_MAPPING
+ :type type: IntegrationMappingBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/integration_mapping_box_item_slack.py b/box_sdk_gen/schemas/integration_mapping_box_item_slack.py
new file mode 100644
index 000000000..427835d3a
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_box_item_slack.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingBoxItemSlackTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class IntegrationMappingBoxItemSlack(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: IntegrationMappingBoxItemSlackTypeField = IntegrationMappingBoxItemSlackTypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: ID of the mapped item (of type referenced in `type`).
+ :type id: str
+ :param type: Type of the mapped item referenced in `id`., defaults to IntegrationMappingBoxItemSlackTypeField.FOLDER
+ :type type: IntegrationMappingBoxItemSlackTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/integration_mapping_partner_item_slack.py b/box_sdk_gen/schemas/integration_mapping_partner_item_slack.py
new file mode 100644
index 000000000..5d0731166
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_partner_item_slack.py
@@ -0,0 +1,40 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingPartnerItemSlackTypeField(str, Enum):
+ CHANNEL = 'channel'
+
+
+class IntegrationMappingPartnerItemSlack(BaseObject):
+ _discriminator = 'type', {'channel'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: IntegrationMappingPartnerItemSlackTypeField = IntegrationMappingPartnerItemSlackTypeField.CHANNEL,
+ slack_workspace_id: Optional[str] = None,
+ slack_org_id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: ID of the mapped item (of type referenced in `type`).
+ :type id: str
+ :param type: Type of the mapped item referenced in `id`., defaults to IntegrationMappingPartnerItemSlackTypeField.CHANNEL
+ :type type: IntegrationMappingPartnerItemSlackTypeField, optional
+ :param slack_workspace_id: ID of the Slack workspace with which the item is associated. Use this parameter if Box for Slack is installed at a workspace level. Do not use `slack_org_id` at the same time., defaults to None
+ :type slack_workspace_id: Optional[str], optional
+ :param slack_org_id: ID of the Slack org with which the item is associated. Use this parameter if Box for Slack is installed at the org level. Do not use `slack_workspace_id` at the same time., defaults to None
+ :type slack_org_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.slack_workspace_id = slack_workspace_id
+ self.slack_org_id = slack_org_id
diff --git a/box_sdk_gen/schemas/integration_mapping_partner_item_teams.py b/box_sdk_gen/schemas/integration_mapping_partner_item_teams.py
new file mode 100644
index 000000000..4d5c0918a
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_partner_item_teams.py
@@ -0,0 +1,34 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingPartnerItemTeamsTypeField(str, Enum):
+ CHANNEL = 'channel'
+ TEAM = 'team'
+
+
+class IntegrationMappingPartnerItemTeams(BaseObject):
+ _discriminator = 'type', {'channel', 'team'}
+
+ def __init__(
+ self,
+ type: IntegrationMappingPartnerItemTeamsTypeField,
+ id: str,
+ tenant_id: str,
+ **kwargs
+ ):
+ """
+ :param type: Type of the mapped item referenced in `id`.
+ :type type: IntegrationMappingPartnerItemTeamsTypeField
+ :param id: ID of the mapped item (of type referenced in `type`).
+ :type id: str
+ :param tenant_id: ID of the tenant that is registered with Microsoft Teams.
+ :type tenant_id: str
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.tenant_id = tenant_id
diff --git a/box_sdk_gen/schemas/integration_mapping_partner_item_teams_create_request.py b/box_sdk_gen/schemas/integration_mapping_partner_item_teams_create_request.py
new file mode 100644
index 000000000..f6f10fc43
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_partner_item_teams_create_request.py
@@ -0,0 +1,38 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingPartnerItemTeamsCreateRequestTypeField(str, Enum):
+ CHANNEL = 'channel'
+ TEAM = 'team'
+
+
+class IntegrationMappingPartnerItemTeamsCreateRequest(BaseObject):
+ _discriminator = 'type', {'channel', 'team'}
+
+ def __init__(
+ self,
+ type: IntegrationMappingPartnerItemTeamsCreateRequestTypeField,
+ id: str,
+ tenant_id: str,
+ team_id: str,
+ **kwargs
+ ):
+ """
+ :param type: Type of the mapped item referenced in `id`.
+ :type type: IntegrationMappingPartnerItemTeamsCreateRequestTypeField
+ :param id: ID of the mapped item (of type referenced in `type`).
+ :type id: str
+ :param tenant_id: ID of the tenant that is registered with Microsoft Teams.
+ :type tenant_id: str
+ :param team_id: ID of the team that is registered with Microsoft Teams.
+ :type team_id: str
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.tenant_id = tenant_id
+ self.team_id = team_id
diff --git a/box_sdk_gen/schemas/integration_mapping_slack_create_request.py b/box_sdk_gen/schemas/integration_mapping_slack_create_request.py
new file mode 100644
index 000000000..85586fe6b
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_slack_create_request.py
@@ -0,0 +1,32 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_slack import (
+ IntegrationMappingPartnerItemSlack,
+)
+
+from box_sdk_gen.schemas.integration_mapping_box_item_slack import (
+ IntegrationMappingBoxItemSlack,
+)
+
+from box_sdk_gen.schemas.integration_mapping_slack_options import (
+ IntegrationMappingSlackOptions,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingSlackCreateRequest(BaseObject):
+ def __init__(
+ self,
+ partner_item: IntegrationMappingPartnerItemSlack,
+ box_item: IntegrationMappingBoxItemSlack,
+ *,
+ options: Optional[IntegrationMappingSlackOptions] = None,
+ **kwargs
+ ):
+ super().__init__(**kwargs)
+ self.partner_item = partner_item
+ self.box_item = box_item
+ self.options = options
diff --git a/box_sdk_gen/schemas/integration_mapping_slack_options.py b/box_sdk_gen/schemas/integration_mapping_slack_options.py
new file mode 100644
index 000000000..701d27a82
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_slack_options.py
@@ -0,0 +1,21 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingSlackOptions(BaseObject):
+ def __init__(
+ self, *, is_access_management_disabled: Optional[bool] = None, **kwargs
+ ):
+ """
+ :param is_access_management_disabled: Indicates whether or not channel member
+ access to the underlying box item
+ should be automatically managed.
+ Depending on type of channel, access is managed
+ through creating collaborations or shared links., defaults to None
+ :type is_access_management_disabled: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.is_access_management_disabled = is_access_management_disabled
diff --git a/box_sdk_gen/schemas/integration_mapping_teams.py b/box_sdk_gen/schemas/integration_mapping_teams.py
new file mode 100644
index 000000000..f967e4fd3
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_teams.py
@@ -0,0 +1,69 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.schemas.integration_mapping_base import IntegrationMappingBaseTypeField
+
+from box_sdk_gen.schemas.integration_mapping_base import IntegrationMappingBase
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_teams import (
+ IntegrationMappingPartnerItemTeams,
+)
+
+from box_sdk_gen.schemas.folder_reference import FolderReference
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class IntegrationMappingTeamsIntegrationTypeField(str, Enum):
+ TEAMS = 'teams'
+
+
+class IntegrationMappingTeams(IntegrationMappingBase):
+ def __init__(
+ self,
+ partner_item: Union[IntegrationMappingPartnerItemTeams],
+ box_item: FolderReference,
+ id: str,
+ *,
+ integration_type: Optional[IntegrationMappingTeamsIntegrationTypeField] = None,
+ is_overridden_by_manual_mapping: Optional[bool] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ type: IntegrationMappingBaseTypeField = IntegrationMappingBaseTypeField.INTEGRATION_MAPPING,
+ **kwargs
+ ):
+ """
+ :param partner_item: Mapped item object for Teams.
+ :type partner_item: Union[IntegrationMappingPartnerItemTeams]
+ :param id: A unique identifier of a folder mapping
+ (part of a composite key together
+ with `integration_type`).
+ :type id: str
+ :param integration_type: Identifies the Box partner app,
+ with which the mapping is associated.
+ Supports Slack and Teams.
+ (part of the composite key together with `id`)., defaults to None
+ :type integration_type: Optional[IntegrationMappingTeamsIntegrationTypeField], optional
+ :param is_overridden_by_manual_mapping: Identifies whether the mapping has
+ been manually set by the team owner from UI for channels
+ (as opposed to being automatically created)., defaults to None
+ :type is_overridden_by_manual_mapping: Optional[bool], optional
+ :param created_at: When the integration mapping object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the integration mapping object was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param type: Mapping type., defaults to IntegrationMappingBaseTypeField.INTEGRATION_MAPPING
+ :type type: IntegrationMappingBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.partner_item = partner_item
+ self.box_item = box_item
+ self.integration_type = integration_type
+ self.is_overridden_by_manual_mapping = is_overridden_by_manual_mapping
+ self.created_at = created_at
+ self.modified_at = modified_at
diff --git a/box_sdk_gen/schemas/integration_mapping_teams_create_request.py b/box_sdk_gen/schemas/integration_mapping_teams_create_request.py
new file mode 100644
index 000000000..2f615a43d
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mapping_teams_create_request.py
@@ -0,0 +1,21 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.integration_mapping_partner_item_teams_create_request import (
+ IntegrationMappingPartnerItemTeamsCreateRequest,
+)
+
+from box_sdk_gen.schemas.folder_reference import FolderReference
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingTeamsCreateRequest(BaseObject):
+ def __init__(
+ self,
+ partner_item: IntegrationMappingPartnerItemTeamsCreateRequest,
+ box_item: FolderReference,
+ **kwargs
+ ):
+ super().__init__(**kwargs)
+ self.partner_item = partner_item
+ self.box_item = box_item
diff --git a/box_sdk_gen/schemas/integration_mappings.py b/box_sdk_gen/schemas/integration_mappings.py
new file mode 100644
index 000000000..638165d7e
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mappings.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.integration_mapping import IntegrationMapping
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappings(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ entries: Optional[List[IntegrationMapping]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param entries: A list of integration mappings., defaults to None
+ :type entries: Optional[List[IntegrationMapping]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/integration_mappings_teams.py b/box_sdk_gen/schemas/integration_mappings_teams.py
new file mode 100644
index 000000000..f727ff6c2
--- /dev/null
+++ b/box_sdk_gen/schemas/integration_mappings_teams.py
@@ -0,0 +1,21 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.integration_mapping_teams import IntegrationMappingTeams
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class IntegrationMappingsTeams(BaseObject):
+ def __init__(
+ self, *, entries: Optional[List[IntegrationMappingTeams]] = None, **kwargs
+ ):
+ """
+ :param entries: A list of integration mappings., defaults to None
+ :type entries: Optional[List[IntegrationMappingTeams]], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/invite.py b/box_sdk_gen/schemas/invite.py
new file mode 100644
index 000000000..28487d988
--- /dev/null
+++ b/box_sdk_gen/schemas/invite.py
@@ -0,0 +1,85 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class InviteTypeField(str, Enum):
+ INVITE = 'invite'
+
+
+class InviteInvitedToTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class InviteInvitedToField(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[InviteInvitedToTypeField] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[InviteInvitedToTypeField], optional
+ :param name: The name of the enterprise., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+
+
+class Invite(BaseObject):
+ _discriminator = 'type', {'invite'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: InviteTypeField = InviteTypeField.INVITE,
+ invited_to: Optional[InviteInvitedToField] = None,
+ actionable_by: Optional[UserMini] = None,
+ invited_by: Optional[UserMini] = None,
+ status: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this invite.
+ :type id: str
+ :param type: The value will always be `invite`., defaults to InviteTypeField.INVITE
+ :type type: InviteTypeField, optional
+ :param invited_to: A representation of a Box enterprise., defaults to None
+ :type invited_to: Optional[InviteInvitedToField], optional
+ :param status: The status of the invite., defaults to None
+ :type status: Optional[str], optional
+ :param created_at: When the invite was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the invite was modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.invited_to = invited_to
+ self.actionable_by = actionable_by
+ self.invited_by = invited_by
+ self.status = status
+ self.created_at = created_at
+ self.modified_at = modified_at
diff --git a/box_sdk_gen/schemas/items.py b/box_sdk_gen/schemas/items.py
new file mode 100644
index 000000000..9dc24c0f8
--- /dev/null
+++ b/box_sdk_gen/schemas/items.py
@@ -0,0 +1,94 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Union
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ItemsOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class ItemsOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[ItemsOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[ItemsOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class Items(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ total_count: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[ItemsOrderField]] = None,
+ entries: Optional[List[Union[FileFull, FolderMini, WebLink]]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[ItemsOrderField]], optional
+ :param entries: The items in this collection., defaults to None
+ :type entries: Optional[List[Union[FileFull, FolderMini, WebLink]]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.total_count = total_count
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/items_offset_paginated.py b/box_sdk_gen/schemas/items_offset_paginated.py
new file mode 100644
index 000000000..a360480a6
--- /dev/null
+++ b/box_sdk_gen/schemas/items_offset_paginated.py
@@ -0,0 +1,86 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Union
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ItemsOffsetPaginatedOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class ItemsOffsetPaginatedOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[ItemsOffsetPaginatedOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[ItemsOffsetPaginatedOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class ItemsOffsetPaginated(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[ItemsOffsetPaginatedOrderField]] = None,
+ entries: Optional[List[Union[FileFull, FolderMini, WebLink]]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[ItemsOffsetPaginatedOrderField]], optional
+ :param entries: The items in this collection., defaults to None
+ :type entries: Optional[List[Union[FileFull, FolderMini, WebLink]]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/keyword_skill_card.py b/box_sdk_gen/schemas/keyword_skill_card.py
new file mode 100644
index 000000000..ba6cf2cc7
--- /dev/null
+++ b/box_sdk_gen/schemas/keyword_skill_card.py
@@ -0,0 +1,139 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class KeywordSkillCardTypeField(str, Enum):
+ SKILL_CARD = 'skill_card'
+
+
+class KeywordSkillCardSkillCardTypeField(str, Enum):
+ KEYWORD = 'keyword'
+
+
+class KeywordSkillCardSkillCardTitleField(BaseObject):
+ def __init__(self, message: str, *, code: Optional[str] = None, **kwargs):
+ """
+ :param message: The actual title to show in the UI.
+ :type message: str
+ :param code: An optional identifier for the title., defaults to None
+ :type code: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.message = message
+ self.code = code
+
+
+class KeywordSkillCardSkillTypeField(str, Enum):
+ SERVICE = 'service'
+
+
+class KeywordSkillCardSkillField(BaseObject):
+ _discriminator = 'type', {'service'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: KeywordSkillCardSkillTypeField = KeywordSkillCardSkillTypeField.SERVICE,
+ **kwargs
+ ):
+ """
+ :param id: A custom identifier that represent the service that
+ applied this metadata.
+ :type id: str
+ :param type: The value will always be `service`., defaults to KeywordSkillCardSkillTypeField.SERVICE
+ :type type: KeywordSkillCardSkillTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class KeywordSkillCardInvocationTypeField(str, Enum):
+ SKILL_INVOCATION = 'skill_invocation'
+
+
+class KeywordSkillCardInvocationField(BaseObject):
+ _discriminator = 'type', {'skill_invocation'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: KeywordSkillCardInvocationTypeField = KeywordSkillCardInvocationTypeField.SKILL_INVOCATION,
+ **kwargs
+ ):
+ """
+ :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
+ nodes, this field can be used to identify the ID of
+ the node that was used to apply the metadata.
+ :type id: str
+ :param type: The value will always be `skill_invocation`., defaults to KeywordSkillCardInvocationTypeField.SKILL_INVOCATION
+ :type type: KeywordSkillCardInvocationTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class KeywordSkillCardEntriesField(BaseObject):
+ def __init__(self, *, text: Optional[str] = None, **kwargs):
+ """
+ :param text: The text of the keyword., defaults to None
+ :type text: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.text = text
+
+
+class KeywordSkillCard(BaseObject):
+ _discriminator = 'skill_card_type', {'keyword'}
+
+ def __init__(
+ self,
+ skill: KeywordSkillCardSkillField,
+ invocation: KeywordSkillCardInvocationField,
+ entries: List[KeywordSkillCardEntriesField],
+ *,
+ created_at: Optional[DateTime] = None,
+ type: KeywordSkillCardTypeField = KeywordSkillCardTypeField.SKILL_CARD,
+ skill_card_type: KeywordSkillCardSkillCardTypeField = KeywordSkillCardSkillCardTypeField.KEYWORD,
+ skill_card_title: Optional[KeywordSkillCardSkillCardTitleField] = None,
+ **kwargs
+ ):
+ """
+ :param skill: The service that applied this metadata.
+ :type skill: KeywordSkillCardSkillField
+ :param invocation: The invocation of this service, used to track
+ which instance of a service applied the metadata.
+ :type invocation: KeywordSkillCardInvocationField
+ :param entries: An list of entries in the metadata card.
+ :type entries: List[KeywordSkillCardEntriesField]
+ :param created_at: The optional date and time this card was created at., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param type: The value will always be `skill_card`., defaults to KeywordSkillCardTypeField.SKILL_CARD
+ :type type: KeywordSkillCardTypeField, optional
+ :param skill_card_type: The value will always be `keyword`., defaults to KeywordSkillCardSkillCardTypeField.KEYWORD
+ :type skill_card_type: KeywordSkillCardSkillCardTypeField, optional
+ :param skill_card_title: The title of the card., defaults to None
+ :type skill_card_title: Optional[KeywordSkillCardSkillCardTitleField], optional
+ """
+ super().__init__(**kwargs)
+ self.skill = skill
+ self.invocation = invocation
+ self.entries = entries
+ self.created_at = created_at
+ self.type = type
+ self.skill_card_type = skill_card_type
+ self.skill_card_title = skill_card_title
diff --git a/box_sdk_gen/schemas/legal_hold_policies.py b/box_sdk_gen/schemas/legal_hold_policies.py
new file mode 100644
index 000000000..52c42f9d1
--- /dev/null
+++ b/box_sdk_gen/schemas/legal_hold_policies.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.legal_hold_policy import LegalHoldPolicy
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class LegalHoldPolicies(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[LegalHoldPolicy]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of legal hold policies., defaults to None
+ :type entries: Optional[List[LegalHoldPolicy]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/legal_hold_policy.py b/box_sdk_gen/schemas/legal_hold_policy.py
new file mode 100644
index 000000000..5a91fa884
--- /dev/null
+++ b/box_sdk_gen/schemas/legal_hold_policy.py
@@ -0,0 +1,122 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.legal_hold_policy_mini import LegalHoldPolicyMiniTypeField
+
+from box_sdk_gen.schemas.legal_hold_policy_mini import LegalHoldPolicyMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class LegalHoldPolicyStatusField(str, Enum):
+ ACTIVE = 'active'
+ APPLYING = 'applying'
+ RELEASING = 'releasing'
+ RELEASED = 'released'
+
+
+class LegalHoldPolicyAssignmentCountsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ user: Optional[int] = None,
+ folder: Optional[int] = None,
+ file: Optional[int] = None,
+ file_version: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param user: The number of users this policy is applied to., defaults to None
+ :type user: Optional[int], optional
+ :param folder: The number of folders this policy is applied to., defaults to None
+ :type folder: Optional[int], optional
+ :param file: The number of files this policy is applied to., defaults to None
+ :type file: Optional[int], optional
+ :param file_version: The number of file versions this policy is applied to., defaults to None
+ :type file_version: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.user = user
+ self.folder = folder
+ self.file = file
+ self.file_version = file_version
+
+
+class LegalHoldPolicy(LegalHoldPolicyMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ policy_name: Optional[str] = None,
+ description: Optional[str] = None,
+ status: Optional[LegalHoldPolicyStatusField] = None,
+ assignment_counts: Optional[LegalHoldPolicyAssignmentCountsField] = None,
+ created_by: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ deleted_at: Optional[DateTime] = None,
+ filter_started_at: Optional[DateTime] = None,
+ filter_ended_at: Optional[DateTime] = None,
+ release_notes: Optional[str] = None,
+ type: LegalHoldPolicyMiniTypeField = LegalHoldPolicyMiniTypeField.LEGAL_HOLD_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this legal hold policy.
+ :type id: str
+ :param policy_name: Name of the legal hold policy., defaults to None
+ :type policy_name: Optional[str], optional
+ :param description: Description of the legal hold policy. Optional
+ property with a 500 character limit., defaults to None
+ :type description: Optional[str], optional
+ :param status: Possible values:
+ * 'active' - the policy is not in a transition state.
+ * 'applying' - that the policy is in the process of
+ being applied.
+ * 'releasing' - that the process is in the process
+ of being released.
+ * 'released' - the policy is no longer active., defaults to None
+ :type status: Optional[LegalHoldPolicyStatusField], optional
+ :param assignment_counts: Counts of assignments within this a legal hold policy by item type., defaults to None
+ :type assignment_counts: Optional[LegalHoldPolicyAssignmentCountsField], optional
+ :param created_at: When the legal hold policy object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the legal hold policy object was modified.
+ Does not update when assignments are added or removed., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param deleted_at: When the policy release request was sent. (Because
+ it can take time for a policy to fully delete, this
+ isn't quite the same time that the policy is fully deleted).
+
+ If `null`, the policy was not deleted., defaults to None
+ :type deleted_at: Optional[DateTime], optional
+ :param filter_started_at: User-specified, optional date filter applies to
+ Custodian assignments only., defaults to None
+ :type filter_started_at: Optional[DateTime], optional
+ :param filter_ended_at: User-specified, optional date filter applies to
+ Custodian assignments only., defaults to None
+ :type filter_ended_at: Optional[DateTime], optional
+ :param release_notes: Optional notes about why the policy was created., defaults to None
+ :type release_notes: Optional[str], optional
+ :param type: The value will always be `legal_hold_policy`., defaults to LegalHoldPolicyMiniTypeField.LEGAL_HOLD_POLICY
+ :type type: LegalHoldPolicyMiniTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.policy_name = policy_name
+ self.description = description
+ self.status = status
+ self.assignment_counts = assignment_counts
+ self.created_by = created_by
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.deleted_at = deleted_at
+ self.filter_started_at = filter_started_at
+ self.filter_ended_at = filter_ended_at
+ self.release_notes = release_notes
diff --git a/box_sdk_gen/schemas/legal_hold_policy_assignment.py b/box_sdk_gen/schemas/legal_hold_policy_assignment.py
new file mode 100644
index 000000000..ec38983ab
--- /dev/null
+++ b/box_sdk_gen/schemas/legal_hold_policy_assignment.py
@@ -0,0 +1,61 @@
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.schemas.legal_hold_policy_assignment_base import (
+ LegalHoldPolicyAssignmentBaseTypeField,
+)
+
+from box_sdk_gen.schemas.legal_hold_policy_assignment_base import (
+ LegalHoldPolicyAssignmentBase,
+)
+
+from box_sdk_gen.schemas.legal_hold_policy_mini import LegalHoldPolicyMini
+
+from box_sdk_gen.schemas.file import File
+
+from box_sdk_gen.schemas.folder import Folder
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class LegalHoldPolicyAssignment(LegalHoldPolicyAssignmentBase):
+ def __init__(
+ self,
+ *,
+ legal_hold_policy: Optional[LegalHoldPolicyMini] = None,
+ assigned_to: Optional[Union[File, Folder, WebLink]] = None,
+ assigned_by: Optional[UserMini] = None,
+ assigned_at: Optional[DateTime] = None,
+ deleted_at: Optional[DateTime] = None,
+ id: Optional[str] = None,
+ type: Optional[LegalHoldPolicyAssignmentBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param assigned_at: When the legal hold policy assignment object was
+ created., defaults to None
+ :type assigned_at: Optional[DateTime], optional
+ :param deleted_at: When the assignment release request was sent.
+ (Because it can take time for an assignment to fully
+ delete, this isn't quite the same time that the
+ assignment is fully deleted). If null, Assignment
+ was not deleted., defaults to None
+ :type deleted_at: Optional[DateTime], optional
+ :param id: The unique identifier for this legal hold assignment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `legal_hold_policy_assignment`., defaults to None
+ :type type: Optional[LegalHoldPolicyAssignmentBaseTypeField], optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.legal_hold_policy = legal_hold_policy
+ self.assigned_to = assigned_to
+ self.assigned_by = assigned_by
+ self.assigned_at = assigned_at
+ self.deleted_at = deleted_at
diff --git a/box_sdk_gen/schemas/legal_hold_policy_assignment_base.py b/box_sdk_gen/schemas/legal_hold_policy_assignment_base.py
new file mode 100644
index 000000000..2e1897da7
--- /dev/null
+++ b/box_sdk_gen/schemas/legal_hold_policy_assignment_base.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class LegalHoldPolicyAssignmentBaseTypeField(str, Enum):
+ LEGAL_HOLD_POLICY_ASSIGNMENT = 'legal_hold_policy_assignment'
+
+
+class LegalHoldPolicyAssignmentBase(BaseObject):
+ _discriminator = 'type', {'legal_hold_policy_assignment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[LegalHoldPolicyAssignmentBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this legal hold assignment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `legal_hold_policy_assignment`., defaults to None
+ :type type: Optional[LegalHoldPolicyAssignmentBaseTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/legal_hold_policy_assignments.py b/box_sdk_gen/schemas/legal_hold_policy_assignments.py
new file mode 100644
index 000000000..d66c7de7f
--- /dev/null
+++ b/box_sdk_gen/schemas/legal_hold_policy_assignments.py
@@ -0,0 +1,39 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.legal_hold_policy_assignment import LegalHoldPolicyAssignment
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class LegalHoldPolicyAssignments(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[LegalHoldPolicyAssignment]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of legal hold
+ policy assignments., defaults to None
+ :type entries: Optional[List[LegalHoldPolicyAssignment]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/legal_hold_policy_mini.py b/box_sdk_gen/schemas/legal_hold_policy_mini.py
new file mode 100644
index 000000000..e2a82a406
--- /dev/null
+++ b/box_sdk_gen/schemas/legal_hold_policy_mini.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class LegalHoldPolicyMiniTypeField(str, Enum):
+ LEGAL_HOLD_POLICY = 'legal_hold_policy'
+
+
+class LegalHoldPolicyMini(BaseObject):
+ _discriminator = 'type', {'legal_hold_policy'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: LegalHoldPolicyMiniTypeField = LegalHoldPolicyMiniTypeField.LEGAL_HOLD_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this legal hold policy.
+ :type id: str
+ :param type: The value will always be `legal_hold_policy`., defaults to LegalHoldPolicyMiniTypeField.LEGAL_HOLD_POLICY
+ :type type: LegalHoldPolicyMiniTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/metadata.py b/box_sdk_gen/schemas/metadata.py
new file mode 100644
index 000000000..1eee77e39
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata.py
@@ -0,0 +1,36 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.metadata_base import MetadataBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Metadata(MetadataBase):
+ def __init__(
+ self,
+ *,
+ parent: Optional[str] = None,
+ template: Optional[str] = None,
+ scope: Optional[str] = None,
+ version: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param parent: The identifier of the item that this metadata instance
+ has been attached to. This combines the `type` and the `id`
+ of the parent in the form `{type}_{id}`., defaults to None
+ :type parent: Optional[str], optional
+ :param template: The name of the template., defaults to None
+ :type template: Optional[str], optional
+ :param scope: An ID for the scope in which this template
+ has been applied. This will be `enterprise_{enterprise_id}` for templates
+ defined for use in this enterprise, and `global` for general templates
+ that are available to all enterprises using Box., defaults to None
+ :type scope: Optional[str], optional
+ :param version: The version of the metadata instance. This version starts at 0 and
+ increases every time a user-defined property is modified., defaults to None
+ :type version: Optional[int], optional
+ """
+ super().__init__(
+ parent=parent, template=template, scope=scope, version=version, **kwargs
+ )
diff --git a/box_sdk_gen/schemas/metadata_base.py b/box_sdk_gen/schemas/metadata_base.py
new file mode 100644
index 000000000..f7173666a
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_base.py
@@ -0,0 +1,55 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataBase(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'parent': '$parent',
+ 'template': '$template',
+ 'scope': '$scope',
+ 'version': '$version',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ '$parent': 'parent',
+ '$template': 'template',
+ '$scope': 'scope',
+ '$version': 'version',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ parent: Optional[str] = None,
+ template: Optional[str] = None,
+ scope: Optional[str] = None,
+ version: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param parent: The identifier of the item that this metadata instance
+ has been attached to. This combines the `type` and the `id`
+ of the parent in the form `{type}_{id}`., defaults to None
+ :type parent: Optional[str], optional
+ :param template: The name of the template., defaults to None
+ :type template: Optional[str], optional
+ :param scope: An ID for the scope in which this template
+ has been applied. This will be `enterprise_{enterprise_id}` for templates
+ defined for use in this enterprise, and `global` for general templates
+ that are available to all enterprises using Box., defaults to None
+ :type scope: Optional[str], optional
+ :param version: The version of the metadata instance. This version starts at 0 and
+ increases every time a user-defined property is modified., defaults to None
+ :type version: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.parent = parent
+ self.template = template
+ self.scope = scope
+ self.version = version
diff --git a/box_sdk_gen/schemas/metadata_cascade_policies.py b/box_sdk_gen/schemas/metadata_cascade_policies.py
new file mode 100644
index 000000000..7c12ac0aa
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_cascade_policies.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.metadata_cascade_policy import MetadataCascadePolicy
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataCascadePolicies(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[MetadataCascadePolicy]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of metadata cascade policies., defaults to None
+ :type entries: Optional[List[MetadataCascadePolicy]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/metadata_cascade_policy.py b/box_sdk_gen/schemas/metadata_cascade_policy.py
new file mode 100644
index 000000000..a3096866f
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_cascade_policy.py
@@ -0,0 +1,126 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataCascadePolicyTypeField(str, Enum):
+ METADATA_CASCADE_POLICY = 'metadata_cascade_policy'
+
+
+class MetadataCascadePolicyOwnerEnterpriseTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class MetadataCascadePolicyOwnerEnterpriseField(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[MetadataCascadePolicyOwnerEnterpriseTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[MetadataCascadePolicyOwnerEnterpriseTypeField], optional
+ :param id: The ID of the enterprise that owns the policy., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class MetadataCascadePolicyParentTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class MetadataCascadePolicyParentField(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[MetadataCascadePolicyParentTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `folder`., defaults to None
+ :type type: Optional[MetadataCascadePolicyParentTypeField], optional
+ :param id: The ID of the folder the policy is applied to., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class MetadataCascadePolicy(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'template_key': 'templateKey',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'templateKey': 'template_key',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {'metadata_cascade_policy'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: MetadataCascadePolicyTypeField = MetadataCascadePolicyTypeField.METADATA_CASCADE_POLICY,
+ owner_enterprise: Optional[MetadataCascadePolicyOwnerEnterpriseField] = None,
+ parent: Optional[MetadataCascadePolicyParentField] = None,
+ scope: Optional[str] = None,
+ template_key: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the metadata cascade policy object.
+ :type id: str
+ :param type: The value will always be `metadata_cascade_policy`., defaults to MetadataCascadePolicyTypeField.METADATA_CASCADE_POLICY
+ :type type: MetadataCascadePolicyTypeField, optional
+ :param owner_enterprise: The enterprise that owns this policy., defaults to None
+ :type owner_enterprise: Optional[MetadataCascadePolicyOwnerEnterpriseField], optional
+ :param parent: Represent the folder the policy is applied to., defaults to None
+ :type parent: Optional[MetadataCascadePolicyParentField], optional
+ :param scope: The scope of the metadata cascade policy can either be `global` or
+ `enterprise_*`. The `global` scope is used for policies that are
+ available to any Box enterprise. The `enterprise_*` scope represents
+ policies that have been created within a specific enterprise, where `*`
+ will be the ID of that enterprise., defaults to None
+ :type scope: Optional[str], optional
+ :param template_key: The key of the template that is cascaded down to the folder's
+ children.
+
+ 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, defaults to None
+ :type template_key: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.owner_enterprise = owner_enterprise
+ self.parent = parent
+ self.scope = scope
+ self.template_key = template_key
diff --git a/box_sdk_gen/schemas/metadata_error.py b/box_sdk_gen/schemas/metadata_error.py
new file mode 100644
index 000000000..24d5ab170
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_error.py
@@ -0,0 +1,29 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataError(BaseObject):
+ def __init__(
+ self,
+ *,
+ code: Optional[str] = None,
+ message: Optional[str] = None,
+ request_id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param code: A Box-specific error code., defaults to None
+ :type code: Optional[str], optional
+ :param message: A short message describing the error., defaults to None
+ :type message: Optional[str], optional
+ :param request_id: A unique identifier for this response, which can be used
+ when contacting Box support., defaults to None
+ :type request_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.code = code
+ self.message = message
+ self.request_id = request_id
diff --git a/box_sdk_gen/schemas/metadata_field_filter_date_range.py b/box_sdk_gen/schemas/metadata_field_filter_date_range.py
new file mode 100644
index 000000000..8fd94463c
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_field_filter_date_range.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class MetadataFieldFilterDateRange(BaseObject):
+ def __init__(
+ self, *, lt: Optional[DateTime] = None, gt: Optional[DateTime] = None, **kwargs
+ ):
+ """
+ :param lt: Specifies the (inclusive) upper bound for the metadata field
+ value. The value of a field must be lower than (`lt`) or
+ equal to this value for the search query to match this
+ template., defaults to None
+ :type lt: Optional[DateTime], optional
+ :param gt: Specifies the (inclusive) lower bound for the metadata field
+ value. The value of a field must be greater than (`gt`) or
+ equal to this value for the search query to match this
+ template., defaults to None
+ :type gt: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.lt = lt
+ self.gt = gt
diff --git a/box_sdk_gen/schemas/metadata_field_filter_float_range.py b/box_sdk_gen/schemas/metadata_field_filter_float_range.py
new file mode 100644
index 000000000..7e5d528c7
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_field_filter_float_range.py
@@ -0,0 +1,26 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataFieldFilterFloatRange(BaseObject):
+ def __init__(
+ self, *, lt: Optional[float] = None, gt: Optional[float] = None, **kwargs
+ ):
+ """
+ :param lt: Specifies the (inclusive) upper bound for the metadata field
+ value. The value of a field must be lower than (`lt`) or
+ equal to this value for the search query to match this
+ template., defaults to None
+ :type lt: Optional[float], optional
+ :param gt: Specifies the (inclusive) lower bound for the metadata field
+ value. The value of a field must be greater than (`gt`) or
+ equal to this value for the search query to match this
+ template., defaults to None
+ :type gt: Optional[float], optional
+ """
+ super().__init__(**kwargs)
+ self.lt = lt
+ self.gt = gt
diff --git a/box_sdk_gen/schemas/metadata_filter.py b/box_sdk_gen/schemas/metadata_filter.py
new file mode 100644
index 000000000..3df54e073
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_filter.py
@@ -0,0 +1,90 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from typing import Union
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.metadata_field_filter_float_range import (
+ MetadataFieldFilterFloatRange,
+)
+
+from box_sdk_gen.schemas.metadata_field_filter_date_range import (
+ MetadataFieldFilterDateRange,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataFilterScopeField(str, Enum):
+ GLOBAL = 'global'
+ ENTERPRISE = 'enterprise'
+ ENTERPRISE__ENTERPRISE_ID_ = 'enterprise_{enterprise_id}'
+
+
+class MetadataFilter(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'template_key': 'templateKey',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'templateKey': 'template_key',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ scope: Optional[MetadataFilterScopeField] = None,
+ template_key: Optional[str] = None,
+ filters: Optional[
+ Dict[
+ str,
+ Union[
+ str,
+ float,
+ List[str],
+ MetadataFieldFilterFloatRange,
+ MetadataFieldFilterDateRange,
+ ],
+ ]
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param scope: Specifies the scope of the template to filter search results by.
+
+ This will be `enterprise_{enterprise_id}` for templates defined
+ for use in this enterprise, and `global` for general templates
+ that are available to all enterprises using Box., defaults to None
+ :type scope: Optional[MetadataFilterScopeField], optional
+ :param template_key: The key of the template used to filter search results.
+
+ 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, defaults to None
+ :type template_key: Optional[str], optional
+ :param filters: Specifies which fields on the template to filter the search
+ results by. When more than one field is specified, the query
+ performs a logical `AND` to ensure that the instance of the
+ template matches each of the fields specified., defaults to None
+ :type filters: Optional[Dict[str, Union[str, float, List[str], MetadataFieldFilterFloatRange, MetadataFieldFilterDateRange]]], optional
+ """
+ super().__init__(**kwargs)
+ self.scope = scope
+ self.template_key = template_key
+ self.filters = filters
diff --git a/box_sdk_gen/schemas/metadata_full.py b/box_sdk_gen/schemas/metadata_full.py
new file mode 100644
index 000000000..4e52a463c
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_full.py
@@ -0,0 +1,76 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.schemas.metadata_base import MetadataBase
+
+from box_sdk_gen.schemas.metadata import Metadata
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataFull(Metadata):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'can_edit': '$canEdit',
+ 'id': '$id',
+ 'type': '$type',
+ 'type_version': '$typeVersion',
+ **Metadata._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ '$canEdit': 'can_edit',
+ '$id': 'id',
+ '$type': 'type',
+ '$typeVersion': 'type_version',
+ **Metadata._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ can_edit: Optional[bool] = None,
+ id: Optional[str] = None,
+ type: Optional[str] = None,
+ type_version: Optional[int] = None,
+ parent: Optional[str] = None,
+ template: Optional[str] = None,
+ scope: Optional[str] = None,
+ version: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param can_edit: Whether the user can edit this metadata instance., defaults to None
+ :type can_edit: Optional[bool], optional
+ :param id: A UUID to identify the metadata instance., defaults to None
+ :type id: Optional[str], optional
+ :param type: A unique identifier for the "type" of this instance. This is an
+ internal system property and should not be used by a client
+ application., defaults to None
+ :type type: Optional[str], optional
+ :param type_version: The last-known version of the template of the object. This is an
+ internal system property and should not be used by a client
+ application., defaults to None
+ :type type_version: Optional[int], optional
+ :param parent: The identifier of the item that this metadata instance
+ has been attached to. This combines the `type` and the `id`
+ of the parent in the form `{type}_{id}`., defaults to None
+ :type parent: Optional[str], optional
+ :param template: The name of the template., defaults to None
+ :type template: Optional[str], optional
+ :param scope: An ID for the scope in which this template
+ has been applied. This will be `enterprise_{enterprise_id}` for templates
+ defined for use in this enterprise, and `global` for general templates
+ that are available to all enterprises using Box., defaults to None
+ :type scope: Optional[str], optional
+ :param version: The version of the metadata instance. This version starts at 0 and
+ increases every time a user-defined property is modified., defaults to None
+ :type version: Optional[int], optional
+ """
+ super().__init__(
+ parent=parent, template=template, scope=scope, version=version, **kwargs
+ )
+ self.can_edit = can_edit
+ self.id = id
+ self.type = type
+ self.type_version = type_version
+ self.extra_data = kwargs
diff --git a/box_sdk_gen/schemas/metadata_instance_value.py b/box_sdk_gen/schemas/metadata_instance_value.py
new file mode 100644
index 000000000..89af11f7b
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_instance_value.py
@@ -0,0 +1,7 @@
+from typing import Union
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+MetadataInstanceValue = Union[str, int, float, List[str]]
diff --git a/box_sdk_gen/schemas/metadata_query.py b/box_sdk_gen/schemas/metadata_query.py
new file mode 100644
index 000000000..e98c90b51
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_query.py
@@ -0,0 +1,129 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Dict
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataQueryOrderByDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class MetadataQueryOrderByField(BaseObject):
+ def __init__(
+ self,
+ *,
+ field_key: Optional[str] = None,
+ direction: Optional[MetadataQueryOrderByDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param field_key: The metadata template field to order by.
+
+ The `field_key` represents the `key` value of a field from the
+ metadata template being searched for., defaults to None
+ :type field_key: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending.
+
+ The `ordering` direction must be the same for each item in the
+ array., defaults to None
+ :type direction: Optional[MetadataQueryOrderByDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.field_key = field_key
+ self.direction = direction
+
+
+class MetadataQuery(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'from_': 'from',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'from': 'from_',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ from_: str,
+ ancestor_folder_id: str,
+ *,
+ query: Optional[str] = None,
+ query_params: Optional[Dict] = None,
+ order_by: Optional[List[MetadataQueryOrderByField]] = None,
+ limit: Optional[int] = None,
+ marker: Optional[str] = None,
+ fields: Optional[List[str]] = None,
+ **kwargs
+ ):
+ """
+ :param from_: Specifies the template used in the query. Must be in the form
+ `scope.templateKey`. Not all templates can be used in this field,
+ most notably the built-in, Box-provided classification templates
+ can not be used in a query.
+ :type from_: str
+ :param ancestor_folder_id: 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.
+ :type ancestor_folder_id: str
+ :param query: The query to perform. A query is a logical expression that is very similar
+ to a SQL `SELECT` statement. Values in the search query can be turned into
+ parameters specified in the `query_param` arguments list to prevent having
+ to manually insert search values into the query string.
+
+ For example, a value of `:amount` would represent the `amount` value in
+ `query_params` object., defaults to None
+ :type query: Optional[str], optional
+ :param query_params: 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., defaults to None
+ :type query_params: Optional[Dict], optional
+ :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., defaults to None
+ :type order_by: Optional[List[MetadataQueryOrderByField]], 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
+ returned., defaults to None
+ :type limit: Optional[int], optional
+ :param marker: Marker to use for requesting the next page., defaults to None
+ :type marker: Optional[str], optional
+ :param fields: By default, this endpoint returns only the most basic info about the items for
+ which the query matches. This attribute can be used to specify a list of
+ additional attributes to return for any item, including its metadata.
+
+ This attribute takes a list of item fields, metadata template identifiers,
+ or metadata template field identifiers.
+
+ For example:
+
+ * `created_by` will add the details of the user who created the item to
+ the response.
+ * `metadata..` will return the mini-representation
+ of the metadata instance identified by the `scope` and `templateKey`.
+ * `metadata...` will return all the mini-representation
+ of the metadata instance identified by the `scope` and `templateKey` plus
+ the field specified by the `field` name. Multiple fields for the same
+ `scope` and `templateKey` can be defined., defaults to None
+ :type fields: Optional[List[str]], optional
+ """
+ super().__init__(**kwargs)
+ self.from_ = from_
+ self.ancestor_folder_id = ancestor_folder_id
+ self.query = query
+ self.query_params = query_params
+ self.order_by = order_by
+ self.limit = limit
+ self.marker = marker
+ self.fields = fields
diff --git a/box_sdk_gen/schemas/metadata_query_index.py b/box_sdk_gen/schemas/metadata_query_index.py
new file mode 100644
index 000000000..8eb1687ae
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_query_index.py
@@ -0,0 +1,66 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataQueryIndexStatusField(str, Enum):
+ BUILDING = 'building'
+ ACTIVE = 'active'
+ DISABLED = 'disabled'
+
+
+class MetadataQueryIndexFieldsSortDirectionField(str, Enum):
+ ASC = 'asc'
+ DESC = 'desc'
+
+
+class MetadataQueryIndexFieldsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ key: Optional[str] = None,
+ sort_direction: Optional[MetadataQueryIndexFieldsSortDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param key: The metadata template field key., defaults to None
+ :type key: Optional[str], optional
+ :param sort_direction: The sort direction of the field., defaults to None
+ :type sort_direction: Optional[MetadataQueryIndexFieldsSortDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.key = key
+ self.sort_direction = sort_direction
+
+
+class MetadataQueryIndex(BaseObject):
+ def __init__(
+ self,
+ type: str,
+ status: MetadataQueryIndexStatusField,
+ *,
+ id: Optional[str] = None,
+ fields: Optional[List[MetadataQueryIndexFieldsField]] = None,
+ **kwargs
+ ):
+ """
+ :param type: Value is always `metadata_query_index`.
+ :type type: str
+ :param status: The status of the metadata query index.
+ :type status: MetadataQueryIndexStatusField
+ :param id: The ID of the metadata query index., defaults to None
+ :type id: Optional[str], optional
+ :param fields: A list of template fields which make up the index., defaults to None
+ :type fields: Optional[List[MetadataQueryIndexFieldsField]], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.status = status
+ self.id = id
+ self.fields = fields
diff --git a/box_sdk_gen/schemas/metadata_query_results.py b/box_sdk_gen/schemas/metadata_query_results.py
new file mode 100644
index 000000000..381389e8b
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_query_results.py
@@ -0,0 +1,43 @@
+from typing import Optional
+
+from typing import List
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.schemas.folder_full import FolderFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataQueryResults(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[Union[FileFull, FolderFull]]] = None,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: The mini representation of the files and folders that match the search
+ terms.
+
+ By default, this endpoint returns only the most basic info about the
+ items. To get additional fields for each item, including any of the
+ metadata, use the `fields` attribute in the query., defaults to None
+ :type entries: Optional[List[Union[FileFull, FolderFull]]], optional
+ :param limit: The limit that was used for this search. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
diff --git a/box_sdk_gen/schemas/metadata_template.py b/box_sdk_gen/schemas/metadata_template.py
new file mode 100644
index 000000000..2e3ae449c
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_template.py
@@ -0,0 +1,175 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataTemplateTypeField(str, Enum):
+ METADATA_TEMPLATE = 'metadata_template'
+
+
+class MetadataTemplateFieldsTypeField(str, Enum):
+ STRING = 'string'
+ FLOAT = 'float'
+ DATE = 'date'
+ ENUM = 'enum'
+ MULTISELECT = 'multiSelect'
+ INTEGER = 'integer'
+
+
+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
+ option and the internal key used when updating templates.
+ :type key: str
+ :param id: The internal unique identifier of the the option., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.key = key
+ self.id = id
+
+
+class MetadataTemplateFieldsField(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'display_name': 'displayName',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'displayName': 'display_name',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {
+ 'string',
+ 'float',
+ 'date',
+ 'enum',
+ 'multiSelect',
+ 'integer',
+ }
+
+ def __init__(
+ self,
+ type: MetadataTemplateFieldsTypeField,
+ key: str,
+ display_name: str,
+ *,
+ description: Optional[str] = None,
+ hidden: Optional[bool] = None,
+ options: Optional[List[MetadataTemplateFieldsOptionsField]] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of field. The basic fields are a `string` field for text, a
+ `float` field for numbers, and a `date` fields to present the user with a
+ date-time picker.
+
+ 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.
+
+ **Note**: The `integer` value is deprecated.
+ It is still present in the response,
+ but cannot be used in the POST request.
+ :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
+ :param display_name: The display name of the field as it is shown to the user in the web and
+ mobile apps.
+ :type display_name: str
+ :param description: A description of the field. This is not shown to the user., defaults to None
+ :type description: Optional[str], optional
+ :param hidden: Whether this field is hidden in the UI for the user and can only be set
+ through the API instead., defaults to None
+ :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., defaults to None
+ :type options: Optional[List[MetadataTemplateFieldsOptionsField]], optional
+ :param id: The unique ID of the metadata template field., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.key = key
+ self.display_name = display_name
+ self.description = description
+ self.hidden = hidden
+ self.options = options
+ self.id = id
+
+
+class MetadataTemplate(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'template_key': 'templateKey',
+ 'display_name': 'displayName',
+ 'copy_instance_on_item_copy': 'copyInstanceOnItemCopy',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'templateKey': 'template_key',
+ 'displayName': 'display_name',
+ 'copyInstanceOnItemCopy': 'copy_instance_on_item_copy',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {'metadata_template'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: MetadataTemplateTypeField = MetadataTemplateTypeField.METADATA_TEMPLATE,
+ scope: Optional[str] = None,
+ template_key: Optional[str] = None,
+ display_name: Optional[str] = None,
+ hidden: Optional[bool] = None,
+ fields: Optional[List[MetadataTemplateFieldsField]] = None,
+ copy_instance_on_item_copy: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the metadata template.
+ :type id: str
+ :param type: The value will always be `metadata_template`., defaults to MetadataTemplateTypeField.METADATA_TEMPLATE
+ :type type: MetadataTemplateTypeField, optional
+ :param scope: The scope of the metadata template can either be `global` or
+ `enterprise_*`. The `global` scope is used for templates that are
+ available to any Box enterprise. The `enterprise_*` scope represents
+ templates that have been created within a specific enterprise, where `*`
+ will be the ID of that enterprise., defaults to None
+ :type scope: Optional[str], optional
+ :param template_key: A unique identifier for the template. This identifier is unique across
+ the `scope` of the enterprise to which the metadata template is being
+ applied, yet is not necessarily unique across different enterprises., defaults to None
+ :type template_key: Optional[str], optional
+ :param display_name: The display name of the template. This can be seen in the Box web app
+ and mobile apps., defaults to None
+ :type display_name: Optional[str], optional
+ :param hidden: Defines if this template is visible in the Box web app UI, or if
+ it is purely intended for usage through the API., defaults to None
+ :type hidden: Optional[bool], optional
+ :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., defaults to None
+ :type fields: Optional[List[MetadataTemplateFieldsField]], optional
+ :param copy_instance_on_item_copy: Whether or not to include the metadata when a file or folder is copied., defaults to None
+ :type copy_instance_on_item_copy: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.scope = scope
+ self.template_key = template_key
+ self.display_name = display_name
+ self.hidden = hidden
+ self.fields = fields
+ self.copy_instance_on_item_copy = copy_instance_on_item_copy
diff --git a/box_sdk_gen/schemas/metadata_templates.py b/box_sdk_gen/schemas/metadata_templates.py
new file mode 100644
index 000000000..f0f8b6fa7
--- /dev/null
+++ b/box_sdk_gen/schemas/metadata_templates.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.metadata_template import MetadataTemplate
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class MetadataTemplates(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[MetadataTemplate]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of metadata templates., defaults to None
+ :type entries: Optional[List[MetadataTemplate]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/metadatas.py b/box_sdk_gen/schemas/metadatas.py
new file mode 100644
index 000000000..428f4cf6c
--- /dev/null
+++ b/box_sdk_gen/schemas/metadatas.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.metadata import Metadata
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Metadatas(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[Metadata]] = None,
+ limit: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list of metadata instances, as applied to this file or folder., defaults to None
+ :type entries: Optional[List[Metadata]], optional
+ :param limit: The limit that was used for this page of results., defaults to None
+ :type limit: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
diff --git a/box_sdk_gen/schemas/o_auth_2_error.py b/box_sdk_gen/schemas/o_auth_2_error.py
new file mode 100644
index 000000000..524fe4f20
--- /dev/null
+++ b/box_sdk_gen/schemas/o_auth_2_error.py
@@ -0,0 +1,24 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class OAuth2Error(BaseObject):
+ def __init__(
+ self,
+ *,
+ error: Optional[str] = None,
+ error_description: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param error: The type of the error returned., defaults to None
+ :type error: Optional[str], optional
+ :param error_description: The type of the error returned., defaults to None
+ :type error_description: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.error = error
+ self.error_description = error_description
diff --git a/box_sdk_gen/schemas/outcome.py b/box_sdk_gen/schemas/outcome.py
new file mode 100644
index 000000000..e0060eb42
--- /dev/null
+++ b/box_sdk_gen/schemas/outcome.py
@@ -0,0 +1,36 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.collaborator_variable import CollaboratorVariable
+
+from box_sdk_gen.schemas.completion_rule_variable import CompletionRuleVariable
+
+from box_sdk_gen.schemas.role_variable import RoleVariable
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Outcome(BaseObject):
+ def __init__(
+ self,
+ id: str,
+ *,
+ collaborators: Optional[CollaboratorVariable] = None,
+ completion_rule: Optional[CompletionRuleVariable] = None,
+ file_collaborator_role: Optional[RoleVariable] = None,
+ task_collaborators: Optional[CollaboratorVariable] = None,
+ role: Optional[RoleVariable] = None,
+ **kwargs
+ ):
+ """
+ :param id: ID of a specific outcome.
+ :type id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.collaborators = collaborators
+ self.completion_rule = completion_rule
+ self.file_collaborator_role = file_collaborator_role
+ self.task_collaborators = task_collaborators
+ self.role = role
diff --git a/box_sdk_gen/schemas/post_o_auth_2_revoke.py b/box_sdk_gen/schemas/post_o_auth_2_revoke.py
new file mode 100644
index 000000000..d93eec3c4
--- /dev/null
+++ b/box_sdk_gen/schemas/post_o_auth_2_revoke.py
@@ -0,0 +1,30 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class PostOAuth2Revoke(BaseObject):
+ def __init__(
+ self,
+ *,
+ client_id: Optional[str] = None,
+ client_secret: Optional[str] = None,
+ token: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param client_id: The Client ID of the application requesting to revoke the
+ access token., defaults to None
+ :type client_id: Optional[str], optional
+ :param client_secret: The client secret of the application requesting to revoke
+ an access token., defaults to None
+ :type client_secret: Optional[str], optional
+ :param token: The access token to revoke., defaults to None
+ :type token: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.client_id = client_id
+ self.client_secret = client_secret
+ self.token = token
diff --git a/box_sdk_gen/schemas/post_o_auth_2_token.py b/box_sdk_gen/schemas/post_o_auth_2_token.py
new file mode 100644
index 000000000..1d92c4c54
--- /dev/null
+++ b/box_sdk_gen/schemas/post_o_auth_2_token.py
@@ -0,0 +1,146 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class PostOAuth2TokenGrantTypeField(str, Enum):
+ AUTHORIZATION_CODE = 'authorization_code'
+ REFRESH_TOKEN = 'refresh_token'
+ CLIENT_CREDENTIALS = 'client_credentials'
+ URN_IETF_PARAMS_OAUTH_GRANT_TYPE_JWT_BEARER = (
+ 'urn:ietf:params:oauth:grant-type:jwt-bearer'
+ )
+ URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE = (
+ 'urn:ietf:params:oauth:grant-type:token-exchange'
+ )
+
+
+class PostOAuth2TokenSubjectTokenTypeField(str, Enum):
+ URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN = (
+ 'urn:ietf:params:oauth:token-type:access_token'
+ )
+
+
+class PostOAuth2TokenActorTokenTypeField(str, Enum):
+ URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ID_TOKEN = (
+ 'urn:ietf:params:oauth:token-type:id_token'
+ )
+
+
+class PostOAuth2TokenBoxSubjectTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+ USER = 'user'
+
+
+class PostOAuth2Token(BaseObject):
+ def __init__(
+ self,
+ grant_type: PostOAuth2TokenGrantTypeField,
+ *,
+ client_id: Optional[str] = None,
+ client_secret: Optional[str] = None,
+ code: Optional[str] = None,
+ refresh_token: Optional[str] = None,
+ assertion: Optional[str] = None,
+ subject_token: Optional[str] = None,
+ subject_token_type: Optional[PostOAuth2TokenSubjectTokenTypeField] = None,
+ actor_token: Optional[str] = None,
+ actor_token_type: Optional[PostOAuth2TokenActorTokenTypeField] = None,
+ scope: Optional[str] = None,
+ resource: Optional[str] = None,
+ box_subject_type: Optional[PostOAuth2TokenBoxSubjectTypeField] = None,
+ box_subject_id: Optional[str] = None,
+ box_shared_link: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :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: PostOAuth2TokenGrantTypeField
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :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`., defaults to None
+ :type subject_token_type: Optional[PostOAuth2TokenSubjectTokenTypeField], 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`., defaults to None
+ :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`., defaults to None
+ :type actor_token_type: Optional[PostOAuth2TokenActorTokenTypeField], 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**.., defaults to None
+ :type scope: Optional[str], optional
+ :param resource: Full URL for the file that the token should be generated for., defaults to None
+ :type resource: Optional[str], optional
+ :param box_subject_type: Used in combination with `client_credentials` as the `grant_type`., defaults to None
+ :type box_subject_type: Optional[PostOAuth2TokenBoxSubjectTypeField], 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., defaults to None
+ :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., defaults to None
+ :type box_shared_link: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.grant_type = grant_type
+ self.client_id = client_id
+ self.client_secret = client_secret
+ self.code = code
+ self.refresh_token = refresh_token
+ self.assertion = assertion
+ self.subject_token = subject_token
+ self.subject_token_type = subject_token_type
+ self.actor_token = actor_token
+ self.actor_token_type = actor_token_type
+ self.scope = scope
+ self.resource = resource
+ self.box_subject_type = box_subject_type
+ self.box_subject_id = box_subject_id
+ self.box_shared_link = box_shared_link
diff --git a/box_sdk_gen/schemas/post_o_auth_2_token_refresh_access_token.py b/box_sdk_gen/schemas/post_o_auth_2_token_refresh_access_token.py
new file mode 100644
index 000000000..a6eb8c5e3
--- /dev/null
+++ b/box_sdk_gen/schemas/post_o_auth_2_token_refresh_access_token.py
@@ -0,0 +1,36 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class PostOAuth2TokenRefreshAccessTokenGrantTypeField(str, Enum):
+ REFRESH_TOKEN = 'refresh_token'
+
+
+class PostOAuth2TokenRefreshAccessToken(BaseObject):
+ def __init__(
+ self,
+ client_id: str,
+ client_secret: str,
+ refresh_token: str,
+ *,
+ grant_type: PostOAuth2TokenRefreshAccessTokenGrantTypeField = PostOAuth2TokenRefreshAccessTokenGrantTypeField.REFRESH_TOKEN,
+ **kwargs
+ ):
+ """
+ :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 grant_type: The type of request being made, in this case a refresh request., defaults to PostOAuth2TokenRefreshAccessTokenGrantTypeField.REFRESH_TOKEN
+ :type grant_type: PostOAuth2TokenRefreshAccessTokenGrantTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.client_id = client_id
+ self.client_secret = client_secret
+ self.refresh_token = refresh_token
+ self.grant_type = grant_type
diff --git a/box_sdk_gen/schemas/realtime_server.py b/box_sdk_gen/schemas/realtime_server.py
new file mode 100644
index 000000000..f8228268e
--- /dev/null
+++ b/box_sdk_gen/schemas/realtime_server.py
@@ -0,0 +1,43 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RealtimeServer(BaseObject):
+ def __init__(
+ self,
+ *,
+ type: Optional[str] = None,
+ url: Optional[str] = None,
+ ttl: Optional[str] = None,
+ max_retries: Optional[str] = None,
+ retry_timeout: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `realtime_server`., defaults to None
+ :type type: Optional[str], optional
+ :param url: The URL for the server., defaults to None
+ :type url: Optional[str], optional
+ :param ttl: The time in minutes for which this server is available., defaults to None
+ :type ttl: Optional[str], optional
+ :param max_retries: The maximum number of retries this server will
+ allow before a new long poll should be started by
+ getting a [new list of server](#options-events)., defaults to None
+ :type max_retries: Optional[str], optional
+ :param retry_timeout: The maximum number of seconds without a response
+ after which you should retry the long poll connection.
+
+ This helps to overcome network issues where the long
+ poll looks to be working but no packages are coming
+ through., defaults to None
+ :type retry_timeout: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.url = url
+ self.ttl = ttl
+ self.max_retries = max_retries
+ self.retry_timeout = retry_timeout
diff --git a/box_sdk_gen/schemas/realtime_servers.py b/box_sdk_gen/schemas/realtime_servers.py
new file mode 100644
index 000000000..933fb5c52
--- /dev/null
+++ b/box_sdk_gen/schemas/realtime_servers.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.realtime_server import RealtimeServer
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RealtimeServers(BaseObject):
+ def __init__(
+ self,
+ *,
+ chunk_size: Optional[int] = None,
+ entries: Optional[List[RealtimeServer]] = None,
+ **kwargs
+ ):
+ """
+ :param chunk_size: The number of items in this response., defaults to None
+ :type chunk_size: Optional[int], optional
+ :param entries: A list of real-time servers., defaults to None
+ :type entries: Optional[List[RealtimeServer]], optional
+ """
+ super().__init__(**kwargs)
+ self.chunk_size = chunk_size
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/recent_item.py b/box_sdk_gen/schemas/recent_item.py
new file mode 100644
index 000000000..837de2aa6
--- /dev/null
+++ b/box_sdk_gen/schemas/recent_item.py
@@ -0,0 +1,56 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.schemas.folder_full import FolderFull
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class RecentItemInteractionTypeField(str, Enum):
+ ITEM_PREVIEW = 'item_preview'
+ ITEM_UPLOAD = 'item_upload'
+ ITEM_COMMENT = 'item_comment'
+ ITEM_OPEN = 'item_open'
+ ITEM_MODIFY = 'item_modify'
+
+
+class RecentItem(BaseObject):
+ def __init__(
+ self,
+ *,
+ type: Optional[str] = None,
+ item: Optional[Union[FileFull, FolderFull, WebLink]] = None,
+ interaction_type: Optional[RecentItemInteractionTypeField] = None,
+ interacted_at: Optional[DateTime] = None,
+ interaction_shared_link: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `recent_item`., defaults to None
+ :type type: Optional[str], optional
+ :param interaction_type: The most recent type of access the user performed on
+ the item., defaults to None
+ :type interaction_type: Optional[RecentItemInteractionTypeField], optional
+ :param interacted_at: The time of the most recent interaction., defaults to None
+ :type interacted_at: Optional[DateTime], optional
+ :param interaction_shared_link: If the item was accessed through a shared link it will appear here,
+ otherwise this will be null., defaults to None
+ :type interaction_shared_link: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.item = item
+ self.interaction_type = interaction_type
+ self.interacted_at = interacted_at
+ self.interaction_shared_link = interaction_shared_link
diff --git a/box_sdk_gen/schemas/recent_items.py b/box_sdk_gen/schemas/recent_items.py
new file mode 100644
index 000000000..8498a8fb9
--- /dev/null
+++ b/box_sdk_gen/schemas/recent_items.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.recent_item import RecentItem
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RecentItems(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[RecentItem]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of recent items., defaults to None
+ :type entries: Optional[List[RecentItem]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/retention_policies.py b/box_sdk_gen/schemas/retention_policies.py
new file mode 100644
index 000000000..3a365edc3
--- /dev/null
+++ b/box_sdk_gen/schemas/retention_policies.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.retention_policy import RetentionPolicy
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RetentionPolicies(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[RetentionPolicy]] = None,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list in which each entry represents a retention policy object., defaults to None
+ :type entries: Optional[List[RetentionPolicy]], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
diff --git a/box_sdk_gen/schemas/retention_policy.py b/box_sdk_gen/schemas/retention_policy.py
new file mode 100644
index 000000000..91f884090
--- /dev/null
+++ b/box_sdk_gen/schemas/retention_policy.py
@@ -0,0 +1,173 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.retention_policy_base import RetentionPolicyBaseTypeField
+
+from box_sdk_gen.schemas.retention_policy_base import RetentionPolicyBase
+
+from box_sdk_gen.schemas.retention_policy_mini import (
+ RetentionPolicyMiniDispositionActionField,
+)
+
+from box_sdk_gen.schemas.retention_policy_mini import RetentionPolicyMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class RetentionPolicyPolicyTypeField(str, Enum):
+ FINITE = 'finite'
+ INDEFINITE = 'indefinite'
+
+
+class RetentionPolicyRetentionTypeField(str, Enum):
+ MODIFIABLE = 'modifiable'
+ NON_MODIFIABLE = 'non_modifiable'
+
+
+class RetentionPolicyStatusField(str, Enum):
+ ACTIVE = 'active'
+ RETIRED = 'retired'
+
+
+class RetentionPolicyAssignmentCountsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ enterprise: Optional[int] = None,
+ folder: Optional[int] = None,
+ metadata_template: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param enterprise: The number of enterprise assignments this policy has. The maximum value is 1., defaults to None
+ :type enterprise: Optional[int], optional
+ :param folder: The number of folder assignments this policy has., defaults to None
+ :type folder: Optional[int], optional
+ :param metadata_template: The number of metadata template assignments this policy has., defaults to None
+ :type metadata_template: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.enterprise = enterprise
+ self.folder = folder
+ self.metadata_template = metadata_template
+
+
+class RetentionPolicy(RetentionPolicyMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ description: Optional[str] = None,
+ policy_type: Optional[RetentionPolicyPolicyTypeField] = None,
+ retention_type: Optional[RetentionPolicyRetentionTypeField] = None,
+ status: Optional[RetentionPolicyStatusField] = None,
+ created_by: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ can_owner_extend_retention: Optional[bool] = None,
+ are_owners_notified: Optional[bool] = None,
+ custom_notification_recipients: Optional[List[UserMini]] = None,
+ assignment_counts: Optional[RetentionPolicyAssignmentCountsField] = None,
+ policy_name: Optional[str] = None,
+ retention_length: Optional[str] = None,
+ disposition_action: Optional[RetentionPolicyMiniDispositionActionField] = None,
+ type: RetentionPolicyBaseTypeField = RetentionPolicyBaseTypeField.RETENTION_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represents a retention policy.
+ :type id: str
+ :param description: The additional text description of the retention policy., defaults to None
+ :type description: Optional[str], optional
+ :param policy_type: 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., defaults to None
+ :type policy_type: Optional[RetentionPolicyPolicyTypeField], optional
+ :param retention_type: 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., defaults to None
+ :type retention_type: Optional[RetentionPolicyRetentionTypeField], optional
+ :param status: The status of the retention policy. The status of
+ a policy will be `active`, unless explicitly retired by an
+ administrator, in which case the status will be `retired`.
+ Once a policy has been retired, it cannot become
+ active again., defaults to None
+ :type status: Optional[RetentionPolicyStatusField], optional
+ :param created_at: When the retention policy object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the retention policy object was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param can_owner_extend_retention: Determines if the owner of items under the policy
+ can extend the retention when the original
+ retention duration is about to end., defaults to None
+ :type can_owner_extend_retention: Optional[bool], optional
+ :param are_owners_notified: Determines if owners and co-owners of items
+ under the policy are notified when
+ the retention duration is about to end., defaults to None
+ :type are_owners_notified: Optional[bool], optional
+ :param custom_notification_recipients: A list of users notified when the retention policy duration is about to end., defaults to None
+ :type custom_notification_recipients: Optional[List[UserMini]], optional
+ :param assignment_counts: Counts the retention policy assignments for each item type., defaults to None
+ :type assignment_counts: Optional[RetentionPolicyAssignmentCountsField], optional
+ :param policy_name: The name given to the retention policy., defaults to None
+ :type policy_name: Optional[str], optional
+ :param retention_length: 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`., defaults to None
+ :type retention_length: Optional[str], optional
+ :param disposition_action: The disposition action of the retention policy.
+ This action can be `permanently_delete`, which
+ will cause the content retained by the policy
+ to be permanently deleted, or `remove_retention`,
+ which will lift the retention policy from the content,
+ allowing it to be deleted by users,
+ once the retention policy has expired., defaults to None
+ :type disposition_action: Optional[RetentionPolicyMiniDispositionActionField], optional
+ :param type: The value will always be `retention_policy`., defaults to RetentionPolicyBaseTypeField.RETENTION_POLICY
+ :type type: RetentionPolicyBaseTypeField, optional
+ """
+ super().__init__(
+ id=id,
+ policy_name=policy_name,
+ retention_length=retention_length,
+ disposition_action=disposition_action,
+ type=type,
+ **kwargs
+ )
+ self.description = description
+ self.policy_type = policy_type
+ self.retention_type = retention_type
+ self.status = status
+ self.created_by = created_by
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.can_owner_extend_retention = can_owner_extend_retention
+ self.are_owners_notified = are_owners_notified
+ self.custom_notification_recipients = custom_notification_recipients
+ self.assignment_counts = assignment_counts
diff --git a/box_sdk_gen/schemas/retention_policy_assignment.py b/box_sdk_gen/schemas/retention_policy_assignment.py
new file mode 100644
index 000000000..a1e492256
--- /dev/null
+++ b/box_sdk_gen/schemas/retention_policy_assignment.py
@@ -0,0 +1,113 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.retention_policy_mini import RetentionPolicyMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class RetentionPolicyAssignmentTypeField(str, Enum):
+ RETENTION_POLICY_ASSIGNMENT = 'retention_policy_assignment'
+
+
+class RetentionPolicyAssignmentAssignedToTypeField(str, Enum):
+ FOLDER = 'folder'
+ ENTERPRISE = 'enterprise'
+ METADATA_TEMPLATE = 'metadata_template'
+
+
+class RetentionPolicyAssignmentAssignedToField(BaseObject):
+ _discriminator = 'type', {'folder', 'enterprise', 'metadata_template'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[RetentionPolicyAssignmentAssignedToTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the folder, enterprise, or metadata template
+ the policy is assigned to.
+ Set to null or omit when type is set to enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of resource the policy is assigned to., defaults to None
+ :type type: Optional[RetentionPolicyAssignmentAssignedToTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class RetentionPolicyAssignmentFilterFieldsField(BaseObject):
+ def __init__(
+ self, *, field: Optional[str] = None, value: Optional[str] = None, **kwargs
+ ):
+ """
+ :param field: The metadata attribute key id., defaults to None
+ :type field: Optional[str], optional
+ :param value: The metadata attribute field id. For value, only
+ enum and multiselect types are supported., defaults to None
+ :type value: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.field = field
+ self.value = value
+
+
+class RetentionPolicyAssignment(BaseObject):
+ _discriminator = 'type', {'retention_policy_assignment'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: RetentionPolicyAssignmentTypeField = RetentionPolicyAssignmentTypeField.RETENTION_POLICY_ASSIGNMENT,
+ retention_policy: Optional[RetentionPolicyMini] = None,
+ assigned_to: Optional[RetentionPolicyAssignmentAssignedToField] = None,
+ filter_fields: Optional[
+ List[RetentionPolicyAssignmentFilterFieldsField]
+ ] = None,
+ assigned_by: Optional[UserMini] = None,
+ assigned_at: Optional[DateTime] = None,
+ start_date_field: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for a retention policy assignment.
+ :type id: str
+ :param type: The value will always be `retention_policy_assignment`., defaults to RetentionPolicyAssignmentTypeField.RETENTION_POLICY_ASSIGNMENT
+ :type type: RetentionPolicyAssignmentTypeField, optional
+ :param assigned_to: The `type` and `id` of the content that is under
+ retention. The `type` can either be `folder`
+ `enterprise`, or `metadata_template`., defaults to None
+ :type assigned_to: Optional[RetentionPolicyAssignmentAssignedToField], optional
+ :param filter_fields: An array of field objects. Values are only returned if the `assigned_to`
+ type is `metadata_template`. Otherwise, the array is blank., defaults to None
+ :type filter_fields: Optional[List[RetentionPolicyAssignmentFilterFieldsField]], optional
+ :param assigned_at: When the retention policy assignment object was
+ created., defaults to None
+ :type assigned_at: Optional[DateTime], 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., defaults to None
+ :type start_date_field: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.retention_policy = retention_policy
+ self.assigned_to = assigned_to
+ self.filter_fields = filter_fields
+ self.assigned_by = assigned_by
+ self.assigned_at = assigned_at
+ self.start_date_field = start_date_field
diff --git a/box_sdk_gen/schemas/retention_policy_assignment_base.py b/box_sdk_gen/schemas/retention_policy_assignment_base.py
new file mode 100644
index 000000000..35a04809a
--- /dev/null
+++ b/box_sdk_gen/schemas/retention_policy_assignment_base.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RetentionPolicyAssignmentBaseTypeField(str, Enum):
+ RETENTION_POLICY_ASSIGNMENT = 'retention_policy_assignment'
+
+
+class RetentionPolicyAssignmentBase(BaseObject):
+ _discriminator = 'type', {'retention_policy_assignment'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: RetentionPolicyAssignmentBaseTypeField = RetentionPolicyAssignmentBaseTypeField.RETENTION_POLICY_ASSIGNMENT,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represents a file version.
+ :type id: str
+ :param type: The value will always be `retention_policy_assignment`., defaults to RetentionPolicyAssignmentBaseTypeField.RETENTION_POLICY_ASSIGNMENT
+ :type type: RetentionPolicyAssignmentBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/retention_policy_assignments.py b/box_sdk_gen/schemas/retention_policy_assignments.py
new file mode 100644
index 000000000..5429d0cfc
--- /dev/null
+++ b/box_sdk_gen/schemas/retention_policy_assignments.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.retention_policy_assignment import RetentionPolicyAssignment
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RetentionPolicyAssignments(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[RetentionPolicyAssignment]] = None,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list of retention policy assignments., defaults to None
+ :type entries: Optional[List[RetentionPolicyAssignment]], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
diff --git a/box_sdk_gen/schemas/retention_policy_base.py b/box_sdk_gen/schemas/retention_policy_base.py
new file mode 100644
index 000000000..550261c73
--- /dev/null
+++ b/box_sdk_gen/schemas/retention_policy_base.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RetentionPolicyBaseTypeField(str, Enum):
+ RETENTION_POLICY = 'retention_policy'
+
+
+class RetentionPolicyBase(BaseObject):
+ _discriminator = 'type', {'retention_policy'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: RetentionPolicyBaseTypeField = RetentionPolicyBaseTypeField.RETENTION_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represents a retention policy.
+ :type id: str
+ :param type: The value will always be `retention_policy`., defaults to RetentionPolicyBaseTypeField.RETENTION_POLICY
+ :type type: RetentionPolicyBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/retention_policy_mini.py b/box_sdk_gen/schemas/retention_policy_mini.py
new file mode 100644
index 000000000..ff8ad0b20
--- /dev/null
+++ b/box_sdk_gen/schemas/retention_policy_mini.py
@@ -0,0 +1,54 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.schemas.retention_policy_base import RetentionPolicyBaseTypeField
+
+from box_sdk_gen.schemas.retention_policy_base import RetentionPolicyBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RetentionPolicyMiniDispositionActionField(str, Enum):
+ PERMANENTLY_DELETE = 'permanently_delete'
+ REMOVE_RETENTION = 'remove_retention'
+
+
+class RetentionPolicyMini(RetentionPolicyBase):
+ def __init__(
+ self,
+ id: str,
+ *,
+ policy_name: Optional[str] = None,
+ retention_length: Optional[str] = None,
+ disposition_action: Optional[RetentionPolicyMiniDispositionActionField] = None,
+ type: RetentionPolicyBaseTypeField = RetentionPolicyBaseTypeField.RETENTION_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represents a retention policy.
+ :type id: str
+ :param policy_name: The name given to the retention policy., defaults to None
+ :type policy_name: Optional[str], optional
+ :param retention_length: 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`., defaults to None
+ :type retention_length: Optional[str], optional
+ :param disposition_action: The disposition action of the retention policy.
+ This action can be `permanently_delete`, which
+ will cause the content retained by the policy
+ to be permanently deleted, or `remove_retention`,
+ which will lift the retention policy from the content,
+ allowing it to be deleted by users,
+ once the retention policy has expired., defaults to None
+ :type disposition_action: Optional[RetentionPolicyMiniDispositionActionField], optional
+ :param type: The value will always be `retention_policy`., defaults to RetentionPolicyBaseTypeField.RETENTION_POLICY
+ :type type: RetentionPolicyBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.policy_name = policy_name
+ self.retention_length = retention_length
+ self.disposition_action = disposition_action
diff --git a/box_sdk_gen/schemas/role_variable.py b/box_sdk_gen/schemas/role_variable.py
new file mode 100644
index 000000000..9e35facdf
--- /dev/null
+++ b/box_sdk_gen/schemas/role_variable.py
@@ -0,0 +1,47 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class RoleVariableTypeField(str, Enum):
+ VARIABLE = 'variable'
+
+
+class RoleVariableVariableTypeField(str, Enum):
+ COLLABORATOR_ROLE = 'collaborator_role'
+
+
+class RoleVariableVariableValueField(str, Enum):
+ EDITOR = 'editor'
+ VIEWER = 'viewer'
+ PREVIEWER = 'previewer'
+ UPLOADER = 'uploader'
+ PREVIEWER_UPLOADER = 'previewer uploader'
+ VIEWER_UPLOADER = 'viewer uploader'
+ CO_OWNER = 'co-owner'
+
+
+class RoleVariable(BaseObject):
+ _discriminator = 'type', {'variable'}
+
+ def __init__(
+ self,
+ variable_value: RoleVariableVariableValueField,
+ *,
+ type: RoleVariableTypeField = RoleVariableTypeField.VARIABLE,
+ variable_type: RoleVariableVariableTypeField = RoleVariableVariableTypeField.COLLABORATOR_ROLE,
+ **kwargs
+ ):
+ """
+ :param type: Role object type., defaults to RoleVariableTypeField.VARIABLE
+ :type type: RoleVariableTypeField, optional
+ :param variable_type: The variable type used
+ by the object., defaults to RoleVariableVariableTypeField.COLLABORATOR_ROLE
+ :type variable_type: RoleVariableVariableTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.variable_value = variable_value
+ self.type = type
+ self.variable_type = variable_type
diff --git a/box_sdk_gen/schemas/search_result_with_shared_link.py b/box_sdk_gen/schemas/search_result_with_shared_link.py
new file mode 100644
index 000000000..e7eaf52e5
--- /dev/null
+++ b/box_sdk_gen/schemas/search_result_with_shared_link.py
@@ -0,0 +1,37 @@
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.schemas.folder_full import FolderFull
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SearchResultWithSharedLink(BaseObject):
+ def __init__(
+ self,
+ *,
+ accessible_via_shared_link: Optional[str] = None,
+ item: Optional[Union[FileFull, FolderFull, WebLink]] = None,
+ type: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param accessible_via_shared_link: The optional shared link through which the user has access to this
+ item. This value is only returned for items for which the user has
+ recently accessed the file through a shared link. For all other
+ items this value will return `null`., defaults to None
+ :type accessible_via_shared_link: Optional[str], optional
+ :param type: The result type. The value is always `search_result`., defaults to None
+ :type type: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.accessible_via_shared_link = accessible_via_shared_link
+ self.item = item
+ self.type = type
diff --git a/box_sdk_gen/schemas/search_results.py b/box_sdk_gen/schemas/search_results.py
new file mode 100644
index 000000000..aa30ca8bd
--- /dev/null
+++ b/box_sdk_gen/schemas/search_results.py
@@ -0,0 +1,59 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_full import FileFull
+
+from box_sdk_gen.schemas.folder_full import FolderFull
+
+from box_sdk_gen.schemas.web_link import WebLink
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SearchResultsTypeField(str, Enum):
+ SEARCH_RESULTS_ITEMS = 'search_results_items'
+
+
+class SearchResults(BaseObject):
+ _discriminator = 'type', {'search_results_items'}
+
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ type: SearchResultsTypeField = SearchResultsTypeField.SEARCH_RESULTS_ITEMS,
+ entries: Optional[List[Union[FileFull, FolderFull, WebLink]]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the search results.
+ The total number of entries in the collection may be less than
+ `total_count`., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for this search. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter used., defaults to None
+ :type offset: Optional[int], optional
+ :param type: Specifies the response as search result items without shared links., defaults to SearchResultsTypeField.SEARCH_RESULTS_ITEMS
+ :type type: SearchResultsTypeField, optional
+ :param entries: The search results for the query provided., defaults to None
+ :type entries: Optional[List[Union[FileFull, FolderFull, WebLink]]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.type = type
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/search_results_with_shared_links.py b/box_sdk_gen/schemas/search_results_with_shared_links.py
new file mode 100644
index 000000000..cdf023cba
--- /dev/null
+++ b/box_sdk_gen/schemas/search_results_with_shared_links.py
@@ -0,0 +1,57 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.search_result_with_shared_link import (
+ SearchResultWithSharedLink,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SearchResultsWithSharedLinksTypeField(str, Enum):
+ SEARCH_RESULTS_WITH_SHARED_LINKS = 'search_results_with_shared_links'
+
+
+class SearchResultsWithSharedLinks(BaseObject):
+ _discriminator = 'type', {'search_results_with_shared_links'}
+
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ type: SearchResultsWithSharedLinksTypeField = SearchResultsWithSharedLinksTypeField.SEARCH_RESULTS_WITH_SHARED_LINKS,
+ entries: Optional[List[SearchResultWithSharedLink]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the search results.
+ The total number of entries in the collection may be less than
+ `total_count`., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for this search. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter used., defaults to None
+ :type offset: Optional[int], optional
+ :param type: Specifies the response as search result items with shared links., defaults to SearchResultsWithSharedLinksTypeField.SEARCH_RESULTS_WITH_SHARED_LINKS
+ :type type: SearchResultsWithSharedLinksTypeField, optional
+ :param entries: The search results for the query provided, including the
+ additional information about any shared links through
+ which the item has been shared with the user., defaults to None
+ :type entries: Optional[List[SearchResultWithSharedLink]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.type = type
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/session_termination_message.py b/box_sdk_gen/schemas/session_termination_message.py
new file mode 100644
index 000000000..2afe2acdb
--- /dev/null
+++ b/box_sdk_gen/schemas/session_termination_message.py
@@ -0,0 +1,15 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SessionTerminationMessage(BaseObject):
+ def __init__(self, *, message: Optional[str] = None, **kwargs):
+ """
+ :param message: The unique identifier for the termination job status., defaults to None
+ :type message: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.message = message
diff --git a/box_sdk_gen/schemas/shield_information_barrier.py b/box_sdk_gen/schemas/shield_information_barrier.py
new file mode 100644
index 000000000..efe6b2212
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier.py
@@ -0,0 +1,77 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.enterprise_base import EnterpriseBase
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class ShieldInformationBarrierTypeField(str, Enum):
+ SHIELD_INFORMATION_BARRIER = 'shield_information_barrier'
+
+
+class ShieldInformationBarrierStatusField(str, Enum):
+ DRAFT = 'draft'
+ PENDING = 'pending'
+ DISABLED = 'disabled'
+ ENABLED = 'enabled'
+ INVALID = 'invalid'
+
+
+class ShieldInformationBarrier(BaseObject):
+ _discriminator = 'type', {'shield_information_barrier'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[ShieldInformationBarrierTypeField] = None,
+ enterprise: Optional[EnterpriseBase] = None,
+ status: Optional[ShieldInformationBarrierStatusField] = None,
+ created_at: Optional[DateTime] = None,
+ created_by: Optional[UserBase] = None,
+ updated_at: Optional[DateTime] = None,
+ updated_by: Optional[UserBase] = None,
+ enabled_at: Optional[DateTime] = None,
+ enabled_by: Optional[UserBase] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for the shield information barrier., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier., defaults to None
+ :type type: Optional[ShieldInformationBarrierTypeField], optional
+ :param enterprise: The `type` and `id` of enterprise this barrier is under., defaults to None
+ :type enterprise: Optional[EnterpriseBase], optional
+ :param status: Status of the shield information barrier., defaults to None
+ :type status: Optional[ShieldInformationBarrierStatusField], optional
+ :param created_at: ISO date time string when this
+ shield information barrier object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param created_by: The user who created this shield information barrier., defaults to None
+ :type created_by: Optional[UserBase], optional
+ :param updated_at: ISO date time string when this shield information barrier was updated., defaults to None
+ :type updated_at: Optional[DateTime], optional
+ :param updated_by: The user that updated this shield information barrier., defaults to None
+ :type updated_by: Optional[UserBase], optional
+ :param enabled_at: ISO date time string when this shield information barrier was enabled., defaults to None
+ :type enabled_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.enterprise = enterprise
+ self.status = status
+ self.created_at = created_at
+ self.created_by = created_by
+ self.updated_at = updated_at
+ self.updated_by = updated_by
+ self.enabled_at = enabled_at
+ self.enabled_by = enabled_by
diff --git a/box_sdk_gen/schemas/shield_information_barrier_base.py b/box_sdk_gen/schemas/shield_information_barrier_base.py
new file mode 100644
index 000000000..2181be859
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_base.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierBaseTypeField(str, Enum):
+ SHIELD_INFORMATION_BARRIER = 'shield_information_barrier'
+
+
+class ShieldInformationBarrierBase(BaseObject):
+ _discriminator = 'type', {'shield_information_barrier'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[ShieldInformationBarrierBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for the shield information barrier., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier., defaults to None
+ :type type: Optional[ShieldInformationBarrierBaseTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/shield_information_barrier_reference.py b/box_sdk_gen/schemas/shield_information_barrier_reference.py
new file mode 100644
index 000000000..c2f4debff
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_reference.py
@@ -0,0 +1,20 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier_base import (
+ ShieldInformationBarrierBase,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierReference(BaseObject):
+ def __init__(
+ self,
+ *,
+ shield_information_barrier: Optional[ShieldInformationBarrierBase] = None,
+ **kwargs
+ ):
+ super().__init__(**kwargs)
+ self.shield_information_barrier = shield_information_barrier
diff --git a/box_sdk_gen/schemas/shield_information_barrier_report.py b/box_sdk_gen/schemas/shield_information_barrier_report.py
new file mode 100644
index 000000000..4701838e4
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_report.py
@@ -0,0 +1,69 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.schemas.shield_information_barrier_report_base import (
+ ShieldInformationBarrierReportBaseTypeField,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_report_base import (
+ ShieldInformationBarrierReportBase,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_reference import (
+ ShieldInformationBarrierReference,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_report_details import (
+ ShieldInformationBarrierReportDetails,
+)
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class ShieldInformationBarrierReportStatusField(str, Enum):
+ PENDING = 'pending'
+ ERROR = 'error'
+ DONE = 'done'
+ CANCELLED = 'cancelled'
+
+
+class ShieldInformationBarrierReport(ShieldInformationBarrierReportBase):
+ def __init__(
+ self,
+ *,
+ shield_information_barrier: Optional[ShieldInformationBarrierReference] = None,
+ status: Optional[ShieldInformationBarrierReportStatusField] = None,
+ details: Optional[ShieldInformationBarrierReportDetails] = None,
+ created_at: Optional[DateTime] = None,
+ created_by: Optional[UserBase] = None,
+ updated_at: Optional[DateTime] = None,
+ id: Optional[str] = None,
+ type: Optional[ShieldInformationBarrierReportBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param status: Status of the shield information report., defaults to None
+ :type status: Optional[ShieldInformationBarrierReportStatusField], optional
+ :param created_at: ISO date time string when this
+ shield information barrier report object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param updated_at: ISO date time string when this
+ shield information barrier report was updated., defaults to None
+ :type updated_at: Optional[DateTime], optional
+ :param id: The unique identifier for the shield information barrier report., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier report., defaults to None
+ :type type: Optional[ShieldInformationBarrierReportBaseTypeField], optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.shield_information_barrier = shield_information_barrier
+ self.status = status
+ self.details = details
+ self.created_at = created_at
+ self.created_by = created_by
+ self.updated_at = updated_at
diff --git a/box_sdk_gen/schemas/shield_information_barrier_report_base.py b/box_sdk_gen/schemas/shield_information_barrier_report_base.py
new file mode 100644
index 000000000..d23f05aad
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_report_base.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierReportBaseTypeField(str, Enum):
+ SHIELD_INFORMATION_BARRIER_REPORT = 'shield_information_barrier_report'
+
+
+class ShieldInformationBarrierReportBase(BaseObject):
+ _discriminator = 'type', {'shield_information_barrier_report'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[ShieldInformationBarrierReportBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for the shield information barrier report., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier report., defaults to None
+ :type type: Optional[ShieldInformationBarrierReportBaseTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/shield_information_barrier_report_details.py b/box_sdk_gen/schemas/shield_information_barrier_report_details.py
new file mode 100644
index 000000000..e26e8e7cf
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_report_details.py
@@ -0,0 +1,26 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierReportDetailsDetailsField(BaseObject):
+ def __init__(self, *, folder_id: Optional[str] = None, **kwargs):
+ """
+ :param folder_id: Folder ID for locating this report., defaults to None
+ :type folder_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.folder_id = folder_id
+
+
+class ShieldInformationBarrierReportDetails(BaseObject):
+ def __init__(
+ self,
+ *,
+ details: Optional[ShieldInformationBarrierReportDetailsDetailsField] = None,
+ **kwargs
+ ):
+ super().__init__(**kwargs)
+ self.details = details
diff --git a/box_sdk_gen/schemas/shield_information_barrier_reports.py b/box_sdk_gen/schemas/shield_information_barrier_reports.py
new file mode 100644
index 000000000..76c81ab9a
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_reports.py
@@ -0,0 +1,37 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier_report import (
+ ShieldInformationBarrierReport,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierReports(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ entries: Optional[List[ShieldInformationBarrierReport]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param entries: A list of shield information
+ barrier reports., defaults to None
+ :type entries: Optional[List[ShieldInformationBarrierReport]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment.py b/box_sdk_gen/schemas/shield_information_barrier_segment.py
new file mode 100644
index 000000000..9bd253a10
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment.py
@@ -0,0 +1,64 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier_base import (
+ ShieldInformationBarrierBase,
+)
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class ShieldInformationBarrierSegmentTypeField(str, Enum):
+ SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment'
+
+
+class ShieldInformationBarrierSegment(BaseObject):
+ _discriminator = 'type', {'shield_information_barrier_segment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[ShieldInformationBarrierSegmentTypeField] = None,
+ shield_information_barrier: Optional[ShieldInformationBarrierBase] = None,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ created_by: Optional[UserBase] = None,
+ updated_at: Optional[DateTime] = None,
+ updated_by: Optional[UserBase] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for the shield information barrier segment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier segment., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentTypeField], optional
+ :param name: Name of the shield information barrier segment., defaults to None
+ :type name: Optional[str], optional
+ :param description: Description of the shield information barrier segment., defaults to None
+ :type description: Optional[str], optional
+ :param created_at: ISO date time string when this shield information
+ barrier object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param updated_at: ISO date time string when this
+ shield information barrier segment was updated., defaults to None
+ :type updated_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.shield_information_barrier = shield_information_barrier
+ self.name = name
+ self.description = description
+ self.created_at = created_at
+ self.created_by = created_by
+ self.updated_at = updated_at
+ self.updated_by = updated_by
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_member.py b/box_sdk_gen/schemas/shield_information_barrier_segment_member.py
new file mode 100644
index 000000000..0a037bc8c
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment_member.py
@@ -0,0 +1,101 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member_base import (
+ ShieldInformationBarrierSegmentMemberBaseTypeField,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member_base import (
+ ShieldInformationBarrierSegmentMemberBase,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member_mini import (
+ ShieldInformationBarrierSegmentMemberMini,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_base import (
+ ShieldInformationBarrierBase,
+)
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField(
+ str, Enum
+):
+ SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment'
+
+
+class ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField(
+ BaseObject
+):
+ _discriminator = 'type', {'shield_information_barrier_segment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[
+ ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID reference of the requesting
+ shield information barrier segment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier segment., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class ShieldInformationBarrierSegmentMember(ShieldInformationBarrierSegmentMemberMini):
+ def __init__(
+ self,
+ *,
+ shield_information_barrier: Optional[ShieldInformationBarrierBase] = None,
+ shield_information_barrier_segment: Optional[
+ ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField
+ ] = None,
+ created_at: Optional[DateTime] = None,
+ created_by: Optional[UserBase] = None,
+ updated_at: Optional[DateTime] = None,
+ updated_by: Optional[UserBase] = None,
+ user: Optional[UserBase] = None,
+ id: Optional[str] = None,
+ type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param shield_information_barrier_segment: The `type` and `id` of the requested
+ shield information barrier segment., defaults to None
+ :type shield_information_barrier_segment: Optional[ShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentField], optional
+ :param created_at: ISO date time string when this shield
+ information barrier object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param updated_at: ISO date time string when this
+ shield information barrier segment Member was updated., defaults to None
+ :type updated_at: Optional[DateTime], optional
+ :param id: The unique identifier for the
+ shield information barrier segment member., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier segment member., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField], optional
+ """
+ super().__init__(user=user, id=id, type=type, **kwargs)
+ self.shield_information_barrier = shield_information_barrier
+ self.shield_information_barrier_segment = shield_information_barrier_segment
+ self.created_at = created_at
+ self.created_by = created_by
+ self.updated_at = updated_at
+ self.updated_by = updated_by
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_member_base.py b/box_sdk_gen/schemas/shield_information_barrier_segment_member_base.py
new file mode 100644
index 000000000..28c9158a2
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment_member_base.py
@@ -0,0 +1,35 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierSegmentMemberBaseTypeField(str, Enum):
+ SHIELD_INFORMATION_BARRIER_SEGMENT_MEMBER = (
+ 'shield_information_barrier_segment_member'
+ )
+
+
+class ShieldInformationBarrierSegmentMemberBase(BaseObject):
+ _discriminator = 'type', {'shield_information_barrier_segment_member'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for the
+ shield information barrier segment member., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier segment member., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_member_mini.py b/box_sdk_gen/schemas/shield_information_barrier_segment_member_mini.py
new file mode 100644
index 000000000..ef416af8a
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment_member_mini.py
@@ -0,0 +1,35 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member_base import (
+ ShieldInformationBarrierSegmentMemberBaseTypeField,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member_base import (
+ ShieldInformationBarrierSegmentMemberBase,
+)
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierSegmentMemberMini(
+ ShieldInformationBarrierSegmentMemberBase
+):
+ def __init__(
+ self,
+ *,
+ user: Optional[UserBase] = None,
+ id: Optional[str] = None,
+ type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for the
+ shield information barrier segment member., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier segment member., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentMemberBaseTypeField], optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.user = user
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_members.py b/box_sdk_gen/schemas/shield_information_barrier_segment_members.py
new file mode 100644
index 000000000..86cd4dca0
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment_members.py
@@ -0,0 +1,37 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_member import (
+ ShieldInformationBarrierSegmentMember,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierSegmentMembers(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ entries: Optional[List[ShieldInformationBarrierSegmentMember]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param entries: A list of shield information
+ barrier segment members., defaults to None
+ :type entries: Optional[List[ShieldInformationBarrierSegmentMember]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_restriction.py b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction.py
new file mode 100644
index 000000000..2715bcb33
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction.py
@@ -0,0 +1,83 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_base import (
+ ShieldInformationBarrierSegmentRestrictionBaseTypeField,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_base import (
+ ShieldInformationBarrierSegmentRestrictionBase,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_mini import (
+ ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_mini import (
+ ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_mini import (
+ ShieldInformationBarrierSegmentRestrictionMini,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_base import (
+ ShieldInformationBarrierBase,
+)
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class ShieldInformationBarrierSegmentRestriction(
+ ShieldInformationBarrierSegmentRestrictionMini
+):
+ def __init__(
+ self,
+ shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField,
+ restricted_segment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField,
+ *,
+ shield_information_barrier: Optional[ShieldInformationBarrierBase] = None,
+ created_at: Optional[DateTime] = None,
+ created_by: Optional[UserBase] = None,
+ updated_at: Optional[DateTime] = None,
+ updated_by: Optional[UserBase] = None,
+ type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param shield_information_barrier_segment: The `type` and `id` of the
+ requested shield information barrier segment.
+ :type shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField
+ :param restricted_segment: The `type` and `id` of the
+ restricted shield information barrier segment.
+ :type restricted_segment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField
+ :param created_at: ISO date time string when this
+ shield information barrier
+ Segment Restriction object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param updated_at: ISO date time string when this
+ shield information barrier segment
+ Restriction was updated., defaults to None
+ :type updated_at: Optional[DateTime], optional
+ :param type: Shield information barrier segment restriction., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField], optional
+ :param id: The unique identifier for the
+ shield information barrier segment restriction., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(
+ shield_information_barrier_segment=shield_information_barrier_segment,
+ restricted_segment=restricted_segment,
+ type=type,
+ id=id,
+ **kwargs
+ )
+ self.shield_information_barrier = shield_information_barrier
+ self.created_at = created_at
+ self.created_by = created_by
+ self.updated_at = updated_at
+ self.updated_by = updated_by
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_base.py b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_base.py
new file mode 100644
index 000000000..49dbccf56
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_base.py
@@ -0,0 +1,35 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierSegmentRestrictionBaseTypeField(str, Enum):
+ SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION = (
+ 'shield_information_barrier_segment_restriction'
+ )
+
+
+class ShieldInformationBarrierSegmentRestrictionBase(BaseObject):
+ _discriminator = 'type', {'shield_information_barrier_segment_restriction'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: Shield information barrier segment restriction., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField], optional
+ :param id: The unique identifier for the
+ shield information barrier segment restriction., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_mini.py b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_mini.py
new file mode 100644
index 000000000..a84864fe2
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment_restriction_mini.py
@@ -0,0 +1,107 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_base import (
+ ShieldInformationBarrierSegmentRestrictionBaseTypeField,
+)
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction_base import (
+ ShieldInformationBarrierSegmentRestrictionBase,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentTypeField(
+ str, Enum
+):
+ SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment'
+
+
+class ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField(
+ BaseObject
+):
+ _discriminator = 'type', {'shield_information_barrier_segment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[
+ ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentTypeField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID reference of the
+ requesting shield information barrier segment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information barrier segment., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField(
+ str, Enum
+):
+ SHIELD_INFORMATION_BARRIER_SEGMENT = 'shield_information_barrier_segment'
+
+
+class ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField(BaseObject):
+ _discriminator = 'type', {'shield_information_barrier_segment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[
+ ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID reference of the
+ restricted shield information barrier segment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of the shield information segment., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class ShieldInformationBarrierSegmentRestrictionMini(
+ ShieldInformationBarrierSegmentRestrictionBase
+):
+ def __init__(
+ self,
+ shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField,
+ restricted_segment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField,
+ *,
+ type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param shield_information_barrier_segment: The `type` and `id` of the
+ requested shield information barrier segment.
+ :type shield_information_barrier_segment: ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField
+ :param restricted_segment: The `type` and `id` of the
+ restricted shield information barrier segment.
+ :type restricted_segment: ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField
+ :param type: Shield information barrier segment restriction., defaults to None
+ :type type: Optional[ShieldInformationBarrierSegmentRestrictionBaseTypeField], optional
+ :param id: The unique identifier for the
+ shield information barrier segment restriction., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(type=type, id=id, **kwargs)
+ self.shield_information_barrier_segment = shield_information_barrier_segment
+ self.restricted_segment = restricted_segment
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segment_restrictions.py b/box_sdk_gen/schemas/shield_information_barrier_segment_restrictions.py
new file mode 100644
index 000000000..7f8e625c7
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segment_restrictions.py
@@ -0,0 +1,37 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier_segment_restriction import (
+ ShieldInformationBarrierSegmentRestriction,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierSegmentRestrictions(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ entries: Optional[List[ShieldInformationBarrierSegmentRestriction]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param entries: A list of shield information barrier
+ segment restriction objects., defaults to None
+ :type entries: Optional[List[ShieldInformationBarrierSegmentRestriction]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/shield_information_barrier_segments.py b/box_sdk_gen/schemas/shield_information_barrier_segments.py
new file mode 100644
index 000000000..8a4ab20d6
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barrier_segments.py
@@ -0,0 +1,37 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier_segment import (
+ ShieldInformationBarrierSegment,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarrierSegments(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ entries: Optional[List[ShieldInformationBarrierSegment]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param entries: A list of shield information barrier
+ segments., defaults to None
+ :type entries: Optional[List[ShieldInformationBarrierSegment]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/shield_information_barriers.py b/box_sdk_gen/schemas/shield_information_barriers.py
new file mode 100644
index 000000000..475d83d5b
--- /dev/null
+++ b/box_sdk_gen/schemas/shield_information_barriers.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.shield_information_barrier import ShieldInformationBarrier
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldInformationBarriers(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ entries: Optional[List[ShieldInformationBarrier]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param entries: A list of shield information barrier objects., defaults to None
+ :type entries: Optional[List[ShieldInformationBarrier]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/sign_request.py b/box_sdk_gen/schemas/sign_request.py
new file mode 100644
index 000000000..16d904d1c
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_request.py
@@ -0,0 +1,187 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.sign_request_prefill_tag import SignRequestPrefillTag
+
+from box_sdk_gen.schemas.sign_request_base import SignRequestBase
+
+from box_sdk_gen.schemas.file_base import FileBase
+
+from box_sdk_gen.schemas.sign_request_signer import SignRequestSigner
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class SignRequestTypeField(str, Enum):
+ SIGN_REQUEST = 'sign-request'
+
+
+class SignRequestStatusField(str, Enum):
+ CONVERTING = 'converting'
+ CREATED = 'created'
+ SENT = 'sent'
+ VIEWED = 'viewed'
+ SIGNED = 'signed'
+ CANCELLED = 'cancelled'
+ DECLINED = 'declined'
+ ERROR_CONVERTING = 'error_converting'
+ ERROR_SENDING = 'error_sending'
+ EXPIRED = 'expired'
+ FINALIZING = 'finalizing'
+ ERROR_FINALIZING = 'error_finalizing'
+
+
+class SignRequestSignFilesField(BaseObject):
+ def __init__(
+ self,
+ *,
+ files: Optional[List[FileMini]] = None,
+ is_ready_for_download: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param is_ready_for_download: Indicates whether the `sign_files` documents are processing
+ and the PDFs may be out of date. A change to any document
+ requires processing on all `sign_files`. We
+ recommended waiting until processing is finished
+ (and this value is true) before downloading the PDFs., defaults to None
+ :type is_ready_for_download: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.files = files
+ self.is_ready_for_download = is_ready_for_download
+
+
+class SignRequest(SignRequestBase):
+ def __init__(
+ self,
+ *,
+ type: Optional[SignRequestTypeField] = None,
+ source_files: Optional[List[FileBase]] = None,
+ signers: Optional[List[SignRequestSigner]] = None,
+ signature_color: Optional[str] = None,
+ id: Optional[str] = None,
+ prepare_url: Optional[str] = None,
+ signing_log: Optional[FileMini] = None,
+ status: Optional[SignRequestStatusField] = None,
+ sign_files: Optional[SignRequestSignFilesField] = None,
+ auto_expire_at: Optional[DateTime] = None,
+ parent_folder: Optional[FolderMini] = None,
+ collaborator_level: Optional[str] = None,
+ sender_email: Optional[str] = None,
+ sender_id: Optional[int] = None,
+ is_document_preparation_needed: Optional[bool] = None,
+ redirect_url: Optional[str] = None,
+ declined_redirect_url: Optional[str] = None,
+ are_text_signatures_enabled: Optional[bool] = None,
+ email_subject: Optional[str] = None,
+ email_message: Optional[str] = None,
+ are_reminders_enabled: Optional[bool] = None,
+ name: Optional[str] = None,
+ prefill_tags: Optional[List[SignRequestPrefillTag]] = None,
+ days_valid: Optional[int] = None,
+ external_id: Optional[str] = None,
+ template_id: Optional[str] = None,
+ external_system_name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `sign-request`., defaults to None
+ :type type: Optional[SignRequestTypeField], optional
+ :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., defaults to None
+ :type source_files: Optional[List[FileBase]], optional
+ :param signers: Array of signers for the signature request., defaults to None
+ :type signers: Optional[List[SignRequestSigner]], optional
+ :param signature_color: Force a specific color for the signature (blue, black, or red)., defaults to None
+ :type signature_color: Optional[str], optional
+ :param id: Box Sign request ID., defaults to None
+ :type id: Optional[str], optional
+ :param prepare_url: This URL is returned if `is_document_preparation_needed` is
+ set to `true` in the request. The parameter is used to prepare
+ the signature request
+ using the UI. The signature request is not
+ sent until the preparation
+ phase is complete., defaults to None
+ :type prepare_url: Optional[str], optional
+ :param status: Describes the status of the signature request., defaults to None
+ :type status: Optional[SignRequestStatusField], optional
+ :param sign_files: List of files that will be signed, which are copies of the original
+ source files. A new version of these files are created as signers sign
+ and can be downloaded at any point in the signing process., defaults to None
+ :type sign_files: Optional[SignRequestSignFilesField], optional
+ :param auto_expire_at: Uses `days_valid` to calculate the date and time, in GMT, the sign request will expire if unsigned., defaults to None
+ :type auto_expire_at: Optional[DateTime], optional
+ :param collaborator_level: The collaborator level of the user to the sign request. Values can include "owner", "editor", and "viewer"., defaults to None
+ :type collaborator_level: Optional[str], optional
+ :param sender_email: The email address of the sender of the sign request., defaults to None
+ :type sender_email: Optional[str], optional
+ :param sender_id: The user ID of the sender of the sign request., defaults to None
+ :type sender_id: Optional[int], optional
+ :param is_document_preparation_needed: Indicates if the sender should receive a `prepare_url` in the response to complete document preparation using the UI., defaults to None
+ :type is_document_preparation_needed: Optional[bool], optional
+ :param redirect_url: When specified, the signature request will be redirected to this url when a document is signed., defaults to None
+ :type redirect_url: Optional[str], optional
+ :param declined_redirect_url: The uri that a signer will be redirected to after declining to sign a document., defaults to None
+ :type declined_redirect_url: Optional[str], optional
+ :param are_text_signatures_enabled: Disables the usage of signatures generated by typing (text)., defaults to None
+ :type are_text_signatures_enabled: Optional[bool], optional
+ :param email_subject: Subject of sign request email. This is cleaned by sign request. If this field is not passed, a default subject will be used., defaults to None
+ :type email_subject: Optional[str], optional
+ :param email_message: Message to include in sign request email. The field is cleaned through sanitization of specific characters. However, some html tags are allowed. Links included in the message are also converted to hyperlinks in the email. The message may contain the following html tags including `a`, `abbr`, `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and `strong`. Be aware that when the text to html ratio is too high, the email may end up in spam filters. Custom styles on these tags are not allowed. If this field is not passed, a default message will be used., defaults to None
+ :type email_message: Optional[str], optional
+ :param are_reminders_enabled: Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to outstanding signers., defaults to None
+ :type are_reminders_enabled: Optional[bool], optional
+ :param name: Name of the signature request., defaults to None
+ :type name: Optional[str], optional
+ :param prefill_tags: When a document contains sign-related tags in the content, you can prefill them using this `prefill_tags` by referencing the 'id' of the tag as the `external_id` field of the prefill tag., defaults to None
+ :type prefill_tags: Optional[List[SignRequestPrefillTag]], optional
+ :param days_valid: Set the number of days after which the created signature request will automatically expire if not completed. By default, we do not apply any expiration date on signature requests, and the signature request does not expire., defaults to None
+ :type days_valid: Optional[int], optional
+ :param external_id: This can be used to reference an ID in an external system that the sign request is related to., defaults to None
+ :type external_id: Optional[str], optional
+ :param template_id: When a signature request is created from a template this field will indicate the id of that template., defaults to None
+ :type template_id: Optional[str], optional
+ :param external_system_name: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`., defaults to None
+ :type external_system_name: Optional[str], optional
+ """
+ super().__init__(
+ is_document_preparation_needed=is_document_preparation_needed,
+ redirect_url=redirect_url,
+ declined_redirect_url=declined_redirect_url,
+ are_text_signatures_enabled=are_text_signatures_enabled,
+ email_subject=email_subject,
+ email_message=email_message,
+ are_reminders_enabled=are_reminders_enabled,
+ name=name,
+ prefill_tags=prefill_tags,
+ days_valid=days_valid,
+ external_id=external_id,
+ template_id=template_id,
+ external_system_name=external_system_name,
+ **kwargs
+ )
+ self.type = type
+ self.source_files = source_files
+ self.signers = signers
+ self.signature_color = signature_color
+ self.id = id
+ self.prepare_url = prepare_url
+ self.signing_log = signing_log
+ self.status = status
+ self.sign_files = sign_files
+ self.auto_expire_at = auto_expire_at
+ self.parent_folder = parent_folder
+ self.collaborator_level = collaborator_level
+ self.sender_email = sender_email
+ self.sender_id = sender_id
diff --git a/box_sdk_gen/schemas/sign_request_base.py b/box_sdk_gen/schemas/sign_request_base.py
new file mode 100644
index 000000000..181c97249
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_request_base.py
@@ -0,0 +1,72 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.sign_request_prefill_tag import SignRequestPrefillTag
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SignRequestBase(BaseObject):
+ def __init__(
+ self,
+ *,
+ is_document_preparation_needed: Optional[bool] = None,
+ redirect_url: Optional[str] = None,
+ declined_redirect_url: Optional[str] = None,
+ are_text_signatures_enabled: Optional[bool] = None,
+ email_subject: Optional[str] = None,
+ email_message: Optional[str] = None,
+ are_reminders_enabled: Optional[bool] = None,
+ name: Optional[str] = None,
+ prefill_tags: Optional[List[SignRequestPrefillTag]] = None,
+ days_valid: Optional[int] = None,
+ external_id: Optional[str] = None,
+ template_id: Optional[str] = None,
+ external_system_name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param is_document_preparation_needed: Indicates if the sender should receive a `prepare_url` in the response to complete document preparation using the UI., defaults to None
+ :type is_document_preparation_needed: Optional[bool], optional
+ :param redirect_url: When specified, the signature request will be redirected to this url when a document is signed., defaults to None
+ :type redirect_url: Optional[str], optional
+ :param declined_redirect_url: The uri that a signer will be redirected to after declining to sign a document., defaults to None
+ :type declined_redirect_url: Optional[str], optional
+ :param are_text_signatures_enabled: Disables the usage of signatures generated by typing (text)., defaults to None
+ :type are_text_signatures_enabled: Optional[bool], optional
+ :param email_subject: Subject of sign request email. This is cleaned by sign request. If this field is not passed, a default subject will be used., defaults to None
+ :type email_subject: Optional[str], optional
+ :param email_message: Message to include in sign request email. The field is cleaned through sanitization of specific characters. However, some html tags are allowed. Links included in the message are also converted to hyperlinks in the email. The message may contain the following html tags including `a`, `abbr`, `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and `strong`. Be aware that when the text to html ratio is too high, the email may end up in spam filters. Custom styles on these tags are not allowed. If this field is not passed, a default message will be used., defaults to None
+ :type email_message: Optional[str], optional
+ :param are_reminders_enabled: Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to outstanding signers., defaults to None
+ :type are_reminders_enabled: Optional[bool], optional
+ :param name: Name of the signature request., defaults to None
+ :type name: Optional[str], optional
+ :param prefill_tags: When a document contains sign-related tags in the content, you can prefill them using this `prefill_tags` by referencing the 'id' of the tag as the `external_id` field of the prefill tag., defaults to None
+ :type prefill_tags: Optional[List[SignRequestPrefillTag]], optional
+ :param days_valid: Set the number of days after which the created signature request will automatically expire if not completed. By default, we do not apply any expiration date on signature requests, and the signature request does not expire., defaults to None
+ :type days_valid: Optional[int], optional
+ :param external_id: This can be used to reference an ID in an external system that the sign request is related to., defaults to None
+ :type external_id: Optional[str], optional
+ :param template_id: When a signature request is created from a template this field will indicate the id of that template., defaults to None
+ :type template_id: Optional[str], optional
+ :param external_system_name: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`., defaults to None
+ :type external_system_name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.is_document_preparation_needed = is_document_preparation_needed
+ self.redirect_url = redirect_url
+ self.declined_redirect_url = declined_redirect_url
+ self.are_text_signatures_enabled = are_text_signatures_enabled
+ self.email_subject = email_subject
+ self.email_message = email_message
+ self.are_reminders_enabled = are_reminders_enabled
+ self.name = name
+ self.prefill_tags = prefill_tags
+ self.days_valid = days_valid
+ self.external_id = external_id
+ self.template_id = template_id
+ self.external_system_name = external_system_name
diff --git a/box_sdk_gen/schemas/sign_request_create_request.py b/box_sdk_gen/schemas/sign_request_create_request.py
new file mode 100644
index 000000000..8d18ce00b
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_request_create_request.py
@@ -0,0 +1,109 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.sign_request_prefill_tag import SignRequestPrefillTag
+
+from box_sdk_gen.schemas.sign_request_base import SignRequestBase
+
+from box_sdk_gen.schemas.file_base import FileBase
+
+from box_sdk_gen.schemas.sign_request_create_signer import SignRequestCreateSigner
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SignRequestCreateRequestSignatureColorField(str, Enum):
+ BLUE = 'blue'
+ BLACK = 'black'
+ RED = 'red'
+
+
+class SignRequestCreateRequest(SignRequestBase):
+ def __init__(
+ self,
+ signers: List[SignRequestCreateSigner],
+ *,
+ source_files: Optional[List[FileBase]] = None,
+ signature_color: Optional[SignRequestCreateRequestSignatureColorField] = None,
+ parent_folder: Optional[FolderMini] = None,
+ is_document_preparation_needed: Optional[bool] = None,
+ redirect_url: Optional[str] = None,
+ declined_redirect_url: Optional[str] = None,
+ are_text_signatures_enabled: Optional[bool] = None,
+ email_subject: Optional[str] = None,
+ email_message: Optional[str] = None,
+ are_reminders_enabled: Optional[bool] = None,
+ name: Optional[str] = None,
+ prefill_tags: Optional[List[SignRequestPrefillTag]] = None,
+ days_valid: Optional[int] = None,
+ external_id: Optional[str] = None,
+ template_id: Optional[str] = None,
+ external_system_name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param signers: Array of signers for the signature request. 35 is the
+ max number of signers permitted.
+
+ **Note**: It may happen that some signers belong to conflicting [segments](r://shield-information-barrier-segment-member) (user groups).
+ This means that due to the security policies, users are assigned to segments to prevent exchanges or communication that could lead to ethical conflicts.
+ In such a case, an attempt to send the sign request will result in an error.
+
+ Read more about [segments and ethical walls](https://support.box.com/hc/en-us/articles/9920431507603-Understanding-Information-Barriers#h_01GFVJEHQA06N7XEZ4GCZ9GFAQ).
+ :type signers: List[SignRequestCreateSigner]
+ :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., defaults to None
+ :type source_files: Optional[List[FileBase]], optional
+ :param signature_color: Force a specific color for the signature (blue, black, or red)., defaults to None
+ :type signature_color: Optional[SignRequestCreateRequestSignatureColorField], optional
+ :param is_document_preparation_needed: Indicates if the sender should receive a `prepare_url` in the response to complete document preparation using the UI., defaults to None
+ :type is_document_preparation_needed: Optional[bool], optional
+ :param redirect_url: When specified, the signature request will be redirected to this url when a document is signed., defaults to None
+ :type redirect_url: Optional[str], optional
+ :param declined_redirect_url: The uri that a signer will be redirected to after declining to sign a document., defaults to None
+ :type declined_redirect_url: Optional[str], optional
+ :param are_text_signatures_enabled: Disables the usage of signatures generated by typing (text)., defaults to None
+ :type are_text_signatures_enabled: Optional[bool], optional
+ :param email_subject: Subject of sign request email. This is cleaned by sign request. If this field is not passed, a default subject will be used., defaults to None
+ :type email_subject: Optional[str], optional
+ :param email_message: Message to include in sign request email. The field is cleaned through sanitization of specific characters. However, some html tags are allowed. Links included in the message are also converted to hyperlinks in the email. The message may contain the following html tags including `a`, `abbr`, `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and `strong`. Be aware that when the text to html ratio is too high, the email may end up in spam filters. Custom styles on these tags are not allowed. If this field is not passed, a default message will be used., defaults to None
+ :type email_message: Optional[str], optional
+ :param are_reminders_enabled: Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to outstanding signers., defaults to None
+ :type are_reminders_enabled: Optional[bool], optional
+ :param name: Name of the signature request., defaults to None
+ :type name: Optional[str], optional
+ :param prefill_tags: When a document contains sign-related tags in the content, you can prefill them using this `prefill_tags` by referencing the 'id' of the tag as the `external_id` field of the prefill tag., defaults to None
+ :type prefill_tags: Optional[List[SignRequestPrefillTag]], optional
+ :param days_valid: Set the number of days after which the created signature request will automatically expire if not completed. By default, we do not apply any expiration date on signature requests, and the signature request does not expire., defaults to None
+ :type days_valid: Optional[int], optional
+ :param external_id: This can be used to reference an ID in an external system that the sign request is related to., defaults to None
+ :type external_id: Optional[str], optional
+ :param template_id: When a signature request is created from a template this field will indicate the id of that template., defaults to None
+ :type template_id: Optional[str], optional
+ :param external_system_name: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`., defaults to None
+ :type external_system_name: Optional[str], optional
+ """
+ super().__init__(
+ is_document_preparation_needed=is_document_preparation_needed,
+ redirect_url=redirect_url,
+ declined_redirect_url=declined_redirect_url,
+ are_text_signatures_enabled=are_text_signatures_enabled,
+ email_subject=email_subject,
+ email_message=email_message,
+ are_reminders_enabled=are_reminders_enabled,
+ name=name,
+ prefill_tags=prefill_tags,
+ days_valid=days_valid,
+ external_id=external_id,
+ template_id=template_id,
+ external_system_name=external_system_name,
+ **kwargs
+ )
+ self.signers = signers
+ self.source_files = source_files
+ self.signature_color = signature_color
+ self.parent_folder = parent_folder
diff --git a/box_sdk_gen/schemas/sign_request_create_signer.py b/box_sdk_gen/schemas/sign_request_create_signer.py
new file mode 100644
index 000000000..ed62e5cb1
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_request_create_signer.py
@@ -0,0 +1,98 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SignRequestCreateSignerRoleField(str, Enum):
+ SIGNER = 'signer'
+ APPROVER = 'approver'
+ FINAL_COPY_READER = 'final_copy_reader'
+
+
+class SignRequestCreateSigner(BaseObject):
+ def __init__(
+ self,
+ *,
+ email: Optional[str] = None,
+ role: Optional[SignRequestCreateSignerRoleField] = None,
+ is_in_person: Optional[bool] = None,
+ order: Optional[int] = None,
+ embed_url_external_user_id: Optional[str] = None,
+ redirect_url: Optional[str] = None,
+ declined_redirect_url: Optional[str] = None,
+ login_required: Optional[bool] = None,
+ verification_phone_number: Optional[str] = None,
+ password: Optional[str] = None,
+ signer_group_id: Optional[str] = None,
+ suppress_notifications: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param email: Email address of the signer.
+ The email address of the signer is required when making signature requests, except when using templates that are configured to include emails., defaults to None
+ :type email: Optional[str], optional
+ :param role: Defines the role of the signer in the signature request. A `signer`
+ must sign the document and an `approver` must approve the document. A
+ `final_copy_reader` only receives the final signed document and signing
+ log., defaults to None
+ :type role: Optional[SignRequestCreateSignerRoleField], optional
+ :param is_in_person: Used in combination with an embed URL for a sender. After the
+ sender signs, they are redirected to the next `in_person` signer., defaults to None
+ :type is_in_person: Optional[bool], optional
+ :param order: Order of the signer., defaults to None
+ :type order: Optional[int], optional
+ :param embed_url_external_user_id: User ID for the signer in an external application responsible
+ for authentication when accessing the embed URL., defaults to None
+ :type embed_url_external_user_id: Optional[str], optional
+ :param redirect_url: The URL that a signer will be redirected
+ to after signing a document. Defining this URL
+ overrides default or global redirect URL
+ settings for a specific signer.
+ If no declined redirect URL is specified,
+ this URL will be used for decline actions as well., defaults to None
+ :type redirect_url: Optional[str], optional
+ :param declined_redirect_url: The URL that a signer will be redirect
+ to after declining to sign a document.
+ Defining this URL overrides default or global
+ declined redirect URL settings for a specific signer., defaults to None
+ :type declined_redirect_url: Optional[str], optional
+ :param login_required: If set to true, the signer will need to log in to a Box account
+ before signing the request. If the signer does not have
+ an existing account, they will have the option to create
+ a free Box account., defaults to None
+ :type login_required: Optional[bool], optional
+ :param verification_phone_number: If set, this phone number will be used to verify the signer
+ via two-factor authentication before they are able to sign the document.
+ Cannot be selected in combination with `login_required`., defaults to None
+ :type verification_phone_number: Optional[str], optional
+ :param password: If set, the signer is required to enter the password before they are able
+ to sign a document. This field is write only., defaults to None
+ :type password: Optional[str], optional
+ :param signer_group_id: If set, signers who have the same value will be assigned to the same input and to the same signer group.
+ A signer group is not a Box Group. It is an entity that belongs to a Sign Request and can only be
+ used/accessed within this Sign Request. A signer group is expected to have more than one signer.
+ If the provided value is only used for one signer, this value will be ignored and request will be handled
+ as it was intended for an individual signer. The value provided can be any string and only used to
+ determine which signers belongs to same group. A successful response will provide a generated UUID value
+ instead for signers in the same signer group., defaults to None
+ :type signer_group_id: Optional[str], optional
+ :param suppress_notifications: If true, no emails about the sign request will be sent., defaults to None
+ :type suppress_notifications: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.email = email
+ self.role = role
+ self.is_in_person = is_in_person
+ self.order = order
+ self.embed_url_external_user_id = embed_url_external_user_id
+ self.redirect_url = redirect_url
+ self.declined_redirect_url = declined_redirect_url
+ self.login_required = login_required
+ self.verification_phone_number = verification_phone_number
+ self.password = password
+ self.signer_group_id = signer_group_id
+ self.suppress_notifications = suppress_notifications
diff --git a/box_sdk_gen/schemas/sign_request_prefill_tag.py b/box_sdk_gen/schemas/sign_request_prefill_tag.py
new file mode 100644
index 000000000..88eb1a90c
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_request_prefill_tag.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import Date
+
+
+class SignRequestPrefillTag(BaseObject):
+ def __init__(
+ self,
+ *,
+ document_tag_id: Optional[str] = None,
+ text_value: Optional[str] = None,
+ checkbox_value: Optional[bool] = None,
+ date_value: Optional[Date] = None,
+ **kwargs
+ ):
+ """
+ :param document_tag_id: This references the ID of a specific tag contained in a file of the signature request., defaults to None
+ :type document_tag_id: Optional[str], optional
+ :param text_value: Text prefill value., defaults to None
+ :type text_value: Optional[str], optional
+ :param checkbox_value: Checkbox prefill value., defaults to None
+ :type checkbox_value: Optional[bool], optional
+ :param date_value: Date prefill value., defaults to None
+ :type date_value: Optional[Date], optional
+ """
+ super().__init__(**kwargs)
+ self.document_tag_id = document_tag_id
+ self.text_value = text_value
+ self.checkbox_value = checkbox_value
+ self.date_value = date_value
diff --git a/box_sdk_gen/schemas/sign_request_signer.py b/box_sdk_gen/schemas/sign_request_signer.py
new file mode 100644
index 000000000..e9575f17e
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_request_signer.py
@@ -0,0 +1,159 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.sign_request_create_signer import (
+ SignRequestCreateSignerRoleField,
+)
+
+from box_sdk_gen.schemas.sign_request_create_signer import SignRequestCreateSigner
+
+from box_sdk_gen.schemas.sign_request_signer_input import SignRequestSignerInput
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class SignRequestSignerSignerDecisionTypeField(str, Enum):
+ SIGNED = 'signed'
+ DECLINED = 'declined'
+
+
+class SignRequestSignerSignerDecisionField(BaseObject):
+ _discriminator = 'type', {'signed', 'declined'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[SignRequestSignerSignerDecisionTypeField] = None,
+ finalized_at: Optional[DateTime] = None,
+ additional_info: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: Type of decision made by the signer., defaults to None
+ :type type: Optional[SignRequestSignerSignerDecisionTypeField], optional
+ :param finalized_at: Date and Time that the decision was made., defaults to None
+ :type finalized_at: Optional[DateTime], optional
+ :param additional_info: Additional info about the decision, such as the decline reason from the signer., defaults to None
+ :type additional_info: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.finalized_at = finalized_at
+ self.additional_info = additional_info
+
+
+class SignRequestSigner(SignRequestCreateSigner):
+ def __init__(
+ self,
+ *,
+ has_viewed_document: Optional[bool] = None,
+ signer_decision: Optional[SignRequestSignerSignerDecisionField] = None,
+ inputs: Optional[List[SignRequestSignerInput]] = None,
+ embed_url: Optional[str] = None,
+ iframeable_embed_url: Optional[str] = None,
+ email: Optional[str] = None,
+ role: Optional[SignRequestCreateSignerRoleField] = None,
+ is_in_person: Optional[bool] = None,
+ order: Optional[int] = None,
+ embed_url_external_user_id: Optional[str] = None,
+ redirect_url: Optional[str] = None,
+ declined_redirect_url: Optional[str] = None,
+ login_required: Optional[bool] = None,
+ verification_phone_number: Optional[str] = None,
+ password: Optional[str] = None,
+ signer_group_id: Optional[str] = None,
+ suppress_notifications: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param has_viewed_document: Set to `true` if the signer views the document., defaults to None
+ :type has_viewed_document: Optional[bool], optional
+ :param signer_decision: Final decision made by the signer., defaults to None
+ :type signer_decision: Optional[SignRequestSignerSignerDecisionField], optional
+ :param embed_url: URL to direct a signer to for signing., defaults to None
+ :type embed_url: Optional[str], optional
+ :param iframeable_embed_url: This URL is specifically designed for
+ signing documents within an HTML `iframe` tag.
+ It will be returned in the response
+ only if the `embed_url_external_user_id`
+ parameter was passed in the
+ `create Box Sign request` call., defaults to None
+ :type iframeable_embed_url: Optional[str], optional
+ :param email: Email address of the signer.
+ The email address of the signer is required when making signature requests, except when using templates that are configured to include emails., defaults to None
+ :type email: Optional[str], optional
+ :param role: Defines the role of the signer in the signature request. A `signer`
+ must sign the document and an `approver` must approve the document. A
+ `final_copy_reader` only receives the final signed document and signing
+ log., defaults to None
+ :type role: Optional[SignRequestCreateSignerRoleField], optional
+ :param is_in_person: Used in combination with an embed URL for a sender. After the
+ sender signs, they are redirected to the next `in_person` signer., defaults to None
+ :type is_in_person: Optional[bool], optional
+ :param order: Order of the signer., defaults to None
+ :type order: Optional[int], optional
+ :param embed_url_external_user_id: User ID for the signer in an external application responsible
+ for authentication when accessing the embed URL., defaults to None
+ :type embed_url_external_user_id: Optional[str], optional
+ :param redirect_url: The URL that a signer will be redirected
+ to after signing a document. Defining this URL
+ overrides default or global redirect URL
+ settings for a specific signer.
+ If no declined redirect URL is specified,
+ this URL will be used for decline actions as well., defaults to None
+ :type redirect_url: Optional[str], optional
+ :param declined_redirect_url: The URL that a signer will be redirect
+ to after declining to sign a document.
+ Defining this URL overrides default or global
+ declined redirect URL settings for a specific signer., defaults to None
+ :type declined_redirect_url: Optional[str], optional
+ :param login_required: If set to true, the signer will need to log in to a Box account
+ before signing the request. If the signer does not have
+ an existing account, they will have the option to create
+ a free Box account., defaults to None
+ :type login_required: Optional[bool], optional
+ :param verification_phone_number: If set, this phone number will be used to verify the signer
+ via two-factor authentication before they are able to sign the document.
+ Cannot be selected in combination with `login_required`., defaults to None
+ :type verification_phone_number: Optional[str], optional
+ :param password: If set, the signer is required to enter the password before they are able
+ to sign a document. This field is write only., defaults to None
+ :type password: Optional[str], optional
+ :param signer_group_id: If set, signers who have the same value will be assigned to the same input and to the same signer group.
+ A signer group is not a Box Group. It is an entity that belongs to a Sign Request and can only be
+ used/accessed within this Sign Request. A signer group is expected to have more than one signer.
+ If the provided value is only used for one signer, this value will be ignored and request will be handled
+ as it was intended for an individual signer. The value provided can be any string and only used to
+ determine which signers belongs to same group. A successful response will provide a generated UUID value
+ instead for signers in the same signer group., defaults to None
+ :type signer_group_id: Optional[str], optional
+ :param suppress_notifications: If true, no emails about the sign request will be sent., defaults to None
+ :type suppress_notifications: Optional[bool], optional
+ """
+ super().__init__(
+ email=email,
+ role=role,
+ is_in_person=is_in_person,
+ order=order,
+ embed_url_external_user_id=embed_url_external_user_id,
+ redirect_url=redirect_url,
+ declined_redirect_url=declined_redirect_url,
+ login_required=login_required,
+ verification_phone_number=verification_phone_number,
+ password=password,
+ signer_group_id=signer_group_id,
+ suppress_notifications=suppress_notifications,
+ **kwargs
+ )
+ self.has_viewed_document = has_viewed_document
+ self.signer_decision = signer_decision
+ self.inputs = inputs
+ self.embed_url = embed_url
+ self.iframeable_embed_url = iframeable_embed_url
diff --git a/box_sdk_gen/schemas/sign_request_signer_input.py b/box_sdk_gen/schemas/sign_request_signer_input.py
new file mode 100644
index 000000000..20067e3f3
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_request_signer_input.py
@@ -0,0 +1,81 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.utils import Date
+
+from box_sdk_gen.schemas.sign_request_prefill_tag import SignRequestPrefillTag
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SignRequestSignerInputTypeField(str, Enum):
+ SIGNATURE = 'signature'
+ DATE = 'date'
+ TEXT = 'text'
+ CHECKBOX = 'checkbox'
+ RADIO = 'radio'
+ DROPDOWN = 'dropdown'
+
+
+class SignRequestSignerInputContentTypeField(str, Enum):
+ SIGNATURE = 'signature'
+ INITIAL = 'initial'
+ STAMP = 'stamp'
+ DATE = 'date'
+ CHECKBOX = 'checkbox'
+ TEXT = 'text'
+ FULL_NAME = 'full_name'
+ FIRST_NAME = 'first_name'
+ LAST_NAME = 'last_name'
+ COMPANY = 'company'
+ TITLE = 'title'
+ EMAIL = 'email'
+ ATTACHMENT = 'attachment'
+ RADIO = 'radio'
+ DROPDOWN = 'dropdown'
+
+
+class SignRequestSignerInput(SignRequestPrefillTag):
+ def __init__(
+ self,
+ page_index: int,
+ *,
+ type: Optional[SignRequestSignerInputTypeField] = None,
+ content_type: Optional[SignRequestSignerInputContentTypeField] = None,
+ read_only: Optional[bool] = None,
+ document_tag_id: Optional[str] = None,
+ text_value: Optional[str] = None,
+ checkbox_value: Optional[bool] = None,
+ date_value: Optional[Date] = None,
+ **kwargs
+ ):
+ """
+ :param page_index: Index of page that the input is on.
+ :type page_index: int
+ :param type: Type of input., defaults to None
+ :type type: Optional[SignRequestSignerInputTypeField], optional
+ :param content_type: Content type of input., defaults to None
+ :type content_type: Optional[SignRequestSignerInputContentTypeField], optional
+ :param read_only: Whether this input was defined as read-only(immutable by signers) or not., defaults to None
+ :type read_only: Optional[bool], optional
+ :param document_tag_id: This references the ID of a specific tag contained in a file of the signature request., defaults to None
+ :type document_tag_id: Optional[str], optional
+ :param text_value: Text prefill value., defaults to None
+ :type text_value: Optional[str], optional
+ :param checkbox_value: Checkbox prefill value., defaults to None
+ :type checkbox_value: Optional[bool], optional
+ :param date_value: Date prefill value., defaults to None
+ :type date_value: Optional[Date], optional
+ """
+ super().__init__(
+ document_tag_id=document_tag_id,
+ text_value=text_value,
+ checkbox_value=checkbox_value,
+ date_value=date_value,
+ **kwargs
+ )
+ self.page_index = page_index
+ self.type = type
+ self.content_type = content_type
+ self.read_only = read_only
diff --git a/box_sdk_gen/schemas/sign_requests.py b/box_sdk_gen/schemas/sign_requests.py
new file mode 100644
index 000000000..71c88ebf2
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_requests.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.sign_request import SignRequest
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SignRequests(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ entries: Optional[List[SignRequest]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param entries: A list of Box Sign requests., defaults to None
+ :type entries: Optional[List[SignRequest]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/sign_template.py b/box_sdk_gen/schemas/sign_template.py
new file mode 100644
index 000000000..08f7ca684
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_template.py
@@ -0,0 +1,251 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.template_signer import TemplateSigner
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SignTemplateTypeField(str, Enum):
+ SIGN_TEMPLATE = 'sign-template'
+
+
+class SignTemplateAdditionalInfoNonEditableField(str, Enum):
+ EMAIL_SUBJECT = 'email_subject'
+ EMAIL_MESSAGE = 'email_message'
+ NAME = 'name'
+ DAYS_VALID = 'days_valid'
+ SIGNERS = 'signers'
+ SOURCE_FILES = 'source_files'
+
+
+class SignTemplateAdditionalInfoRequiredSignersField(str, Enum):
+ EMAIL = 'email'
+
+
+class SignTemplateAdditionalInfoRequiredField(BaseObject):
+ def __init__(
+ self,
+ *,
+ signers: Optional[
+ List[List[SignTemplateAdditionalInfoRequiredSignersField]]
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param signers: Required signer fields., defaults to None
+ :type signers: Optional[List[List[SignTemplateAdditionalInfoRequiredSignersField]]], optional
+ """
+ super().__init__(**kwargs)
+ self.signers = signers
+
+
+class SignTemplateAdditionalInfoField(BaseObject):
+ def __init__(
+ self,
+ *,
+ non_editable: Optional[List[SignTemplateAdditionalInfoNonEditableField]] = None,
+ required: Optional[SignTemplateAdditionalInfoRequiredField] = None,
+ **kwargs
+ ):
+ """
+ :param non_editable: Non editable fields., defaults to None
+ :type non_editable: Optional[List[SignTemplateAdditionalInfoNonEditableField]], optional
+ :param required: Required fields., defaults to None
+ :type required: Optional[SignTemplateAdditionalInfoRequiredField], optional
+ """
+ super().__init__(**kwargs)
+ self.non_editable = non_editable
+ self.required = required
+
+
+class SignTemplateReadySignLinkField(BaseObject):
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ name: Optional[str] = None,
+ instructions: Optional[str] = None,
+ folder_id: Optional[str] = None,
+ is_notification_disabled: Optional[bool] = None,
+ is_active: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param url: The URL that can be sent to signers., defaults to None
+ :type url: Optional[str], optional
+ :param name: Request name., defaults to None
+ :type name: Optional[str], optional
+ :param instructions: Extra instructions for all signers., defaults to None
+ :type instructions: Optional[str], optional
+ :param folder_id: The destination folder to place final,
+ signed document and signing
+ log. Only `ID` and `type` fields are required.
+ The root folder,
+ folder ID `0`, cannot be used., defaults to None
+ :type folder_id: Optional[str], optional
+ :param is_notification_disabled: Whether to disable notifications when
+ a signer has signed., defaults to None
+ :type is_notification_disabled: Optional[bool], optional
+ :param is_active: Whether the ready sign link is enabled or not., defaults to None
+ :type is_active: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.name = name
+ self.instructions = instructions
+ self.folder_id = folder_id
+ self.is_notification_disabled = is_notification_disabled
+ self.is_active = is_active
+
+
+class SignTemplateCustomBrandingField(BaseObject):
+ def __init__(
+ self,
+ *,
+ company_name: Optional[str] = None,
+ logo_uri: Optional[str] = None,
+ branding_color: Optional[str] = None,
+ email_footer_text: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param company_name: Name of the company., defaults to None
+ :type company_name: Optional[str], optional
+ :param logo_uri: Custom branding logo URI in the form of a base64 image., defaults to None
+ :type logo_uri: Optional[str], optional
+ :param branding_color: Custom branding color in hex., defaults to None
+ :type branding_color: Optional[str], optional
+ :param email_footer_text: Content of the email footer., defaults to None
+ :type email_footer_text: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.company_name = company_name
+ self.logo_uri = logo_uri
+ self.branding_color = branding_color
+ self.email_footer_text = email_footer_text
+
+
+class SignTemplate(BaseObject):
+ _discriminator = 'type', {'sign-template'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[SignTemplateTypeField] = None,
+ id: Optional[str] = None,
+ name: Optional[str] = None,
+ email_subject: Optional[str] = None,
+ email_message: Optional[str] = None,
+ days_valid: Optional[int] = None,
+ parent_folder: Optional[FolderMini] = None,
+ source_files: Optional[List[FileMini]] = None,
+ are_fields_locked: Optional[bool] = None,
+ are_options_locked: Optional[bool] = None,
+ are_recipients_locked: Optional[bool] = None,
+ are_email_settings_locked: Optional[bool] = None,
+ are_files_locked: Optional[bool] = None,
+ signers: Optional[List[TemplateSigner]] = None,
+ additional_info: Optional[SignTemplateAdditionalInfoField] = None,
+ ready_sign_link: Optional[SignTemplateReadySignLinkField] = None,
+ custom_branding: Optional[SignTemplateCustomBrandingField] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `sign-template`., defaults to None
+ :type type: Optional[SignTemplateTypeField], optional
+ :param id: Template identifier., defaults to None
+ :type id: Optional[str], optional
+ :param name: The name of the template., defaults to None
+ :type name: Optional[str], optional
+ :param email_subject: Subject of signature request email. This is cleaned by sign
+ request. If this field is not passed, a default subject will be used., defaults to None
+ :type email_subject: Optional[str], optional
+ :param email_message: Message to include in signature request email. The field
+ is cleaned through sanitization of specific characters. However,
+ some html tags are allowed. Links included in the
+ message are also converted to hyperlinks in the email. The
+ message may contain the following html tags including `a`, `abbr`,
+ `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and
+ `strong`. Be aware that when the text
+ to html ratio is too high, the email
+ may end up in spam filters. Custom styles on
+ these tags are not allowed.
+ If this field is not passed, a default message will be used., defaults to None
+ :type email_message: Optional[str], optional
+ :param days_valid: Set the number of days after which the
+ created signature request will automatically
+ expire if not completed. By default, we do
+ not apply any expiration date on signature
+ requests, and the signature request does not expire., defaults to None
+ :type days_valid: Optional[int], optional
+ :param source_files: List of files to create a signing document from.
+ Only the ID and type fields are required
+ for each file., defaults to None
+ :type source_files: Optional[List[FileMini]], optional
+ :param are_fields_locked: Indicates if the template input
+ fields are editable or not., defaults to None
+ :type are_fields_locked: Optional[bool], optional
+ :param are_options_locked: Indicates if the template document options
+ are editable or not,
+ for example renaming the document., defaults to None
+ :type are_options_locked: Optional[bool], optional
+ :param are_recipients_locked: Indicates if the template signers are editable or not., defaults to None
+ :type are_recipients_locked: Optional[bool], optional
+ :param are_email_settings_locked: Indicates if the template email settings are editable or not., defaults to None
+ :type are_email_settings_locked: Optional[bool], optional
+ :param are_files_locked: Indicates if the template files are editable or not.
+ This includes deleting or renaming template files., defaults to None
+ :type are_files_locked: Optional[bool], optional
+ :param signers: Array of signers for the template.
+
+ **Note**: It may happen that some signers specified in the template belong to conflicting [segments](r://shield-information-barrier-segment-member) (user groups).
+ This means that due to the security policies, users are assigned to segments to prevent exchanges or communication that could lead to ethical conflicts.
+ In such a case, an attempt to send a sign request based on a template that lists signers in conflicting segments will result in an error.
+
+ Read more about [segments and ethical walls](https://support.box.com/hc/en-us/articles/9920431507603-Understanding-Information-Barriers#h_01GFVJEHQA06N7XEZ4GCZ9GFAQ)., defaults to None
+ :type signers: Optional[List[TemplateSigner]], optional
+ :param additional_info: Additional information on which fields are
+ required and which fields are not editable., defaults to None
+ :type additional_info: Optional[SignTemplateAdditionalInfoField], optional
+ :param ready_sign_link: Box's ready-sign link feature enables you to create a
+ link to a signature request that
+ you've created from a template. Use this link
+ when you want to post a signature request
+ on a public form — such as an email, social media post,
+ or web page — without knowing who the signers will be.
+ Note: The ready-sign link feature is
+ limited to Enterprise Plus customers and not
+ available to Box Verified Enterprises., defaults to None
+ :type ready_sign_link: Optional[SignTemplateReadySignLinkField], optional
+ :param custom_branding: Custom branding applied to notifications
+ and signature requests., defaults to None
+ :type custom_branding: Optional[SignTemplateCustomBrandingField], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.name = name
+ self.email_subject = email_subject
+ self.email_message = email_message
+ self.days_valid = days_valid
+ self.parent_folder = parent_folder
+ self.source_files = source_files
+ self.are_fields_locked = are_fields_locked
+ self.are_options_locked = are_options_locked
+ self.are_recipients_locked = are_recipients_locked
+ self.are_email_settings_locked = are_email_settings_locked
+ self.are_files_locked = are_files_locked
+ self.signers = signers
+ self.additional_info = additional_info
+ self.ready_sign_link = ready_sign_link
+ self.custom_branding = custom_branding
diff --git a/box_sdk_gen/schemas/sign_templates.py b/box_sdk_gen/schemas/sign_templates.py
new file mode 100644
index 000000000..00f7f744e
--- /dev/null
+++ b/box_sdk_gen/schemas/sign_templates.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.sign_template import SignTemplate
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SignTemplates(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[SignTemplate]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of templates., defaults to None
+ :type entries: Optional[List[SignTemplate]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/skill_cards_metadata.py b/box_sdk_gen/schemas/skill_cards_metadata.py
new file mode 100644
index 000000000..0c2135962
--- /dev/null
+++ b/box_sdk_gen/schemas/skill_cards_metadata.py
@@ -0,0 +1,102 @@
+from typing import Optional
+
+from typing import List
+
+from typing import Union
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.keyword_skill_card import KeywordSkillCard
+
+from box_sdk_gen.schemas.timeline_skill_card import TimelineSkillCard
+
+from box_sdk_gen.schemas.transcript_skill_card import TranscriptSkillCard
+
+from box_sdk_gen.schemas.status_skill_card import StatusSkillCard
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class SkillCardsMetadata(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'can_edit': '$canEdit',
+ 'id': '$id',
+ 'parent': '$parent',
+ 'scope': '$scope',
+ 'template': '$template',
+ 'type': '$type',
+ 'type_version': '$typeVersion',
+ 'version': '$version',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ '$canEdit': 'can_edit',
+ '$id': 'id',
+ '$parent': 'parent',
+ '$scope': 'scope',
+ '$template': 'template',
+ '$type': 'type',
+ '$typeVersion': 'type_version',
+ '$version': 'version',
+ **BaseObject._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ can_edit: Optional[bool] = None,
+ id: Optional[str] = None,
+ parent: Optional[str] = None,
+ scope: Optional[str] = None,
+ template: Optional[str] = None,
+ type: Optional[str] = None,
+ type_version: Optional[int] = None,
+ version: Optional[int] = None,
+ cards: Optional[
+ List[
+ Union[
+ KeywordSkillCard,
+ TimelineSkillCard,
+ TranscriptSkillCard,
+ StatusSkillCard,
+ ]
+ ]
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param can_edit: Whether the user can edit this metadata., defaults to None
+ :type can_edit: Optional[bool], optional
+ :param id: A UUID to identify the metadata object., defaults to None
+ :type id: Optional[str], optional
+ :param parent: An ID for the parent folder., defaults to None
+ :type parent: Optional[str], optional
+ :param scope: An ID for the scope in which this template
+ has been applied., defaults to None
+ :type scope: Optional[str], optional
+ :param template: The name of the template., defaults to None
+ :type template: Optional[str], optional
+ :param type: A unique identifier for the "type" of this instance. This is an internal
+ system property and should not be used by a client application., defaults to None
+ :type type: Optional[str], optional
+ :param type_version: The last-known version of the template of the object. This is an internal
+ system property and should not be used by a client application., defaults to None
+ :type type_version: Optional[int], optional
+ :param version: The version of the metadata object. Starts at 0 and increases every time
+ a user-defined property is modified., defaults to None
+ :type version: Optional[int], optional
+ :param cards: A list of Box Skill cards that have been applied to this file., defaults to None
+ :type cards: Optional[List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]], optional
+ """
+ super().__init__(**kwargs)
+ self.can_edit = can_edit
+ self.id = id
+ self.parent = parent
+ self.scope = scope
+ self.template = template
+ self.type = type
+ self.type_version = type_version
+ self.version = version
+ self.cards = cards
diff --git a/box_sdk_gen/schemas/skill_invocation.py b/box_sdk_gen/schemas/skill_invocation.py
new file mode 100644
index 000000000..29c9f0e32
--- /dev/null
+++ b/box_sdk_gen/schemas/skill_invocation.py
@@ -0,0 +1,257 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Union
+
+from box_sdk_gen.schemas.file import File
+
+from box_sdk_gen.schemas.folder import Folder
+
+from box_sdk_gen.schemas.event import Event
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class SkillInvocationTypeField(str, Enum):
+ SKILL_INVOCATION = 'skill_invocation'
+
+
+class SkillInvocationSkillTypeField(str, Enum):
+ SKILL = 'skill'
+
+
+class SkillInvocationSkillField(BaseObject):
+ _discriminator = 'type', {'skill'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[SkillInvocationSkillTypeField] = None,
+ name: Optional[str] = None,
+ api_key: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this skill., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `skill`., defaults to None
+ :type type: Optional[SkillInvocationSkillTypeField], optional
+ :param name: The name of the skill., defaults to None
+ :type name: Optional[str], optional
+ :param api_key: The client ID of the application., defaults to None
+ :type api_key: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+ self.api_key = api_key
+
+
+class SkillInvocationTokenReadTokenTypeField(str, Enum):
+ BEARER = 'bearer'
+
+
+class SkillInvocationTokenReadField(BaseObject):
+ def __init__(
+ self,
+ *,
+ access_token: Optional[str] = None,
+ expires_in: Optional[int] = None,
+ token_type: Optional[SkillInvocationTokenReadTokenTypeField] = None,
+ restricted_to: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param access_token: The requested access token., defaults to None
+ :type access_token: Optional[str], optional
+ :param expires_in: The time in seconds by which this token will expire., defaults to None
+ :type expires_in: Optional[int], optional
+ :param token_type: The type of access token returned., defaults to None
+ :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., defaults to None
+ :type restricted_to: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.access_token = access_token
+ self.expires_in = expires_in
+ self.token_type = token_type
+ self.restricted_to = restricted_to
+
+
+class SkillInvocationTokenWriteTokenTypeField(str, Enum):
+ BEARER = 'bearer'
+
+
+class SkillInvocationTokenWriteField(BaseObject):
+ def __init__(
+ self,
+ *,
+ access_token: Optional[str] = None,
+ expires_in: Optional[int] = None,
+ token_type: Optional[SkillInvocationTokenWriteTokenTypeField] = None,
+ restricted_to: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param access_token: The requested access token., defaults to None
+ :type access_token: Optional[str], optional
+ :param expires_in: The time in seconds by which this token will expire., defaults to None
+ :type expires_in: Optional[int], optional
+ :param token_type: The type of access token returned., defaults to None
+ :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., defaults to None
+ :type restricted_to: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.access_token = access_token
+ self.expires_in = expires_in
+ self.token_type = token_type
+ self.restricted_to = restricted_to
+
+
+class SkillInvocationTokenField(BaseObject):
+ def __init__(
+ self,
+ *,
+ read: Optional[SkillInvocationTokenReadField] = None,
+ write: Optional[SkillInvocationTokenWriteField] = None,
+ **kwargs
+ ):
+ """
+ :param read: The basics of an access token., defaults to None
+ :type read: Optional[SkillInvocationTokenReadField], optional
+ :param write: The basics of an access token., defaults to None
+ :type write: Optional[SkillInvocationTokenWriteField], optional
+ """
+ super().__init__(**kwargs)
+ self.read = read
+ self.write = write
+
+
+class SkillInvocationStatusStateField(str, Enum):
+ INVOKED = 'invoked'
+ PROCESSING = 'processing'
+ SUCCESS = 'success'
+ TRANSIENT_FAILURE = 'transient_failure'
+ PERMANENT_FAILURE = 'permanent_failure'
+
+
+class SkillInvocationStatusField(BaseObject):
+ def __init__(
+ self,
+ *,
+ state: Optional[SkillInvocationStatusStateField] = None,
+ message: Optional[str] = None,
+ error_code: Optional[str] = None,
+ additional_info: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param state: The state of this event.
+
+ * `invoked` - Triggered the skill with event details to start
+ applying skill on the file.
+ * `processing` - Currently processing.
+ * `success` - Completed processing with a success.
+ * `transient_failure` - Encountered an issue which can be
+ retried.
+ * `permanent_failure` - Encountered a permanent issue and
+ retry would not help., defaults to None
+ :type state: Optional[SkillInvocationStatusStateField], optional
+ :param message: Status information., defaults to None
+ :type message: Optional[str], optional
+ :param error_code: Error code information, if error occurred., defaults to None
+ :type error_code: Optional[str], optional
+ :param additional_info: Additional status information., defaults to None
+ :type additional_info: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.state = state
+ self.message = message
+ self.error_code = error_code
+ self.additional_info = additional_info
+
+
+class SkillInvocationEnterpriseTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class SkillInvocationEnterpriseField(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[SkillInvocationEnterpriseTypeField] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[SkillInvocationEnterpriseTypeField], optional
+ :param name: The name of the enterprise., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+
+
+class SkillInvocation(BaseObject):
+ _discriminator = 'type', {'skill_invocation'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[SkillInvocationTypeField] = None,
+ id: Optional[str] = None,
+ skill: Optional[SkillInvocationSkillField] = None,
+ token: Optional[SkillInvocationTokenField] = None,
+ status: Optional[SkillInvocationStatusField] = None,
+ created_at: Optional[DateTime] = None,
+ trigger: Optional[str] = None,
+ enterprise: Optional[SkillInvocationEnterpriseField] = None,
+ source: Optional[Union[File, Folder]] = None,
+ event: Optional[Event] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `skill_invocation`., defaults to None
+ :type type: Optional[SkillInvocationTypeField], optional
+ :param id: Unique identifier for the invocation request., defaults to None
+ :type id: Optional[str], optional
+ :param token: The read-only and read-write access tokens for this item., defaults to None
+ :type token: Optional[SkillInvocationTokenField], optional
+ :param status: The details status of this event., defaults to None
+ :type status: Optional[SkillInvocationStatusField], optional
+ :param created_at: The time this invocation was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param trigger: Action that triggered the invocation., defaults to None
+ :type trigger: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.skill = skill
+ self.token = token
+ self.status = status
+ self.created_at = created_at
+ self.trigger = trigger
+ self.enterprise = enterprise
+ self.source = source
+ self.event = event
diff --git a/box_sdk_gen/schemas/status_skill_card.py b/box_sdk_gen/schemas/status_skill_card.py
new file mode 100644
index 000000000..8ae1d2bb3
--- /dev/null
+++ b/box_sdk_gen/schemas/status_skill_card.py
@@ -0,0 +1,158 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class StatusSkillCardTypeField(str, Enum):
+ SKILL_CARD = 'skill_card'
+
+
+class StatusSkillCardSkillCardTypeField(str, Enum):
+ STATUS = 'status'
+
+
+class StatusSkillCardSkillCardTitleField(BaseObject):
+ def __init__(self, message: str, *, code: Optional[str] = None, **kwargs):
+ """
+ :param message: The actual title to show in the UI.
+ :type message: str
+ :param code: An optional identifier for the title., defaults to None
+ :type code: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.message = message
+ self.code = code
+
+
+class StatusSkillCardStatusCodeField(str, Enum):
+ INVOKED = 'invoked'
+ PROCESSING = 'processing'
+ SUCCESS = 'success'
+ TRANSIENT_FAILURE = 'transient_failure'
+ PERMANENT_FAILURE = 'permanent_failure'
+
+
+class StatusSkillCardStatusField(BaseObject):
+ def __init__(
+ self,
+ code: StatusSkillCardStatusCodeField,
+ *,
+ message: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param code: A code for the status of this Skill invocation. By
+ default each of these will have their own accompanied
+ messages. These can be adjusted by setting the `message`
+ value on this object.
+ :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., defaults to None
+ :type message: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.code = code
+ self.message = message
+
+
+class StatusSkillCardSkillTypeField(str, Enum):
+ SERVICE = 'service'
+
+
+class StatusSkillCardSkillField(BaseObject):
+ _discriminator = 'type', {'service'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: StatusSkillCardSkillTypeField = StatusSkillCardSkillTypeField.SERVICE,
+ **kwargs
+ ):
+ """
+ :param id: A custom identifier that represent the service that
+ applied this metadata.
+ :type id: str
+ :param type: The value will always be `service`., defaults to StatusSkillCardSkillTypeField.SERVICE
+ :type type: StatusSkillCardSkillTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class StatusSkillCardInvocationTypeField(str, Enum):
+ SKILL_INVOCATION = 'skill_invocation'
+
+
+class StatusSkillCardInvocationField(BaseObject):
+ _discriminator = 'type', {'skill_invocation'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: StatusSkillCardInvocationTypeField = StatusSkillCardInvocationTypeField.SKILL_INVOCATION,
+ **kwargs
+ ):
+ """
+ :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
+ nodes, this field can be used to identify the ID of
+ the node that was used to apply the metadata.
+ :type id: str
+ :param type: The value will always be `skill_invocation`., defaults to StatusSkillCardInvocationTypeField.SKILL_INVOCATION
+ :type type: StatusSkillCardInvocationTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class StatusSkillCard(BaseObject):
+ _discriminator = 'skill_card_type', {'status'}
+
+ def __init__(
+ self,
+ status: StatusSkillCardStatusField,
+ skill: StatusSkillCardSkillField,
+ invocation: StatusSkillCardInvocationField,
+ *,
+ created_at: Optional[DateTime] = None,
+ type: StatusSkillCardTypeField = StatusSkillCardTypeField.SKILL_CARD,
+ skill_card_type: StatusSkillCardSkillCardTypeField = StatusSkillCardSkillCardTypeField.STATUS,
+ skill_card_title: Optional[StatusSkillCardSkillCardTitleField] = None,
+ **kwargs
+ ):
+ """
+ :param status: Sets the status of the skill. This can be used to show a message to the user while the Skill is processing the data, or if it was not able to process the file.
+ :type status: StatusSkillCardStatusField
+ :param skill: The service that applied this metadata.
+ :type skill: StatusSkillCardSkillField
+ :param invocation: The invocation of this service, used to track
+ which instance of a service applied the metadata.
+ :type invocation: StatusSkillCardInvocationField
+ :param created_at: The optional date and time this card was created at., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param type: The value will always be `skill_card`., defaults to StatusSkillCardTypeField.SKILL_CARD
+ :type type: StatusSkillCardTypeField, optional
+ :param skill_card_type: The value will always be `status`., defaults to StatusSkillCardSkillCardTypeField.STATUS
+ :type skill_card_type: StatusSkillCardSkillCardTypeField, optional
+ :param skill_card_title: The title of the card., defaults to None
+ :type skill_card_title: Optional[StatusSkillCardSkillCardTitleField], optional
+ """
+ super().__init__(**kwargs)
+ self.status = status
+ self.skill = skill
+ self.invocation = invocation
+ self.created_at = created_at
+ self.type = type
+ self.skill_card_type = skill_card_type
+ self.skill_card_title = skill_card_title
diff --git a/box_sdk_gen/schemas/storage_policies.py b/box_sdk_gen/schemas/storage_policies.py
new file mode 100644
index 000000000..232f48d88
--- /dev/null
+++ b/box_sdk_gen/schemas/storage_policies.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.storage_policy import StoragePolicy
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class StoragePolicies(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[StoragePolicy]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of storage policies., defaults to None
+ :type entries: Optional[List[StoragePolicy]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/storage_policy.py b/box_sdk_gen/schemas/storage_policy.py
new file mode 100644
index 000000000..eb5e1cf38
--- /dev/null
+++ b/box_sdk_gen/schemas/storage_policy.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.storage_policy_mini import StoragePolicyMiniTypeField
+
+from box_sdk_gen.schemas.storage_policy_mini import StoragePolicyMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class StoragePolicy(StoragePolicyMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ type: StoragePolicyMiniTypeField = StoragePolicyMiniTypeField.STORAGE_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this storage policy.
+ :type id: str
+ :param name: A descriptive name of the region., defaults to None
+ :type name: Optional[str], optional
+ :param type: The value will always be `storage_policy`., defaults to StoragePolicyMiniTypeField.STORAGE_POLICY
+ :type type: StoragePolicyMiniTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.name = name
diff --git a/box_sdk_gen/schemas/storage_policy_assignment.py b/box_sdk_gen/schemas/storage_policy_assignment.py
new file mode 100644
index 000000000..5d53c429b
--- /dev/null
+++ b/box_sdk_gen/schemas/storage_policy_assignment.py
@@ -0,0 +1,53 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.storage_policy_mini import StoragePolicyMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class StoragePolicyAssignmentTypeField(str, Enum):
+ STORAGE_POLICY_ASSIGNMENT = 'storage_policy_assignment'
+
+
+class StoragePolicyAssignmentAssignedToField(BaseObject):
+ def __init__(
+ self, *, id: Optional[str] = None, type: Optional[str] = None, **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type for this object., defaults to None
+ :type type: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class StoragePolicyAssignment(BaseObject):
+ _discriminator = 'type', {'storage_policy_assignment'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: StoragePolicyAssignmentTypeField = StoragePolicyAssignmentTypeField.STORAGE_POLICY_ASSIGNMENT,
+ storage_policy: Optional[StoragePolicyMini] = None,
+ assigned_to: Optional[StoragePolicyAssignmentAssignedToField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for a storage policy assignment.
+ :type id: str
+ :param type: The value will always be `storage_policy_assignment`., defaults to StoragePolicyAssignmentTypeField.STORAGE_POLICY_ASSIGNMENT
+ :type type: StoragePolicyAssignmentTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.storage_policy = storage_policy
+ self.assigned_to = assigned_to
diff --git a/box_sdk_gen/schemas/storage_policy_assignments.py b/box_sdk_gen/schemas/storage_policy_assignments.py
new file mode 100644
index 000000000..6e409766f
--- /dev/null
+++ b/box_sdk_gen/schemas/storage_policy_assignments.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.storage_policy_assignment import StoragePolicyAssignment
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class StoragePolicyAssignments(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[StoragePolicyAssignment]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of storage policy assignments., defaults to None
+ :type entries: Optional[List[StoragePolicyAssignment]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/storage_policy_mini.py b/box_sdk_gen/schemas/storage_policy_mini.py
new file mode 100644
index 000000000..430dc8ba9
--- /dev/null
+++ b/box_sdk_gen/schemas/storage_policy_mini.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class StoragePolicyMiniTypeField(str, Enum):
+ STORAGE_POLICY = 'storage_policy'
+
+
+class StoragePolicyMini(BaseObject):
+ _discriminator = 'type', {'storage_policy'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: StoragePolicyMiniTypeField = StoragePolicyMiniTypeField.STORAGE_POLICY,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this storage policy.
+ :type id: str
+ :param type: The value will always be `storage_policy`., defaults to StoragePolicyMiniTypeField.STORAGE_POLICY
+ :type type: StoragePolicyMiniTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/task.py b/box_sdk_gen/schemas/task.py
new file mode 100644
index 000000000..053942b06
--- /dev/null
+++ b/box_sdk_gen/schemas/task.py
@@ -0,0 +1,87 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.task_assignments import TaskAssignments
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TaskTypeField(str, Enum):
+ TASK = 'task'
+
+
+class TaskActionField(str, Enum):
+ REVIEW = 'review'
+ COMPLETE = 'complete'
+
+
+class TaskCompletionRuleField(str, Enum):
+ ALL_ASSIGNEES = 'all_assignees'
+ ANY_ASSIGNEE = 'any_assignee'
+
+
+class Task(BaseObject):
+ _discriminator = 'type', {'task'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[TaskTypeField] = None,
+ item: Optional[FileMini] = None,
+ due_at: Optional[DateTime] = None,
+ action: Optional[TaskActionField] = None,
+ message: Optional[str] = None,
+ task_assignment_collection: Optional[TaskAssignments] = None,
+ is_completed: Optional[bool] = None,
+ created_by: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ completion_rule: Optional[TaskCompletionRuleField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this task., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `task`., defaults to None
+ :type type: Optional[TaskTypeField], optional
+ :param due_at: When the task is due., defaults to None
+ :type due_at: Optional[DateTime], optional
+ :param action: The type of task the task assignee will be prompted to
+ perform., defaults to None
+ :type action: Optional[TaskActionField], optional
+ :param message: A message that will be included with the task., defaults to None
+ :type message: Optional[str], optional
+ :param is_completed: Whether the task has been completed., defaults to None
+ :type is_completed: Optional[bool], optional
+ :param created_at: When the task object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param completion_rule: Defines which assignees need to complete this task before the task
+ is considered completed.
+
+ * `all_assignees` 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., defaults to None
+ :type completion_rule: Optional[TaskCompletionRuleField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.item = item
+ self.due_at = due_at
+ self.action = action
+ self.message = message
+ self.task_assignment_collection = task_assignment_collection
+ self.is_completed = is_completed
+ self.created_by = created_by
+ self.created_at = created_at
+ self.completion_rule = completion_rule
diff --git a/box_sdk_gen/schemas/task_assignment.py b/box_sdk_gen/schemas/task_assignment.py
new file mode 100644
index 000000000..6784ec12e
--- /dev/null
+++ b/box_sdk_gen/schemas/task_assignment.py
@@ -0,0 +1,76 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.file_mini import FileMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TaskAssignmentTypeField(str, Enum):
+ TASK_ASSIGNMENT = 'task_assignment'
+
+
+class TaskAssignmentResolutionStateField(str, Enum):
+ COMPLETED = 'completed'
+ INCOMPLETE = 'incomplete'
+ APPROVED = 'approved'
+ REJECTED = 'rejected'
+
+
+class TaskAssignment(BaseObject):
+ _discriminator = 'type', {'task_assignment'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[TaskAssignmentTypeField] = None,
+ item: Optional[FileMini] = None,
+ assigned_to: Optional[UserMini] = None,
+ message: Optional[str] = None,
+ completed_at: Optional[DateTime] = None,
+ assigned_at: Optional[DateTime] = None,
+ reminded_at: Optional[DateTime] = None,
+ resolution_state: Optional[TaskAssignmentResolutionStateField] = None,
+ assigned_by: Optional[UserMini] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this task assignment., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `task_assignment`., defaults to None
+ :type type: Optional[TaskAssignmentTypeField], optional
+ :param message: A message that will is included with the task
+ assignment. This is visible to the assigned user in the web and mobile
+ UI., defaults to None
+ :type message: Optional[str], optional
+ :param completed_at: The date at which this task assignment was
+ completed. This will be `null` if the task is not completed yet., defaults to None
+ :type completed_at: Optional[DateTime], optional
+ :param assigned_at: The date at which this task was assigned to the user., defaults to None
+ :type assigned_at: Optional[DateTime], optional
+ :param reminded_at: The date at which the assigned user was reminded of this task
+ assignment., defaults to None
+ :type reminded_at: Optional[DateTime], optional
+ :param resolution_state: The current state of the assignment. The available states depend on
+ the `action` value of the task object., defaults to None
+ :type resolution_state: Optional[TaskAssignmentResolutionStateField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.item = item
+ self.assigned_to = assigned_to
+ self.message = message
+ self.completed_at = completed_at
+ self.assigned_at = assigned_at
+ self.reminded_at = reminded_at
+ self.resolution_state = resolution_state
+ self.assigned_by = assigned_by
diff --git a/box_sdk_gen/schemas/task_assignments.py b/box_sdk_gen/schemas/task_assignments.py
new file mode 100644
index 000000000..66c3937f5
--- /dev/null
+++ b/box_sdk_gen/schemas/task_assignments.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.task_assignment import TaskAssignment
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class TaskAssignments(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ entries: Optional[List[TaskAssignment]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: The total number of items in this collection., defaults to None
+ :type total_count: Optional[int], optional
+ :param entries: A list of task assignments., defaults to None
+ :type entries: Optional[List[TaskAssignment]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/tasks.py b/box_sdk_gen/schemas/tasks.py
new file mode 100644
index 000000000..0fd54f38a
--- /dev/null
+++ b/box_sdk_gen/schemas/tasks.py
@@ -0,0 +1,30 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.task import Task
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Tasks(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ entries: Optional[List[Task]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`., defaults to None
+ :type total_count: Optional[int], optional
+ :param entries: A list of tasks., defaults to None
+ :type entries: Optional[List[Task]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/template_signer.py b/box_sdk_gen/schemas/template_signer.py
new file mode 100644
index 000000000..be1404779
--- /dev/null
+++ b/box_sdk_gen/schemas/template_signer.py
@@ -0,0 +1,80 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.template_signer_input import TemplateSignerInput
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class TemplateSignerRoleField(str, Enum):
+ SIGNER = 'signer'
+ APPROVER = 'approver'
+ FINAL_COPY_READER = 'final_copy_reader'
+
+
+class TemplateSigner(BaseObject):
+ def __init__(
+ self,
+ *,
+ inputs: Optional[List[TemplateSignerInput]] = None,
+ email: Optional[str] = None,
+ role: Optional[TemplateSignerRoleField] = None,
+ is_in_person: Optional[bool] = None,
+ order: Optional[int] = None,
+ signer_group_id: Optional[str] = None,
+ label: Optional[str] = None,
+ public_id: Optional[str] = None,
+ is_password_required: Optional[bool] = None,
+ is_phone_number_required: Optional[bool] = None,
+ login_required: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param email: Email address of the signer., defaults to None
+ :type email: Optional[str], optional
+ :param role: Defines the role of the signer in the signature request. A role of
+ `signer` needs to sign the document, a role `approver`
+ approves the document and
+ a `final_copy_reader` role only
+ receives the final signed document and signing log., defaults to None
+ :type role: Optional[TemplateSignerRoleField], optional
+ :param is_in_person: Used in combination with an embed URL for a sender.
+ After the sender signs, they will be
+ redirected to the next `in_person` signer., defaults to None
+ :type is_in_person: Optional[bool], optional
+ :param order: Order of the signer., defaults to None
+ :type order: Optional[int], optional
+ :param signer_group_id: If provided, this value points signers that are assigned the same inputs and belongs to same signer group.
+ A signer group is not a Box Group. It is an entity that belongs to the template itself and can only be used
+ within Box Sign requests created from it., defaults to None
+ :type signer_group_id: Optional[str], optional
+ :param label: A placeholder label for the signer set by the template creator to differentiate between signers., defaults to None
+ :type label: Optional[str], optional
+ :param public_id: An identifier for the signer. This can be used to identify a signer within the template., defaults to None
+ :type public_id: Optional[str], optional
+ :param is_password_required: If true for signers with a defined email, the password provided when the template was created is used by default.
+ If true for signers without a specified / defined email, the creator needs to provide a password when using the template., defaults to None
+ :type is_password_required: Optional[bool], optional
+ :param is_phone_number_required: If true for signers with a defined email, the phone number provided when the template was created is used by default.
+ If true for signers without a specified / defined email, the template creator needs to provide a phone number when creating a request., defaults to None
+ :type is_phone_number_required: Optional[bool], optional
+ :param login_required: If true, the signer is required to login to access the document., defaults to None
+ :type login_required: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.inputs = inputs
+ self.email = email
+ self.role = role
+ self.is_in_person = is_in_person
+ self.order = order
+ self.signer_group_id = signer_group_id
+ self.label = label
+ self.public_id = public_id
+ self.is_password_required = is_password_required
+ self.is_phone_number_required = is_phone_number_required
+ self.login_required = login_required
diff --git a/box_sdk_gen/schemas/template_signer_input.py b/box_sdk_gen/schemas/template_signer_input.py
new file mode 100644
index 000000000..32702404a
--- /dev/null
+++ b/box_sdk_gen/schemas/template_signer_input.py
@@ -0,0 +1,147 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.internal.utils import Date
+
+from box_sdk_gen.schemas.sign_request_prefill_tag import SignRequestPrefillTag
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class TemplateSignerInputTypeField(str, Enum):
+ SIGNATURE = 'signature'
+ DATE = 'date'
+ TEXT = 'text'
+ CHECKBOX = 'checkbox'
+ ATTACHMENT = 'attachment'
+ RADIO = 'radio'
+ DROPDOWN = 'dropdown'
+
+
+class TemplateSignerInputContentTypeField(str, Enum):
+ SIGNATURE = 'signature'
+ INITIAL = 'initial'
+ STAMP = 'stamp'
+ DATE = 'date'
+ CHECKBOX = 'checkbox'
+ TEXT = 'text'
+ FULL_NAME = 'full_name'
+ FIRST_NAME = 'first_name'
+ LAST_NAME = 'last_name'
+ COMPANY = 'company'
+ TITLE = 'title'
+ EMAIL = 'email'
+ ATTACHMENT = 'attachment'
+ RADIO = 'radio'
+ DROPDOWN = 'dropdown'
+
+
+class TemplateSignerInputCoordinatesField(BaseObject):
+ def __init__(
+ self, *, x: Optional[float] = None, y: Optional[float] = None, **kwargs
+ ):
+ """
+ :param x: Relative x coordinate to the page the input is on, ranging from 0 to 1., defaults to None
+ :type x: Optional[float], optional
+ :param y: Relative y coordinate to the page the input is on, ranging from 0 to 1., defaults to None
+ :type y: Optional[float], optional
+ """
+ super().__init__(**kwargs)
+ self.x = x
+ self.y = y
+
+
+class TemplateSignerInputDimensionsField(BaseObject):
+ def __init__(
+ self, *, width: Optional[float] = None, height: Optional[float] = None, **kwargs
+ ):
+ """
+ :param width: Relative width to the page the input is on, ranging from 0 to 1., defaults to None
+ :type width: Optional[float], optional
+ :param height: Relative height to the page the input is on, ranging from 0 to 1., defaults to None
+ :type height: Optional[float], optional
+ """
+ super().__init__(**kwargs)
+ self.width = width
+ self.height = height
+
+
+class TemplateSignerInput(SignRequestPrefillTag):
+ def __init__(
+ self,
+ page_index: int,
+ *,
+ type: Optional[TemplateSignerInputTypeField] = None,
+ content_type: Optional[TemplateSignerInputContentTypeField] = None,
+ is_required: Optional[bool] = None,
+ document_id: Optional[str] = None,
+ dropdown_choices: Optional[List[str]] = None,
+ group_id: Optional[str] = None,
+ coordinates: Optional[TemplateSignerInputCoordinatesField] = None,
+ dimensions: Optional[TemplateSignerInputDimensionsField] = None,
+ label: Optional[str] = None,
+ read_only: Optional[bool] = None,
+ document_tag_id: Optional[str] = None,
+ text_value: Optional[str] = None,
+ checkbox_value: Optional[bool] = None,
+ date_value: Optional[Date] = None,
+ **kwargs
+ ):
+ """
+ :param page_index: Index of page that the input is on.
+ :type page_index: int
+ :param type: Type of input., defaults to None
+ :type type: Optional[TemplateSignerInputTypeField], optional
+ :param content_type: Content type of input., defaults to None
+ :type content_type: Optional[TemplateSignerInputContentTypeField], optional
+ :param is_required: Whether or not the input is required., defaults to None
+ :type is_required: Optional[bool], optional
+ :param document_id: Document identifier., defaults to None
+ :type document_id: Optional[str], optional
+ :param dropdown_choices: When the input is of the type `dropdown` this
+ values will be filled with all the
+ dropdown options., defaults to None
+ :type dropdown_choices: Optional[List[str]], optional
+ :param group_id: When the input is of type `radio` they can be
+ grouped to gather with this identifier., defaults to None
+ :type group_id: Optional[str], optional
+ :param coordinates: Where the input is located on a page., defaults to None
+ :type coordinates: Optional[TemplateSignerInputCoordinatesField], optional
+ :param dimensions: The size of the input., defaults to None
+ :type dimensions: Optional[TemplateSignerInputDimensionsField], optional
+ :param label: The label field is used especially for text, attachment, radio, and checkbox type inputs., defaults to None
+ :type label: Optional[str], optional
+ :param read_only: Whether this input was defined as read-only(immutable by signers) or not., defaults to None
+ :type read_only: Optional[bool], optional
+ :param document_tag_id: This references the ID of a specific tag contained in a file of the signature request., defaults to None
+ :type document_tag_id: Optional[str], optional
+ :param text_value: Text prefill value., defaults to None
+ :type text_value: Optional[str], optional
+ :param checkbox_value: Checkbox prefill value., defaults to None
+ :type checkbox_value: Optional[bool], optional
+ :param date_value: Date prefill value., defaults to None
+ :type date_value: Optional[Date], optional
+ """
+ super().__init__(
+ document_tag_id=document_tag_id,
+ text_value=text_value,
+ checkbox_value=checkbox_value,
+ date_value=date_value,
+ **kwargs
+ )
+ self.page_index = page_index
+ self.type = type
+ self.content_type = content_type
+ self.is_required = is_required
+ self.document_id = document_id
+ self.dropdown_choices = dropdown_choices
+ self.group_id = group_id
+ self.coordinates = coordinates
+ self.dimensions = dimensions
+ self.label = label
+ self.read_only = read_only
diff --git a/box_sdk_gen/schemas/terms_of_service.py b/box_sdk_gen/schemas/terms_of_service.py
new file mode 100644
index 000000000..f36ac992c
--- /dev/null
+++ b/box_sdk_gen/schemas/terms_of_service.py
@@ -0,0 +1,92 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.terms_of_service_base import TermsOfServiceBaseTypeField
+
+from box_sdk_gen.schemas.terms_of_service_base import TermsOfServiceBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TermsOfServiceStatusField(str, Enum):
+ ENABLED = 'enabled'
+ DISABLED = 'disabled'
+
+
+class TermsOfServiceEnterpriseTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class TermsOfServiceEnterpriseField(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[TermsOfServiceEnterpriseTypeField] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[TermsOfServiceEnterpriseTypeField], optional
+ :param name: The name of the enterprise., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+
+
+class TermsOfServiceTosTypeField(str, Enum):
+ MANAGED = 'managed'
+ EXTERNAL = 'external'
+
+
+class TermsOfService(TermsOfServiceBase):
+ def __init__(
+ self,
+ id: str,
+ *,
+ status: Optional[TermsOfServiceStatusField] = None,
+ enterprise: Optional[TermsOfServiceEnterpriseField] = None,
+ tos_type: Optional[TermsOfServiceTosTypeField] = None,
+ text: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ type: TermsOfServiceBaseTypeField = TermsOfServiceBaseTypeField.TERMS_OF_SERVICE,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this terms of service.
+ :type id: str
+ :param status: Whether these terms are enabled or not., defaults to None
+ :type status: Optional[TermsOfServiceStatusField], optional
+ :param tos_type: Whether to apply these terms to managed users or external users., defaults to None
+ :type tos_type: Optional[TermsOfServiceTosTypeField], optional
+ :param text: The text for your terms and conditions. This text could be
+ empty if the `status` is set to `disabled`., defaults to None
+ :type text: Optional[str], optional
+ :param created_at: When the legal item was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the legal item was modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param type: The value will always be `terms_of_service`., defaults to TermsOfServiceBaseTypeField.TERMS_OF_SERVICE
+ :type type: TermsOfServiceBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.status = status
+ self.enterprise = enterprise
+ self.tos_type = tos_type
+ self.text = text
+ self.created_at = created_at
+ self.modified_at = modified_at
diff --git a/box_sdk_gen/schemas/terms_of_service_base.py b/box_sdk_gen/schemas/terms_of_service_base.py
new file mode 100644
index 000000000..d2cb2b8f3
--- /dev/null
+++ b/box_sdk_gen/schemas/terms_of_service_base.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class TermsOfServiceBaseTypeField(str, Enum):
+ TERMS_OF_SERVICE = 'terms_of_service'
+
+
+class TermsOfServiceBase(BaseObject):
+ _discriminator = 'type', {'terms_of_service'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: TermsOfServiceBaseTypeField = TermsOfServiceBaseTypeField.TERMS_OF_SERVICE,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this terms of service.
+ :type id: str
+ :param type: The value will always be `terms_of_service`., defaults to TermsOfServiceBaseTypeField.TERMS_OF_SERVICE
+ :type type: TermsOfServiceBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/terms_of_service_user_status.py b/box_sdk_gen/schemas/terms_of_service_user_status.py
new file mode 100644
index 000000000..d9a8dc3ed
--- /dev/null
+++ b/box_sdk_gen/schemas/terms_of_service_user_status.py
@@ -0,0 +1,54 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.terms_of_service_base import TermsOfServiceBase
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TermsOfServiceUserStatusTypeField(str, Enum):
+ TERMS_OF_SERVICE_USER_STATUS = 'terms_of_service_user_status'
+
+
+class TermsOfServiceUserStatus(BaseObject):
+ _discriminator = 'type', {'terms_of_service_user_status'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: TermsOfServiceUserStatusTypeField = TermsOfServiceUserStatusTypeField.TERMS_OF_SERVICE_USER_STATUS,
+ tos: Optional[TermsOfServiceBase] = None,
+ user: Optional[UserMini] = None,
+ is_accepted: Optional[bool] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this terms of service user status.
+ :type id: str
+ :param type: The value will always be `terms_of_service_user_status`., defaults to TermsOfServiceUserStatusTypeField.TERMS_OF_SERVICE_USER_STATUS
+ :type type: TermsOfServiceUserStatusTypeField, optional
+ :param is_accepted: If the user has accepted the terms of services., defaults to None
+ :type is_accepted: Optional[bool], optional
+ :param created_at: When the legal item was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the legal item was modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.tos = tos
+ self.user = user
+ self.is_accepted = is_accepted
+ self.created_at = created_at
+ self.modified_at = modified_at
diff --git a/box_sdk_gen/schemas/terms_of_service_user_statuses.py b/box_sdk_gen/schemas/terms_of_service_user_statuses.py
new file mode 100644
index 000000000..5438133b1
--- /dev/null
+++ b/box_sdk_gen/schemas/terms_of_service_user_statuses.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.terms_of_service_user_status import TermsOfServiceUserStatus
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class TermsOfServiceUserStatuses(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ entries: Optional[List[TermsOfServiceUserStatus]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: The total number of objects., defaults to None
+ :type total_count: Optional[int], optional
+ :param entries: A list of terms of service user statuses., defaults to None
+ :type entries: Optional[List[TermsOfServiceUserStatus]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/terms_of_services.py b/box_sdk_gen/schemas/terms_of_services.py
new file mode 100644
index 000000000..880a1958d
--- /dev/null
+++ b/box_sdk_gen/schemas/terms_of_services.py
@@ -0,0 +1,28 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.terms_of_service import TermsOfService
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class TermsOfServices(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ entries: Optional[List[TermsOfService]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: The total number of objects., defaults to None
+ :type total_count: Optional[int], optional
+ :param entries: A list of terms of service objects., defaults to None
+ :type entries: Optional[List[TermsOfService]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/timeline_skill_card.py b/box_sdk_gen/schemas/timeline_skill_card.py
new file mode 100644
index 000000000..a08774061
--- /dev/null
+++ b/box_sdk_gen/schemas/timeline_skill_card.py
@@ -0,0 +1,182 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TimelineSkillCardTypeField(str, Enum):
+ SKILL_CARD = 'skill_card'
+
+
+class TimelineSkillCardSkillCardTypeField(str, Enum):
+ TIMELINE = 'timeline'
+
+
+class TimelineSkillCardSkillCardTitleField(BaseObject):
+ def __init__(self, message: str, *, code: Optional[str] = None, **kwargs):
+ """
+ :param message: The actual title to show in the UI.
+ :type message: str
+ :param code: An optional identifier for the title., defaults to None
+ :type code: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.message = message
+ self.code = code
+
+
+class TimelineSkillCardSkillTypeField(str, Enum):
+ SERVICE = 'service'
+
+
+class TimelineSkillCardSkillField(BaseObject):
+ _discriminator = 'type', {'service'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: TimelineSkillCardSkillTypeField = TimelineSkillCardSkillTypeField.SERVICE,
+ **kwargs
+ ):
+ """
+ :param id: A custom identifier that represent the service that
+ applied this metadata.
+ :type id: str
+ :param type: The value will always be `service`., defaults to TimelineSkillCardSkillTypeField.SERVICE
+ :type type: TimelineSkillCardSkillTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class TimelineSkillCardInvocationTypeField(str, Enum):
+ SKILL_INVOCATION = 'skill_invocation'
+
+
+class TimelineSkillCardInvocationField(BaseObject):
+ _discriminator = 'type', {'skill_invocation'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: TimelineSkillCardInvocationTypeField = TimelineSkillCardInvocationTypeField.SKILL_INVOCATION,
+ **kwargs
+ ):
+ """
+ :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
+ nodes, this field can be used to identify the ID of
+ the node that was used to apply the metadata.
+ :type id: str
+ :param type: The value will always be `skill_invocation`., defaults to TimelineSkillCardInvocationTypeField.SKILL_INVOCATION
+ :type type: TimelineSkillCardInvocationTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class TimelineSkillCardEntriesAppearsField(BaseObject):
+ def __init__(
+ self, *, start: Optional[int] = None, end: Optional[int] = None, **kwargs
+ ):
+ """
+ :param start: The time in seconds when an
+ entry should start appearing on a timeline., defaults to None
+ :type start: Optional[int], optional
+ :param end: The time in seconds when an
+ entry should stop appearing on a timeline., defaults to None
+ :type end: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.start = start
+ self.end = end
+
+
+class TimelineSkillCardEntriesField(BaseObject):
+ def __init__(
+ self,
+ *,
+ text: Optional[str] = None,
+ appears: Optional[List[TimelineSkillCardEntriesAppearsField]] = None,
+ image_url: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param text: The text of the entry. This would be the display
+ name for an item being placed on the timeline, for example the name
+ of the person who was detected in a video., defaults to None
+ :type text: Optional[str], optional
+ :param appears: Defines a list of timestamps for when this item should appear on the
+ timeline., defaults to None
+ :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
+ list of items (for example faces), and clicking
+ the image will show the user where that entry
+ appears during the duration of this entry., defaults to None
+ :type image_url: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.text = text
+ self.appears = appears
+ self.image_url = image_url
+
+
+class TimelineSkillCard(BaseObject):
+ _discriminator = 'skill_card_type', {'timeline'}
+
+ def __init__(
+ self,
+ skill: TimelineSkillCardSkillField,
+ invocation: TimelineSkillCardInvocationField,
+ entries: List[TimelineSkillCardEntriesField],
+ *,
+ created_at: Optional[DateTime] = None,
+ type: TimelineSkillCardTypeField = TimelineSkillCardTypeField.SKILL_CARD,
+ skill_card_type: TimelineSkillCardSkillCardTypeField = TimelineSkillCardSkillCardTypeField.TIMELINE,
+ skill_card_title: Optional[TimelineSkillCardSkillCardTitleField] = None,
+ duration: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param skill: The service that applied this metadata.
+ :type skill: TimelineSkillCardSkillField
+ :param invocation: The invocation of this service, used to track
+ which instance of a service applied the metadata.
+ :type invocation: TimelineSkillCardInvocationField
+ :param entries: A list of entries on the timeline.
+ :type entries: List[TimelineSkillCardEntriesField]
+ :param created_at: The optional date and time this card was created at., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param type: The value will always be `skill_card`., defaults to TimelineSkillCardTypeField.SKILL_CARD
+ :type type: TimelineSkillCardTypeField, optional
+ :param skill_card_type: The value will always be `timeline`., defaults to TimelineSkillCardSkillCardTypeField.TIMELINE
+ :type skill_card_type: TimelineSkillCardSkillCardTypeField, optional
+ :param skill_card_title: The title of the card., defaults to None
+ :type skill_card_title: Optional[TimelineSkillCardSkillCardTitleField], optional
+ :param duration: An total duration in seconds of the timeline., defaults to None
+ :type duration: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.skill = skill
+ self.invocation = invocation
+ self.entries = entries
+ self.created_at = created_at
+ self.type = type
+ self.skill_card_type = skill_card_type
+ self.skill_card_title = skill_card_title
+ self.duration = duration
diff --git a/box_sdk_gen/schemas/tracking_code.py b/box_sdk_gen/schemas/tracking_code.py
new file mode 100644
index 000000000..0cc016209
--- /dev/null
+++ b/box_sdk_gen/schemas/tracking_code.py
@@ -0,0 +1,37 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class TrackingCodeTypeField(str, Enum):
+ TRACKING_CODE = 'tracking_code'
+
+
+class TrackingCode(BaseObject):
+ _discriminator = 'type', {'tracking_code'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[TrackingCodeTypeField] = None,
+ name: Optional[str] = None,
+ value: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `tracking_code`., defaults to None
+ :type type: Optional[TrackingCodeTypeField], optional
+ :param name: The name of the tracking code, which must be preconfigured in
+ the Admin Console., defaults to None
+ :type name: Optional[str], optional
+ :param value: The value of the tracking code., defaults to None
+ :type value: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.name = name
+ self.value = value
diff --git a/box_sdk_gen/schemas/transcript_skill_card.py b/box_sdk_gen/schemas/transcript_skill_card.py
new file mode 100644
index 000000000..43c8742e5
--- /dev/null
+++ b/box_sdk_gen/schemas/transcript_skill_card.py
@@ -0,0 +1,169 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TranscriptSkillCardTypeField(str, Enum):
+ SKILL_CARD = 'skill_card'
+
+
+class TranscriptSkillCardSkillCardTypeField(str, Enum):
+ TRANSCRIPT = 'transcript'
+
+
+class TranscriptSkillCardSkillCardTitleField(BaseObject):
+ def __init__(self, message: str, *, code: Optional[str] = None, **kwargs):
+ """
+ :param message: The actual title to show in the UI.
+ :type message: str
+ :param code: An optional identifier for the title., defaults to None
+ :type code: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.message = message
+ self.code = code
+
+
+class TranscriptSkillCardSkillTypeField(str, Enum):
+ SERVICE = 'service'
+
+
+class TranscriptSkillCardSkillField(BaseObject):
+ _discriminator = 'type', {'service'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: TranscriptSkillCardSkillTypeField = TranscriptSkillCardSkillTypeField.SERVICE,
+ **kwargs
+ ):
+ """
+ :param id: A custom identifier that represent the service that
+ applied this metadata.
+ :type id: str
+ :param type: The value will always be `service`., defaults to TranscriptSkillCardSkillTypeField.SERVICE
+ :type type: TranscriptSkillCardSkillTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class TranscriptSkillCardInvocationTypeField(str, Enum):
+ SKILL_INVOCATION = 'skill_invocation'
+
+
+class TranscriptSkillCardInvocationField(BaseObject):
+ _discriminator = 'type', {'skill_invocation'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: TranscriptSkillCardInvocationTypeField = TranscriptSkillCardInvocationTypeField.SKILL_INVOCATION,
+ **kwargs
+ ):
+ """
+ :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
+ nodes, this field can be used to identify the ID of
+ the node that was used to apply the metadata.
+ :type id: str
+ :param type: The value will always be `skill_invocation`., defaults to TranscriptSkillCardInvocationTypeField.SKILL_INVOCATION
+ :type type: TranscriptSkillCardInvocationTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class TranscriptSkillCardEntriesAppearsField(BaseObject):
+ def __init__(self, *, start: Optional[int] = None, **kwargs):
+ """
+ :param start: The time in seconds when an
+ entry should start appearing on a timeline., defaults to None
+ :type start: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.start = start
+
+
+class TranscriptSkillCardEntriesField(BaseObject):
+ def __init__(
+ self,
+ *,
+ text: Optional[str] = None,
+ appears: Optional[List[TranscriptSkillCardEntriesAppearsField]] = None,
+ **kwargs
+ ):
+ """
+ :param text: The text of the entry. This would be the transcribed text assigned
+ to the entry on the timeline., defaults to None
+ :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., defaults to None
+ :type appears: Optional[List[TranscriptSkillCardEntriesAppearsField]], optional
+ """
+ super().__init__(**kwargs)
+ self.text = text
+ self.appears = appears
+
+
+class TranscriptSkillCard(BaseObject):
+ _discriminator = 'skill_card_type', {'transcript'}
+
+ def __init__(
+ self,
+ skill: TranscriptSkillCardSkillField,
+ invocation: TranscriptSkillCardInvocationField,
+ entries: List[TranscriptSkillCardEntriesField],
+ *,
+ created_at: Optional[DateTime] = None,
+ type: TranscriptSkillCardTypeField = TranscriptSkillCardTypeField.SKILL_CARD,
+ skill_card_type: TranscriptSkillCardSkillCardTypeField = TranscriptSkillCardSkillCardTypeField.TRANSCRIPT,
+ skill_card_title: Optional[TranscriptSkillCardSkillCardTitleField] = None,
+ duration: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param skill: The service that applied this metadata.
+ :type skill: TranscriptSkillCardSkillField
+ :param invocation: The invocation of this service, used to track
+ which instance of a service applied the metadata.
+ :type invocation: TranscriptSkillCardInvocationField
+ :param entries: An list of entries for the card. This represents the individual entries of
+ the transcription.
+ :type entries: List[TranscriptSkillCardEntriesField]
+ :param created_at: The optional date and time this card was created at., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param type: The value will always be `skill_card`., defaults to TranscriptSkillCardTypeField.SKILL_CARD
+ :type type: TranscriptSkillCardTypeField, optional
+ :param skill_card_type: The value will always be `transcript`., defaults to TranscriptSkillCardSkillCardTypeField.TRANSCRIPT
+ :type skill_card_type: TranscriptSkillCardSkillCardTypeField, optional
+ :param skill_card_title: The title of the card., defaults to None
+ :type skill_card_title: Optional[TranscriptSkillCardSkillCardTitleField], optional
+ :param duration: An optional total duration in seconds.
+
+ Used with a `skill_card_type` of `transcript` or
+ `timeline`., defaults to None
+ :type duration: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.skill = skill
+ self.invocation = invocation
+ self.entries = entries
+ self.created_at = created_at
+ self.type = type
+ self.skill_card_type = skill_card_type
+ self.skill_card_title = skill_card_title
+ self.duration = duration
diff --git a/box_sdk_gen/schemas/trash_file.py b/box_sdk_gen/schemas/trash_file.py
new file mode 100644
index 000000000..37374c80d
--- /dev/null
+++ b/box_sdk_gen/schemas/trash_file.py
@@ -0,0 +1,198 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Dict
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TrashFileTypeField(str, Enum):
+ FILE = 'file'
+
+
+class TrashFilePathCollectionEntriesTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class TrashFilePathCollectionEntriesField(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[TrashFilePathCollectionEntriesTypeField] = None,
+ id: Optional[str] = None,
+ sequence_id: Optional[str] = None,
+ etag: Optional[str] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `folder`., defaults to None
+ :type type: Optional[TrashFilePathCollectionEntriesTypeField], optional
+ :param id: The unique identifier that represent a folder., defaults to None
+ :type id: Optional[str], optional
+ :param sequence_id: This field is null for the Trash folder., defaults to None
+ :type sequence_id: Optional[str], optional
+ :param etag: This field is null for the Trash folder., defaults to None
+ :type etag: Optional[str], optional
+ :param name: The name of the Trash folder., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.sequence_id = sequence_id
+ self.etag = etag
+ self.name = name
+
+
+class TrashFilePathCollectionField(BaseObject):
+ def __init__(
+ self,
+ total_count: int,
+ 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[TrashFilePathCollectionEntriesField]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class TrashFileItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class TrashFile(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'sha_1': 'sha1',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'sha1': 'sha_1',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ id: str,
+ sequence_id: str,
+ sha_1: str,
+ description: str,
+ size: int,
+ path_collection: TrashFilePathCollectionField,
+ created_at: DateTime,
+ modified_at: DateTime,
+ modified_by: UserMini,
+ owned_by: UserMini,
+ item_status: TrashFileItemStatusField,
+ *,
+ etag: Optional[str] = None,
+ type: TrashFileTypeField = TrashFileTypeField.FILE,
+ name: Optional[str] = None,
+ file_version: Optional[FileVersionMini] = None,
+ trashed_at: Optional[DateTime] = None,
+ purged_at: Optional[DateTime] = None,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ created_by: Optional[UserMini] = None,
+ shared_link: Optional[str] = None,
+ parent: Optional[FolderMini] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a file.
+
+ The ID for any file can be determined
+ 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`.
+ :type id: str
+ :param sha_1: The SHA1 hash of the file. This can be used to compare the contents
+ of a file on Box with a local file.
+ :type sha_1: str
+ :param description: The optional description of this file.
+ :type description: str
+ :param size: The file size in bytes. Be careful parsing this integer as it can
+ get very large and cause an integer overflow.
+ :type size: int
+ :param created_at: The date and time when the file was created on Box.
+ :type created_at: DateTime
+ :param modified_at: The date and time when the file was last updated on Box.
+ :type modified_at: DateTime
+ :param item_status: Defines if this item has been deleted or not.
+
+ * `active` when the item has is not in the trash
+ * `trashed` when the item has been moved to the trash but not deleted
+ * `deleted` when the item has been permanently deleted.
+ :type item_status: TrashFileItemStatusField
+ :param etag: The HTTP `etag` of this file. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the file if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `file`., defaults to TrashFileTypeField.FILE
+ :type type: TrashFileTypeField, optional
+ :param name: The name of the file., defaults to None
+ :type name: Optional[str], optional
+ :param trashed_at: The time at which this file was put in the trash., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param purged_at: The time at which this file is expected to be purged
+ from the trash., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param content_created_at: The date and time at which this file was originally
+ created, which might be before it was uploaded to Box., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: The date and time at which this file was last updated,
+ which might be before it was uploaded to Box., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ :param shared_link: The shared link for this file. This will
+ be `null` if a file has been trashed, since the link will no longer
+ be active., defaults to None
+ :type shared_link: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.sequence_id = sequence_id
+ self.sha_1 = sha_1
+ self.description = description
+ self.size = size
+ self.path_collection = path_collection
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.modified_by = modified_by
+ self.owned_by = owned_by
+ self.item_status = item_status
+ self.etag = etag
+ self.type = type
+ self.name = name
+ self.file_version = file_version
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.content_created_at = content_created_at
+ self.content_modified_at = content_modified_at
+ self.created_by = created_by
+ self.shared_link = shared_link
+ self.parent = parent
diff --git a/box_sdk_gen/schemas/trash_file_restored.py b/box_sdk_gen/schemas/trash_file_restored.py
new file mode 100644
index 000000000..65051dfa5
--- /dev/null
+++ b/box_sdk_gen/schemas/trash_file_restored.py
@@ -0,0 +1,157 @@
+from enum import Enum
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.schemas.file_version_mini import FileVersionMini
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TrashFileRestoredTypeField(str, Enum):
+ FILE = 'file'
+
+
+class TrashFileRestoredPathCollectionField(BaseObject):
+ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs):
+ """
+ :param total_count: The number of folders in this list.
+ :type total_count: int
+ :param entries: The parent folders for this item.
+ :type entries: List[FolderMini]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class TrashFileRestoredItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class TrashFileRestored(BaseObject):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'sha_1': 'sha1',
+ **BaseObject._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'sha1': 'sha_1',
+ **BaseObject._json_to_fields_mapping,
+ }
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ id: str,
+ sequence_id: str,
+ sha_1: str,
+ description: str,
+ size: int,
+ path_collection: TrashFileRestoredPathCollectionField,
+ created_at: DateTime,
+ modified_at: DateTime,
+ modified_by: UserMini,
+ owned_by: UserMini,
+ item_status: TrashFileRestoredItemStatusField,
+ *,
+ etag: Optional[str] = None,
+ type: TrashFileRestoredTypeField = TrashFileRestoredTypeField.FILE,
+ name: Optional[str] = None,
+ file_version: Optional[FileVersionMini] = None,
+ trashed_at: Optional[str] = None,
+ purged_at: Optional[str] = None,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ created_by: Optional[UserMini] = None,
+ shared_link: Optional[str] = None,
+ parent: Optional[FolderMini] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a file.
+
+ The ID for any file can be determined
+ 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`.
+ :type id: str
+ :param sha_1: The SHA1 hash of the file. This can be used to compare the contents
+ of a file on Box with a local file.
+ :type sha_1: str
+ :param description: The optional description of this file.
+ :type description: str
+ :param size: The file size in bytes. Be careful parsing this integer as it can
+ get very large and cause an integer overflow.
+ :type size: int
+ :param created_at: The date and time when the file was created on Box.
+ :type created_at: DateTime
+ :param modified_at: The date and time when the file was last updated on Box.
+ :type modified_at: DateTime
+ :param item_status: Defines if this item has been deleted or not.
+
+ * `active` when the item has is not in the trash
+ * `trashed` when the item has been moved to the trash but not deleted
+ * `deleted` when the item has been permanently deleted.
+ :type item_status: TrashFileRestoredItemStatusField
+ :param etag: The HTTP `etag` of this file. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the file if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `file`., defaults to TrashFileRestoredTypeField.FILE
+ :type type: TrashFileRestoredTypeField, optional
+ :param name: The name of the file., defaults to None
+ :type name: Optional[str], optional
+ :param trashed_at: The time at which this file was put in the
+ trash - becomes `null` after restore., defaults to None
+ :type trashed_at: Optional[str], optional
+ :param purged_at: The time at which this file is expected to be purged
+ from the trash - becomes `null` after restore., defaults to None
+ :type purged_at: Optional[str], optional
+ :param content_created_at: The date and time at which this file was originally
+ created, which might be before it was uploaded to Box., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: The date and time at which this file was last updated,
+ which might be before it was uploaded to Box., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ :param shared_link: The shared link for this file. This will
+ be `null` if a file had been trashed, even though the original shared
+ link does become active again., defaults to None
+ :type shared_link: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.sequence_id = sequence_id
+ self.sha_1 = sha_1
+ self.description = description
+ self.size = size
+ self.path_collection = path_collection
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.modified_by = modified_by
+ self.owned_by = owned_by
+ self.item_status = item_status
+ self.etag = etag
+ self.type = type
+ self.name = name
+ self.file_version = file_version
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.content_created_at = content_created_at
+ self.content_modified_at = content_modified_at
+ self.created_by = created_by
+ self.shared_link = shared_link
+ self.parent = parent
diff --git a/box_sdk_gen/schemas/trash_folder.py b/box_sdk_gen/schemas/trash_folder.py
new file mode 100644
index 000000000..cffb89cd1
--- /dev/null
+++ b/box_sdk_gen/schemas/trash_folder.py
@@ -0,0 +1,188 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TrashFolderTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class TrashFolderPathCollectionEntriesTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class TrashFolderPathCollectionEntriesField(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[TrashFolderPathCollectionEntriesTypeField] = None,
+ id: Optional[str] = None,
+ sequence_id: Optional[str] = None,
+ etag: Optional[str] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `folder`., defaults to None
+ :type type: Optional[TrashFolderPathCollectionEntriesTypeField], optional
+ :param id: The unique identifier that represent a folder., defaults to None
+ :type id: Optional[str], optional
+ :param sequence_id: This field is null for the Trash folder., defaults to None
+ :type sequence_id: Optional[str], optional
+ :param etag: This field is null for the Trash folder., defaults to None
+ :type etag: Optional[str], optional
+ :param name: The name of the Trash folder., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.sequence_id = sequence_id
+ self.etag = etag
+ self.name = name
+
+
+class TrashFolderPathCollectionField(BaseObject):
+ def __init__(
+ self,
+ total_count: int,
+ 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[TrashFolderPathCollectionEntriesField]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class TrashFolderItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class TrashFolder(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ name: str,
+ description: str,
+ size: int,
+ path_collection: TrashFolderPathCollectionField,
+ created_by: UserMini,
+ modified_by: UserMini,
+ owned_by: UserMini,
+ item_status: TrashFolderItemStatusField,
+ *,
+ etag: Optional[str] = None,
+ type: TrashFolderTypeField = TrashFolderTypeField.FOLDER,
+ sequence_id: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ trashed_at: Optional[DateTime] = None,
+ purged_at: Optional[DateTime] = None,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ shared_link: Optional[str] = None,
+ folder_upload_email: Optional[str] = None,
+ parent: Optional[FolderMini] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a folder.
+
+ The ID for any folder can be determined
+ by visiting a folder in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/folders/123`
+ the `folder_id` is `123`.
+ :type id: str
+ :param name: The name of the folder.
+ :type name: str
+ :param size: The folder size in bytes.
+
+ Be careful parsing this integer as its
+ value can get very large.
+ :type size: int
+ :param item_status: Defines if this item has been deleted or not.
+
+ * `active` when the item has is not in the trash
+ * `trashed` when the item has been moved to the trash but not deleted
+ * `deleted` when the item has been permanently deleted.
+ :type item_status: TrashFolderItemStatusField
+ :param etag: The HTTP `etag` of this folder. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the folder if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `folder`., defaults to TrashFolderTypeField.FOLDER
+ :type type: TrashFolderTypeField, optional
+ :param created_at: The date and time when the folder was created. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The date and time when the folder was last updated. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param trashed_at: The time at which this folder was put in the trash., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param purged_at: The time at which this folder is expected to be purged
+ from the trash., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param content_created_at: The date and time at which this folder was originally
+ created., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: The date and time at which this folder was last updated., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ :param shared_link: The shared link for this folder. This will
+ be `null` if a folder has been trashed, since the link will no longer
+ be active., defaults to None
+ :type shared_link: Optional[str], optional
+ :param folder_upload_email: The folder upload email for this folder. This will
+ be `null` if a folder has been trashed, since the upload will no longer
+ work., defaults to None
+ :type folder_upload_email: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.name = name
+ self.description = description
+ self.size = size
+ self.path_collection = path_collection
+ self.created_by = created_by
+ self.modified_by = modified_by
+ self.owned_by = owned_by
+ self.item_status = item_status
+ self.etag = etag
+ self.type = type
+ self.sequence_id = sequence_id
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.content_created_at = content_created_at
+ self.content_modified_at = content_modified_at
+ self.shared_link = shared_link
+ self.folder_upload_email = folder_upload_email
+ self.parent = parent
diff --git a/box_sdk_gen/schemas/trash_folder_restored.py b/box_sdk_gen/schemas/trash_folder_restored.py
new file mode 100644
index 000000000..5fe75104a
--- /dev/null
+++ b/box_sdk_gen/schemas/trash_folder_restored.py
@@ -0,0 +1,147 @@
+from enum import Enum
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TrashFolderRestoredTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class TrashFolderRestoredPathCollectionField(BaseObject):
+ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs):
+ """
+ :param total_count: The number of folders in this list.
+ :type total_count: int
+ :param entries: The parent folders for this item.
+ :type entries: List[FolderMini]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class TrashFolderRestoredItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class TrashFolderRestored(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ etag: Optional[str] = None,
+ type: Optional[TrashFolderRestoredTypeField] = None,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ description: Optional[str] = None,
+ size: Optional[int] = None,
+ path_collection: Optional[TrashFolderRestoredPathCollectionField] = None,
+ created_by: Optional[UserMini] = None,
+ modified_by: Optional[UserMini] = None,
+ trashed_at: Optional[str] = None,
+ purged_at: Optional[str] = None,
+ content_created_at: Optional[DateTime] = None,
+ content_modified_at: Optional[DateTime] = None,
+ owned_by: Optional[UserMini] = None,
+ shared_link: Optional[str] = None,
+ folder_upload_email: Optional[str] = None,
+ parent: Optional[FolderMini] = None,
+ item_status: Optional[TrashFolderRestoredItemStatusField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a folder.
+
+ The ID for any folder can be determined
+ by visiting a folder in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/folders/123`
+ the `folder_id` is `123`., defaults to None
+ :type id: Optional[str], optional
+ :param etag: The HTTP `etag` of this folder. This can be used within some API
+ endpoints in the `If-Match` and `If-None-Match` headers to only
+ perform changes on the folder if (no) changes have happened., defaults to None
+ :type etag: Optional[str], optional
+ :param type: The value will always be `folder`., defaults to None
+ :type type: Optional[TrashFolderRestoredTypeField], optional
+ :param name: The name of the folder., defaults to None
+ :type name: Optional[str], optional
+ :param created_at: The date and time when the folder was created. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The date and time when the folder was last updated. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param size: The folder size in bytes.
+
+ Be careful parsing this integer as its
+ value can get very large., defaults to None
+ :type size: Optional[int], optional
+ :param trashed_at: The time at which this folder was put in the
+ trash - becomes `null` after restore., defaults to None
+ :type trashed_at: Optional[str], optional
+ :param purged_at: The time at which this folder is expected to be purged
+ from the trash - becomes `null` after restore., defaults to None
+ :type purged_at: Optional[str], optional
+ :param content_created_at: The date and time at which this folder was originally
+ created., defaults to None
+ :type content_created_at: Optional[DateTime], optional
+ :param content_modified_at: The date and time at which this folder was last updated., defaults to None
+ :type content_modified_at: Optional[DateTime], optional
+ :param shared_link: The shared link for this file. This will
+ be `null` if a folder had been trashed, even though the original shared
+ link does become active again., defaults to None
+ :type shared_link: Optional[str], optional
+ :param folder_upload_email: The folder upload email for this folder. This will
+ be `null` if a folder has been trashed, even though the original upload
+ email does become active again., defaults to None
+ :type folder_upload_email: Optional[str], optional
+ :param item_status: Defines if this item has been deleted or not.
+
+ * `active` when the item has is not in the trash,
+ * `trashed` when the item has been moved to the trash but not deleted,
+ * `deleted` when the item has been permanently deleted., defaults to None
+ :type item_status: Optional[TrashFolderRestoredItemStatusField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.etag = etag
+ self.type = type
+ self.sequence_id = sequence_id
+ self.name = name
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.description = description
+ self.size = size
+ self.path_collection = path_collection
+ self.created_by = created_by
+ self.modified_by = modified_by
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.content_created_at = content_created_at
+ self.content_modified_at = content_modified_at
+ self.owned_by = owned_by
+ self.shared_link = shared_link
+ self.folder_upload_email = folder_upload_email
+ self.parent = parent
+ self.item_status = item_status
diff --git a/box_sdk_gen/schemas/trash_web_link.py b/box_sdk_gen/schemas/trash_web_link.py
new file mode 100644
index 000000000..5e807b2b7
--- /dev/null
+++ b/box_sdk_gen/schemas/trash_web_link.py
@@ -0,0 +1,160 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TrashWebLinkTypeField(str, Enum):
+ WEB_LINK = 'web_link'
+
+
+class TrashWebLinkPathCollectionEntriesTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class TrashWebLinkPathCollectionEntriesField(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[TrashWebLinkPathCollectionEntriesTypeField] = None,
+ id: Optional[str] = None,
+ sequence_id: Optional[str] = None,
+ etag: Optional[str] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `folder`., defaults to None
+ :type type: Optional[TrashWebLinkPathCollectionEntriesTypeField], optional
+ :param id: The unique identifier that represent a folder., defaults to None
+ :type id: Optional[str], optional
+ :param sequence_id: This field is null for the Trash folder., defaults to None
+ :type sequence_id: Optional[str], optional
+ :param etag: This field is null for the Trash folder., defaults to None
+ :type etag: Optional[str], optional
+ :param name: The name of the Trash folder., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.sequence_id = sequence_id
+ self.etag = etag
+ self.name = name
+
+
+class TrashWebLinkPathCollectionField(BaseObject):
+ def __init__(
+ self,
+ total_count: int,
+ 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[TrashWebLinkPathCollectionEntriesField]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class TrashWebLinkItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class TrashWebLink(BaseObject):
+ _discriminator = 'type', {'web_link'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[TrashWebLinkTypeField] = None,
+ id: Optional[str] = None,
+ sequence_id: Optional[str] = None,
+ etag: Optional[str] = None,
+ name: Optional[str] = None,
+ url: Optional[str] = None,
+ parent: Optional[FolderMini] = None,
+ description: Optional[str] = None,
+ path_collection: Optional[TrashWebLinkPathCollectionField] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ trashed_at: Optional[DateTime] = None,
+ purged_at: Optional[DateTime] = None,
+ created_by: Optional[UserMini] = None,
+ modified_by: Optional[UserMini] = None,
+ owned_by: Optional[UserMini] = None,
+ shared_link: Optional[str] = None,
+ item_status: Optional[TrashWebLinkItemStatusField] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `web_link`., defaults to None
+ :type type: Optional[TrashWebLinkTypeField], optional
+ :param id: The unique identifier for this web link., defaults to None
+ :type id: Optional[str], optional
+ :param etag: The entity tag of this web link. Used with `If-Match`
+ headers., defaults to None
+ :type etag: Optional[str], optional
+ :param name: The name of the web link., defaults to None
+ :type name: Optional[str], optional
+ :param url: The URL this web link points to., defaults to None
+ :type url: Optional[str], optional
+ :param description: The description accompanying the web link. This is
+ visible within the Box web application., defaults to None
+ :type description: Optional[str], optional
+ :param created_at: When this file was created on Box’s servers., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When this file was last updated on the Box
+ servers., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param trashed_at: When this file was last moved to the trash., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param purged_at: When this file will be permanently deleted., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param shared_link: The shared link for this bookmark. This will
+ be `null` if a bookmark has been trashed, since the link will no longer
+ be active., defaults to None
+ :type shared_link: Optional[str], optional
+ :param item_status: Whether this item is deleted or not. Values include `active`,
+ `trashed` if the file has been moved to the trash, and `deleted` if
+ the file has been permanently deleted., defaults to None
+ :type item_status: Optional[TrashWebLinkItemStatusField], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.sequence_id = sequence_id
+ self.etag = etag
+ self.name = name
+ self.url = url
+ self.parent = parent
+ self.description = description
+ self.path_collection = path_collection
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.created_by = created_by
+ self.modified_by = modified_by
+ self.owned_by = owned_by
+ self.shared_link = shared_link
+ self.item_status = item_status
diff --git a/box_sdk_gen/schemas/trash_web_link_restored.py b/box_sdk_gen/schemas/trash_web_link_restored.py
new file mode 100644
index 000000000..e2f033968
--- /dev/null
+++ b/box_sdk_gen/schemas/trash_web_link_restored.py
@@ -0,0 +1,120 @@
+from enum import Enum
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class TrashWebLinkRestoredTypeField(str, Enum):
+ WEB_LINK = 'web_link'
+
+
+class TrashWebLinkRestoredPathCollectionField(BaseObject):
+ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs):
+ """
+ :param total_count: The number of folders in this list.
+ :type total_count: int
+ :param entries: The parent folders for this item.
+ :type entries: List[FolderMini]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class TrashWebLinkRestoredItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class TrashWebLinkRestored(BaseObject):
+ _discriminator = 'type', {'web_link'}
+
+ def __init__(
+ self,
+ sequence_id: str,
+ path_collection: TrashWebLinkRestoredPathCollectionField,
+ *,
+ type: Optional[TrashWebLinkRestoredTypeField] = None,
+ id: Optional[str] = None,
+ etag: Optional[str] = None,
+ name: Optional[str] = None,
+ url: Optional[str] = None,
+ parent: Optional[FolderMini] = None,
+ description: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ trashed_at: Optional[str] = None,
+ purged_at: Optional[str] = None,
+ created_by: Optional[UserMini] = None,
+ modified_by: Optional[UserMini] = None,
+ owned_by: Optional[UserMini] = None,
+ shared_link: Optional[str] = None,
+ item_status: Optional[TrashWebLinkRestoredItemStatusField] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `web_link`., defaults to None
+ :type type: Optional[TrashWebLinkRestoredTypeField], optional
+ :param id: The unique identifier for this web link., defaults to None
+ :type id: Optional[str], optional
+ :param etag: The entity tag of this web link. Used with `If-Match`
+ headers., defaults to None
+ :type etag: Optional[str], optional
+ :param name: The name of the web link., defaults to None
+ :type name: Optional[str], optional
+ :param url: The URL this web link points to., defaults to None
+ :type url: Optional[str], optional
+ :param description: The description accompanying the web link. This is
+ visible within the Box web application., defaults to None
+ :type description: Optional[str], optional
+ :param created_at: When this file was created on Box’s servers., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When this file was last updated on the Box
+ servers., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param trashed_at: The time at which this bookmark was put in the
+ trash - becomes `null` after restore., defaults to None
+ :type trashed_at: Optional[str], optional
+ :param purged_at: The time at which this bookmark will be permanently
+ deleted - becomes `null` after restore., defaults to None
+ :type purged_at: Optional[str], optional
+ :param shared_link: The shared link for this bookmark. This will
+ be `null` if a bookmark had been trashed, even though the original shared
+ link does become active again., defaults to None
+ :type shared_link: Optional[str], optional
+ :param item_status: Whether this item is deleted or not. Values include `active`,
+ `trashed` if the file has been moved to the trash, and `deleted` if
+ the file has been permanently deleted., defaults to None
+ :type item_status: Optional[TrashWebLinkRestoredItemStatusField], optional
+ """
+ super().__init__(**kwargs)
+ self.sequence_id = sequence_id
+ self.path_collection = path_collection
+ self.type = type
+ self.id = id
+ self.etag = etag
+ self.name = name
+ self.url = url
+ self.parent = parent
+ self.description = description
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.created_by = created_by
+ self.modified_by = modified_by
+ self.owned_by = owned_by
+ self.shared_link = shared_link
+ self.item_status = item_status
diff --git a/box_sdk_gen/schemas/upload_part.py b/box_sdk_gen/schemas/upload_part.py
new file mode 100644
index 000000000..b9bef8b1d
--- /dev/null
+++ b/box_sdk_gen/schemas/upload_part.py
@@ -0,0 +1,42 @@
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.schemas.upload_part_mini import UploadPartMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UploadPart(UploadPartMini):
+ _fields_to_json_mapping: Dict[str, str] = {
+ 'sha_1': 'sha1',
+ **UploadPartMini._fields_to_json_mapping,
+ }
+ _json_to_fields_mapping: Dict[str, str] = {
+ 'sha1': 'sha_1',
+ **UploadPartMini._json_to_fields_mapping,
+ }
+
+ def __init__(
+ self,
+ *,
+ sha_1: Optional[str] = None,
+ part_id: Optional[str] = None,
+ offset: Optional[int] = None,
+ size: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param sha_1: The SHA1 hash of the chunk., defaults to None
+ :type sha_1: Optional[str], optional
+ :param part_id: The unique ID of the chunk., defaults to None
+ :type part_id: Optional[str], optional
+ :param offset: The offset of the chunk within the file
+ in bytes. The lower bound of the position
+ of the chunk within the file., defaults to None
+ :type offset: Optional[int], optional
+ :param size: The size of the chunk in bytes., defaults to None
+ :type size: Optional[int], optional
+ """
+ super().__init__(part_id=part_id, offset=offset, size=size, **kwargs)
+ self.sha_1 = sha_1
diff --git a/box_sdk_gen/schemas/upload_part_mini.py b/box_sdk_gen/schemas/upload_part_mini.py
new file mode 100644
index 000000000..70c511ca4
--- /dev/null
+++ b/box_sdk_gen/schemas/upload_part_mini.py
@@ -0,0 +1,30 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UploadPartMini(BaseObject):
+ def __init__(
+ self,
+ *,
+ part_id: Optional[str] = None,
+ offset: Optional[int] = None,
+ size: Optional[int] = None,
+ **kwargs
+ ):
+ """
+ :param part_id: The unique ID of the chunk., defaults to None
+ :type part_id: Optional[str], optional
+ :param offset: The offset of the chunk within the file
+ in bytes. The lower bound of the position
+ of the chunk within the file., defaults to None
+ :type offset: Optional[int], optional
+ :param size: The size of the chunk in bytes., defaults to None
+ :type size: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.part_id = part_id
+ self.offset = offset
+ self.size = size
diff --git a/box_sdk_gen/schemas/upload_parts.py b/box_sdk_gen/schemas/upload_parts.py
new file mode 100644
index 000000000..34c7e69a6
--- /dev/null
+++ b/box_sdk_gen/schemas/upload_parts.py
@@ -0,0 +1,81 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.upload_part import UploadPart
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UploadPartsOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class UploadPartsOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[UploadPartsOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[UploadPartsOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class UploadParts(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_count: Optional[int] = None,
+ limit: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[UploadPartsOrderField]] = None,
+ entries: Optional[List[UploadPart]] = None,
+ **kwargs
+ ):
+ """
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[UploadPartsOrderField]], optional
+ :param entries: A list of uploaded chunks for an upload
+ session., defaults to None
+ :type entries: Optional[List[UploadPart]], optional
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.limit = limit
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/upload_session.py b/box_sdk_gen/schemas/upload_session.py
new file mode 100644
index 000000000..be0806203
--- /dev/null
+++ b/box_sdk_gen/schemas/upload_session.py
@@ -0,0 +1,95 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class UploadSessionTypeField(str, Enum):
+ UPLOAD_SESSION = 'upload_session'
+
+
+class UploadSessionSessionEndpointsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ upload_part: Optional[str] = None,
+ commit: Optional[str] = None,
+ abort: Optional[str] = None,
+ list_parts: Optional[str] = None,
+ status: Optional[str] = None,
+ log_event: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param upload_part: The URL to upload parts to., defaults to None
+ :type upload_part: Optional[str], optional
+ :param commit: The URL used to commit the file., defaults to None
+ :type commit: Optional[str], optional
+ :param abort: The URL for used to abort the session., defaults to None
+ :type abort: Optional[str], optional
+ :param list_parts: The URL users to list all parts., defaults to None
+ :type list_parts: Optional[str], optional
+ :param status: The URL used to get the status of the upload., defaults to None
+ :type status: Optional[str], optional
+ :param log_event: The URL used to get the upload log from., defaults to None
+ :type log_event: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.upload_part = upload_part
+ self.commit = commit
+ self.abort = abort
+ self.list_parts = list_parts
+ self.status = status
+ self.log_event = log_event
+
+
+class UploadSession(BaseObject):
+ _discriminator = 'type', {'upload_session'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[UploadSessionTypeField] = None,
+ session_expires_at: Optional[DateTime] = None,
+ part_size: Optional[int] = None,
+ total_parts: Optional[int] = None,
+ num_parts_processed: Optional[int] = None,
+ session_endpoints: Optional[UploadSessionSessionEndpointsField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this session., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `upload_session`., defaults to None
+ :type type: Optional[UploadSessionTypeField], optional
+ :param session_expires_at: The date and time when this session expires., defaults to None
+ :type session_expires_at: Optional[DateTime], optional
+ :param part_size: The size in bytes that must be used for all parts of of the
+ upload.
+
+ Only the last part is allowed to be of a smaller size., defaults to None
+ :type part_size: Optional[int], optional
+ :param total_parts: The total number of parts expected in this upload session,
+ as determined by the file size and part size., defaults to None
+ :type total_parts: Optional[int], optional
+ :param num_parts_processed: The number of parts that have been uploaded and processed
+ by the server. This starts at `0`.
+
+ When committing a file files, inspecting this property can
+ provide insight if all parts have been uploaded correctly., defaults to None
+ :type num_parts_processed: Optional[int], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.session_expires_at = session_expires_at
+ self.part_size = part_size
+ self.total_parts = total_parts
+ self.num_parts_processed = num_parts_processed
+ self.session_endpoints = session_endpoints
diff --git a/box_sdk_gen/schemas/upload_url.py b/box_sdk_gen/schemas/upload_url.py
new file mode 100644
index 000000000..16ebe3b82
--- /dev/null
+++ b/box_sdk_gen/schemas/upload_url.py
@@ -0,0 +1,25 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UploadUrl(BaseObject):
+ def __init__(
+ self,
+ *,
+ upload_url: Optional[str] = None,
+ upload_token: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param upload_url: A URL for an upload session that can be used to upload
+ the file., defaults to None
+ :type upload_url: Optional[str], optional
+ :param upload_token: An optional access token to use to upload the file., defaults to None
+ :type upload_token: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.upload_url = upload_url
+ self.upload_token = upload_token
diff --git a/box_sdk_gen/schemas/uploaded_part.py b/box_sdk_gen/schemas/uploaded_part.py
new file mode 100644
index 000000000..e8d1fa273
--- /dev/null
+++ b/box_sdk_gen/schemas/uploaded_part.py
@@ -0,0 +1,13 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.upload_part import UploadPart
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UploadedPart(BaseObject):
+ def __init__(self, *, part: Optional[UploadPart] = None, **kwargs):
+ super().__init__(**kwargs)
+ self.part = part
diff --git a/box_sdk_gen/schemas/user.py b/box_sdk_gen/schemas/user.py
new file mode 100644
index 000000000..58eb548fc
--- /dev/null
+++ b/box_sdk_gen/schemas/user.py
@@ -0,0 +1,120 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.user_base import UserBaseTypeField
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class UserStatusField(str, Enum):
+ ACTIVE = 'active'
+ INACTIVE = 'inactive'
+ CANNOT_DELETE_EDIT = 'cannot_delete_edit'
+ CANNOT_DELETE_EDIT_UPLOAD = 'cannot_delete_edit_upload'
+
+
+class UserNotificationEmailField(BaseObject):
+ def __init__(
+ self,
+ *,
+ email: Optional[str] = None,
+ is_confirmed: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param email: The email address to send the notifications to., defaults to None
+ :type email: Optional[str], optional
+ :param is_confirmed: Specifies if this email address has been confirmed., defaults to None
+ :type is_confirmed: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.email = email
+ self.is_confirmed = is_confirmed
+
+
+class User(UserMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ language: Optional[str] = None,
+ timezone: Optional[str] = None,
+ space_amount: Optional[int] = None,
+ space_used: Optional[int] = None,
+ max_upload_size: Optional[int] = None,
+ status: Optional[UserStatusField] = None,
+ job_title: Optional[str] = None,
+ phone: Optional[str] = None,
+ address: Optional[str] = None,
+ avatar_url: Optional[str] = None,
+ notification_email: Optional[UserNotificationEmailField] = None,
+ name: Optional[str] = None,
+ login: Optional[str] = None,
+ type: UserBaseTypeField = UserBaseTypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param created_at: When the user object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the user object was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param language: The language of the user, formatted in modified version of the
+ [ISO 639-1](/guides/api-calls/language-codes) format., defaults to None
+ :type language: Optional[str], optional
+ :param timezone: The user's timezone., defaults to None
+ :type timezone: Optional[str], optional
+ :param space_amount: The user’s total available space amount in bytes., defaults to None
+ :type space_amount: Optional[int], optional
+ :param space_used: The amount of space in use by the user., defaults to None
+ :type space_used: Optional[int], optional
+ :param max_upload_size: The maximum individual file size in bytes the user can have., defaults to None
+ :type max_upload_size: Optional[int], optional
+ :param status: The user's account status., defaults to None
+ :type status: Optional[UserStatusField], optional
+ :param job_title: The user’s job title., defaults to None
+ :type job_title: Optional[str], optional
+ :param phone: The user’s phone number., defaults to None
+ :type phone: Optional[str], optional
+ :param address: The user’s address., defaults to None
+ :type address: Optional[str], optional
+ :param avatar_url: URL of the user’s avatar image., defaults to None
+ :type avatar_url: Optional[str], optional
+ :param notification_email: An alternate notification email address to which email
+ notifications are sent. When it's confirmed, this will be
+ the email address to which notifications are sent instead of
+ to the primary email address., defaults to None
+ :type notification_email: Optional[UserNotificationEmailField], optional
+ :param name: The display name of this user., defaults to None
+ :type name: Optional[str], optional
+ :param login: The primary email address of this user., defaults to None
+ :type login: Optional[str], optional
+ :param type: The value will always be `user`., defaults to UserBaseTypeField.USER
+ :type type: UserBaseTypeField, optional
+ """
+ super().__init__(id=id, name=name, login=login, type=type, **kwargs)
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.language = language
+ self.timezone = timezone
+ self.space_amount = space_amount
+ self.space_used = space_used
+ self.max_upload_size = max_upload_size
+ self.status = status
+ self.job_title = job_title
+ self.phone = phone
+ self.address = address
+ self.avatar_url = avatar_url
+ self.notification_email = notification_email
diff --git a/box_sdk_gen/schemas/user_avatar.py b/box_sdk_gen/schemas/user_avatar.py
new file mode 100644
index 000000000..c13545ec1
--- /dev/null
+++ b/box_sdk_gen/schemas/user_avatar.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UserAvatarPicUrlsField(BaseObject):
+ def __init__(
+ self,
+ *,
+ small: Optional[str] = None,
+ large: Optional[str] = None,
+ preview: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param small: The location of a small-sized avatar., defaults to None
+ :type small: Optional[str], optional
+ :param large: The location of a large-sized avatar., defaults to None
+ :type large: Optional[str], optional
+ :param preview: The location of the avatar preview., defaults to None
+ :type preview: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.small = small
+ self.large = large
+ self.preview = preview
+
+
+class UserAvatar(BaseObject):
+ def __init__(self, *, pic_urls: Optional[UserAvatarPicUrlsField] = None, **kwargs):
+ """
+ :param pic_urls: Represents an object with user avatar URLs., defaults to None
+ :type pic_urls: Optional[UserAvatarPicUrlsField], optional
+ """
+ super().__init__(**kwargs)
+ self.pic_urls = pic_urls
diff --git a/box_sdk_gen/schemas/user_base.py b/box_sdk_gen/schemas/user_base.py
new file mode 100644
index 000000000..a4aefecb8
--- /dev/null
+++ b/box_sdk_gen/schemas/user_base.py
@@ -0,0 +1,26 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UserBaseTypeField(str, Enum):
+ USER = 'user'
+
+
+class UserBase(BaseObject):
+ _discriminator = 'type', {'user'}
+
+ def __init__(
+ self, id: str, *, type: UserBaseTypeField = UserBaseTypeField.USER, **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param type: The value will always be `user`., defaults to UserBaseTypeField.USER
+ :type type: UserBaseTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/user_collaborations.py b/box_sdk_gen/schemas/user_collaborations.py
new file mode 100644
index 000000000..848ce5974
--- /dev/null
+++ b/box_sdk_gen/schemas/user_collaborations.py
@@ -0,0 +1,36 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.user_base import UserBaseTypeField
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UserCollaborations(UserBase):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ login: Optional[str] = None,
+ is_active: Optional[bool] = None,
+ type: UserBaseTypeField = UserBaseTypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param name: The display name of this user. If the collaboration status is `pending`, an empty string is returned., defaults to None
+ :type name: Optional[str], optional
+ :param login: The primary email address of this user. If the collaboration status is `pending`, an empty string is returned., defaults to None
+ :type login: Optional[str], optional
+ :param is_active: If set to `false`, the user is either deactivated or deleted., defaults to None
+ :type is_active: Optional[bool], optional
+ :param type: The value will always be `user`., defaults to UserBaseTypeField.USER
+ :type type: UserBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.name = name
+ self.login = login
+ self.is_active = is_active
diff --git a/box_sdk_gen/schemas/user_full.py b/box_sdk_gen/schemas/user_full.py
new file mode 100644
index 000000000..b35ae441f
--- /dev/null
+++ b/box_sdk_gen/schemas/user_full.py
@@ -0,0 +1,199 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.user_base import UserBaseTypeField
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.internal.utils import DateTime
+
+from box_sdk_gen.schemas.user import UserStatusField
+
+from box_sdk_gen.schemas.user import UserNotificationEmailField
+
+from box_sdk_gen.schemas.user import User
+
+from box_sdk_gen.schemas.tracking_code import TrackingCode
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UserFullRoleField(str, Enum):
+ ADMIN = 'admin'
+ COADMIN = 'coadmin'
+ USER = 'user'
+
+
+class UserFullEnterpriseTypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class UserFullEnterpriseField(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[UserFullEnterpriseTypeField] = None,
+ name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[UserFullEnterpriseTypeField], optional
+ :param name: The name of the enterprise., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+
+
+class UserFull(User):
+ def __init__(
+ self,
+ id: str,
+ *,
+ role: Optional[UserFullRoleField] = None,
+ tracking_codes: Optional[List[TrackingCode]] = None,
+ can_see_managed_users: Optional[bool] = None,
+ is_sync_enabled: Optional[bool] = None,
+ is_external_collab_restricted: Optional[bool] = None,
+ is_exempt_from_device_limits: Optional[bool] = None,
+ is_exempt_from_login_verification: Optional[bool] = None,
+ enterprise: Optional[UserFullEnterpriseField] = None,
+ my_tags: Optional[List[str]] = None,
+ hostname: Optional[str] = None,
+ is_platform_access_only: Optional[bool] = None,
+ external_app_user_id: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ language: Optional[str] = None,
+ timezone: Optional[str] = None,
+ space_amount: Optional[int] = None,
+ space_used: Optional[int] = None,
+ max_upload_size: Optional[int] = None,
+ status: Optional[UserStatusField] = None,
+ job_title: Optional[str] = None,
+ phone: Optional[str] = None,
+ address: Optional[str] = None,
+ avatar_url: Optional[str] = None,
+ notification_email: Optional[UserNotificationEmailField] = None,
+ name: Optional[str] = None,
+ login: Optional[str] = None,
+ type: UserBaseTypeField = UserBaseTypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param role: The user’s enterprise role., defaults to None
+ :type role: Optional[UserFullRoleField], optional
+ :param tracking_codes: Tracking codes allow an admin to generate reports from the
+ admin console and assign an attribute to a specific group
+ of users. This setting must be enabled for an enterprise
+ before it can be used., defaults to None
+ :type tracking_codes: Optional[List[TrackingCode]], optional
+ :param can_see_managed_users: Whether the user can see other enterprise users in their contact list., defaults to None
+ :type can_see_managed_users: Optional[bool], optional
+ :param is_sync_enabled: Whether the user can use Box Sync., defaults to None
+ :type is_sync_enabled: Optional[bool], optional
+ :param is_external_collab_restricted: Whether the user is allowed to collaborate with users outside their
+ enterprise., defaults to None
+ :type is_external_collab_restricted: Optional[bool], optional
+ :param is_exempt_from_device_limits: Whether to exempt the user from Enterprise device limits., defaults to None
+ :type is_exempt_from_device_limits: Optional[bool], optional
+ :param is_exempt_from_login_verification: Whether the user must use two-factor authentication., defaults to None
+ :type is_exempt_from_login_verification: Optional[bool], optional
+ :param my_tags: Tags for all files and folders owned by the user. Values returned
+ will only contain tags that were set by the requester., defaults to None
+ :type my_tags: Optional[List[str]], optional
+ :param hostname: The root (protocol, subdomain, domain) of any links that need to be
+ generated for the user., defaults to None
+ :type hostname: Optional[str], optional
+ :param is_platform_access_only: Whether the user is an App User., defaults to None
+ :type is_platform_access_only: Optional[bool], 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., defaults to None
+ :type external_app_user_id: Optional[str], optional
+ :param created_at: When the user object was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When the user object was last modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param language: The language of the user, formatted in modified version of the
+ [ISO 639-1](/guides/api-calls/language-codes) format., defaults to None
+ :type language: Optional[str], optional
+ :param timezone: The user's timezone., defaults to None
+ :type timezone: Optional[str], optional
+ :param space_amount: The user’s total available space amount in bytes., defaults to None
+ :type space_amount: Optional[int], optional
+ :param space_used: The amount of space in use by the user., defaults to None
+ :type space_used: Optional[int], optional
+ :param max_upload_size: The maximum individual file size in bytes the user can have., defaults to None
+ :type max_upload_size: Optional[int], optional
+ :param status: The user's account status., defaults to None
+ :type status: Optional[UserStatusField], optional
+ :param job_title: The user’s job title., defaults to None
+ :type job_title: Optional[str], optional
+ :param phone: The user’s phone number., defaults to None
+ :type phone: Optional[str], optional
+ :param address: The user’s address., defaults to None
+ :type address: Optional[str], optional
+ :param avatar_url: URL of the user’s avatar image., defaults to None
+ :type avatar_url: Optional[str], optional
+ :param notification_email: An alternate notification email address to which email
+ notifications are sent. When it's confirmed, this will be
+ the email address to which notifications are sent instead of
+ to the primary email address., defaults to None
+ :type notification_email: Optional[UserNotificationEmailField], optional
+ :param name: The display name of this user., defaults to None
+ :type name: Optional[str], optional
+ :param login: The primary email address of this user., defaults to None
+ :type login: Optional[str], optional
+ :param type: The value will always be `user`., defaults to UserBaseTypeField.USER
+ :type type: UserBaseTypeField, optional
+ """
+ super().__init__(
+ id=id,
+ created_at=created_at,
+ modified_at=modified_at,
+ language=language,
+ timezone=timezone,
+ space_amount=space_amount,
+ space_used=space_used,
+ max_upload_size=max_upload_size,
+ status=status,
+ job_title=job_title,
+ phone=phone,
+ address=address,
+ avatar_url=avatar_url,
+ notification_email=notification_email,
+ name=name,
+ login=login,
+ type=type,
+ **kwargs
+ )
+ self.role = role
+ self.tracking_codes = tracking_codes
+ self.can_see_managed_users = can_see_managed_users
+ self.is_sync_enabled = is_sync_enabled
+ self.is_external_collab_restricted = is_external_collab_restricted
+ self.is_exempt_from_device_limits = is_exempt_from_device_limits
+ self.is_exempt_from_login_verification = is_exempt_from_login_verification
+ self.enterprise = enterprise
+ self.my_tags = my_tags
+ self.hostname = hostname
+ self.is_platform_access_only = is_platform_access_only
+ self.external_app_user_id = external_app_user_id
diff --git a/box_sdk_gen/schemas/user_integration_mappings.py b/box_sdk_gen/schemas/user_integration_mappings.py
new file mode 100644
index 000000000..8e14d80f5
--- /dev/null
+++ b/box_sdk_gen/schemas/user_integration_mappings.py
@@ -0,0 +1,32 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.user_base import UserBaseTypeField
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UserIntegrationMappings(UserBase):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ login: Optional[str] = None,
+ type: UserBaseTypeField = UserBaseTypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param name: The display name of this user., defaults to None
+ :type name: Optional[str], optional
+ :param login: The primary email address of this user., defaults to None
+ :type login: Optional[str], optional
+ :param type: The value will always be `user`., defaults to UserBaseTypeField.USER
+ :type type: UserBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.name = name
+ self.login = login
diff --git a/box_sdk_gen/schemas/user_mini.py b/box_sdk_gen/schemas/user_mini.py
new file mode 100644
index 000000000..e53d185b7
--- /dev/null
+++ b/box_sdk_gen/schemas/user_mini.py
@@ -0,0 +1,32 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.user_base import UserBaseTypeField
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UserMini(UserBase):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ login: Optional[str] = None,
+ type: UserBaseTypeField = UserBaseTypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param name: The display name of this user., defaults to None
+ :type name: Optional[str], optional
+ :param login: The primary email address of this user., defaults to None
+ :type login: Optional[str], optional
+ :param type: The value will always be `user`., defaults to UserBaseTypeField.USER
+ :type type: UserBaseTypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.name = name
+ self.login = login
diff --git a/box_sdk_gen/schemas/users.py b/box_sdk_gen/schemas/users.py
new file mode 100644
index 000000000..81c8d6d82
--- /dev/null
+++ b/box_sdk_gen/schemas/users.py
@@ -0,0 +1,88 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.user_full import UserFull
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UsersOrderDirectionField(str, Enum):
+ ASC = 'ASC'
+ DESC = 'DESC'
+
+
+class UsersOrderField(BaseObject):
+ def __init__(
+ self,
+ *,
+ by: Optional[str] = None,
+ direction: Optional[UsersOrderDirectionField] = None,
+ **kwargs
+ ):
+ """
+ :param by: The field to order by., defaults to None
+ :type by: Optional[str], optional
+ :param direction: The direction to order by, either ascending or descending., defaults to None
+ :type direction: Optional[UsersOrderDirectionField], optional
+ """
+ super().__init__(**kwargs)
+ self.by = by
+ self.direction = direction
+
+
+class Users(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ total_count: Optional[int] = None,
+ offset: Optional[int] = None,
+ order: Optional[List[UsersOrderField]] = None,
+ entries: Optional[List[UserFull]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param total_count: One greater than the offset of the last entry in the entire collection.
+ The total number of entries in the collection may be less than
+ `total_count`.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type total_count: Optional[int], optional
+ :param offset: The 0-based offset of the first entry in this set. This will be the same
+ as the `offset` query parameter.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type offset: Optional[int], optional
+ :param order: The order by which items are returned.
+
+ This field is only returned for calls that use offset-based pagination.
+ For marker-based paginated APIs, this field will be omitted., defaults to None
+ :type order: Optional[List[UsersOrderField]], optional
+ :param entries: A list of users., defaults to None
+ :type entries: Optional[List[UserFull]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.total_count = total_count
+ self.offset = offset
+ self.order = order
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/v2025_r0/__init__.py b/box_sdk_gen/schemas/v2025_r0/__init__.py
new file mode 100644
index 000000000..cd0c28ba6
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/__init__.py
@@ -0,0 +1,119 @@
+from box_sdk_gen.schemas.v2025_r0.archive_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.archives_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_batch_base_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_document_generation_data_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_base_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_tag_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_tags_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_tags_processing_message_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.enterprise_reference_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_template_create_request_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_template_base_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_template_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_templates_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.file_version_base_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_jobs_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_batch_create_request_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.folder_reference_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.group_base_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.group_mini_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_base_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_action_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_create_request_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_update_request_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_copy_request_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_create_request_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_items_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_update_request_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_mini_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_lists_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_integration_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_request_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_lists_update_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_lists_create_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.terms_of_service_base_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.user_base_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.user_mini_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hubs_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_user_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_access_grantee_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaborations_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_full_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_jobs_full_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.weblink_reference_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_reference_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_operation_result_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_items_manage_response_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_operation_v2025_r0 import *
+
+from box_sdk_gen.schemas.v2025_r0.hub_items_manage_request_v2025_r0 import *
diff --git a/box_sdk_gen/schemas/v2025_r0/archive_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/archive_v2025_r0.py
new file mode 100644
index 000000000..4c65dafba
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/archive_v2025_r0.py
@@ -0,0 +1,43 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ArchiveV2025R0TypeField(str, Enum):
+ ARCHIVE = 'archive'
+
+
+class ArchiveV2025R0(BaseObject):
+ _discriminator = 'type', {'archive'}
+
+ def __init__(
+ self,
+ id: str,
+ name: str,
+ size: int,
+ *,
+ type: ArchiveV2025R0TypeField = ArchiveV2025R0TypeField.ARCHIVE,
+ **kwargs
+ ):
+ r"""
+ :param id: The unique identifier that represents an archive.
+ :type id: str
+ :param name: The name of the archive.
+
+ The following restrictions to the archive name apply: names containing
+ non-printable ASCII characters, forward and backward slashes
+ (`/`, `\`), names with trailing spaces, and names `.` and `..` are
+ not allowed.
+ :type name: str
+ :param size: The size of the archive in bytes.
+ :type size: int
+ :param type: The value will always be `archive`., defaults to ArchiveV2025R0TypeField.ARCHIVE
+ :type type: ArchiveV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.name = name
+ self.size = size
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/archives_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/archives_v2025_r0.py
new file mode 100644
index 000000000..95c1b67ab
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/archives_v2025_r0.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.archive_v2025_r0 import ArchiveV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ArchivesV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[ArchiveV2025R0]] = None,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list in which each entry represents an archive object., defaults to None
+ :type entries: Optional[List[ArchiveV2025R0]], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
diff --git a/box_sdk_gen/schemas/v2025_r0/client_error_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/client_error_v2025_r0.py
new file mode 100644
index 000000000..f081211dd
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/client_error_v2025_r0.py
@@ -0,0 +1,77 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ClientErrorV2025R0TypeField(str, Enum):
+ ERROR = 'error'
+
+
+class ClientErrorV2025R0CodeField(str, Enum):
+ CREATED = 'created'
+ ACCEPTED = 'accepted'
+ NO_CONTENT = 'no_content'
+ REDIRECT = 'redirect'
+ NOT_MODIFIED = 'not_modified'
+ BAD_REQUEST = 'bad_request'
+ UNAUTHORIZED = 'unauthorized'
+ FORBIDDEN = 'forbidden'
+ NOT_FOUND = 'not_found'
+ METHOD_NOT_ALLOWED = 'method_not_allowed'
+ CONFLICT = 'conflict'
+ PRECONDITION_FAILED = 'precondition_failed'
+ TOO_MANY_REQUESTS = 'too_many_requests'
+ INTERNAL_SERVER_ERROR = 'internal_server_error'
+ UNAVAILABLE = 'unavailable'
+ ITEM_NAME_INVALID = 'item_name_invalid'
+ INSUFFICIENT_SCOPE = 'insufficient_scope'
+
+
+class ClientErrorV2025R0(BaseObject):
+ _discriminator = 'type', {'error'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[ClientErrorV2025R0TypeField] = None,
+ status: Optional[int] = None,
+ code: Optional[ClientErrorV2025R0CodeField] = None,
+ message: Optional[str] = None,
+ context_info: Optional[Dict] = None,
+ help_url: Optional[str] = None,
+ request_id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The value will always be `error`., defaults to None
+ :type type: Optional[ClientErrorV2025R0TypeField], optional
+ :param status: The HTTP status of the response., defaults to None
+ :type status: Optional[int], optional
+ :param code: A Box-specific error code., defaults to None
+ :type code: Optional[ClientErrorV2025R0CodeField], optional
+ :param message: A short message describing the error., defaults to None
+ :type message: Optional[str], optional
+ :param context_info: A free-form object that contains additional context
+ about the error. The possible fields are defined on
+ a per-endpoint basis. `message` is only one example., defaults to None
+ :type context_info: Optional[Dict], optional
+ :param help_url: A URL that links to more information about why this error occurred., defaults to None
+ :type help_url: Optional[str], optional
+ :param request_id: A unique identifier for this response, which can be used
+ when contacting Box support., defaults to None
+ :type request_id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.status = status
+ self.code = code
+ self.message = message
+ self.context_info = context_info
+ self.help_url = help_url
+ self.request_id = request_id
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_batch_base_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_batch_base_v2025_r0.py
new file mode 100644
index 000000000..ff82b370a
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_batch_base_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenBatchBaseV2025R0TypeField(str, Enum):
+ DOCGEN_BATCH = 'docgen_batch'
+
+
+class DocGenBatchBaseV2025R0(BaseObject):
+ _discriminator = 'type', {'docgen_batch'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: DocGenBatchBaseV2025R0TypeField = DocGenBatchBaseV2025R0TypeField.DOCGEN_BATCH,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represents a Box Doc Gen batch.
+ :type id: str
+ :param type: The value will always be `docgen_batch`., defaults to DocGenBatchBaseV2025R0TypeField.DOCGEN_BATCH
+ :type type: DocGenBatchBaseV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_batch_create_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_batch_create_request_v2025_r0.py
new file mode 100644
index 000000000..391291724
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_batch_create_request_v2025_r0.py
@@ -0,0 +1,71 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.file_version_base_v2025_r0 import (
+ FileVersionBaseV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_document_generation_data_v2025_r0 import (
+ DocGenDocumentGenerationDataV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenBatchCreateRequestV2025R0DestinationFolderTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class DocGenBatchCreateRequestV2025R0DestinationFolderField(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: DocGenBatchCreateRequestV2025R0DestinationFolderTypeField = DocGenBatchCreateRequestV2025R0DestinationFolderTypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: ID of the folder.
+ :type id: str
+ :param type: The value will always be `folder`., defaults to DocGenBatchCreateRequestV2025R0DestinationFolderTypeField.FOLDER
+ :type type: DocGenBatchCreateRequestV2025R0DestinationFolderTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class DocGenBatchCreateRequestV2025R0(BaseObject):
+ def __init__(
+ self,
+ file: FileReferenceV2025R0,
+ input_source: str,
+ destination_folder: DocGenBatchCreateRequestV2025R0DestinationFolderField,
+ output_type: str,
+ document_generation_data: List[DocGenDocumentGenerationDataV2025R0],
+ *,
+ file_version: Optional[FileVersionBaseV2025R0] = None,
+ **kwargs
+ ):
+ """
+ :param input_source: Source of input. The value has to be `api` for all the API-based document generation requests.
+ :type input_source: str
+ :param output_type: Type of the output file.
+ :type output_type: str
+ """
+ super().__init__(**kwargs)
+ self.file = file
+ self.input_source = input_source
+ self.destination_folder = destination_folder
+ self.output_type = output_type
+ self.document_generation_data = document_generation_data
+ self.file_version = file_version
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_document_generation_data_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_document_generation_data_v2025_r0.py
new file mode 100644
index 000000000..b7a70a2a2
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_document_generation_data_v2025_r0.py
@@ -0,0 +1,16 @@
+from typing import Dict
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenDocumentGenerationDataV2025R0(BaseObject):
+ def __init__(self, generated_file_name: str, user_input: Dict, **kwargs):
+ """
+ :param generated_file_name: File name of the output file.
+ :type generated_file_name: str
+ """
+ super().__init__(**kwargs)
+ self.generated_file_name = generated_file_name
+ self.user_input = user_input
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_base_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_base_v2025_r0.py
new file mode 100644
index 000000000..041ca4c0f
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_base_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenJobBaseV2025R0TypeField(str, Enum):
+ DOCGEN_JOB = 'docgen_job'
+
+
+class DocGenJobBaseV2025R0(BaseObject):
+ _discriminator = 'type', {'docgen_job'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: DocGenJobBaseV2025R0TypeField = DocGenJobBaseV2025R0TypeField.DOCGEN_JOB,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a Box Doc Gen job.
+ :type id: str
+ :param type: The value will always be `docgen_job`., defaults to DocGenJobBaseV2025R0TypeField.DOCGEN_JOB
+ :type type: DocGenJobBaseV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py
new file mode 100644
index 000000000..9debfb02f
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py
@@ -0,0 +1,82 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_base_v2025_r0 import (
+ DocGenJobBaseV2025R0TypeField,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_base_v2025_r0 import DocGenJobBaseV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_batch_base_v2025_r0 import (
+ DocGenBatchBaseV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.file_version_base_v2025_r0 import (
+ FileVersionBaseV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_v2025_r0 import (
+ DocGenJobV2025R0StatusField,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_v2025_r0 import DocGenJobV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.user_base_v2025_r0 import UserBaseV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.enterprise_reference_v2025_r0 import (
+ EnterpriseReferenceV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenJobFullV2025R0(DocGenJobV2025R0):
+ def __init__(
+ self,
+ created_by: UserBaseV2025R0,
+ enterprise: EnterpriseReferenceV2025R0,
+ source: str,
+ batch: DocGenBatchBaseV2025R0,
+ template_file: FileReferenceV2025R0,
+ template_file_version: FileVersionBaseV2025R0,
+ status: DocGenJobV2025R0StatusField,
+ output_type: str,
+ id: str,
+ *,
+ created_at: Optional[str] = None,
+ output_file: Optional[Optional[FileReferenceV2025R0]] = None,
+ output_file_version: Optional[Optional[FileVersionBaseV2025R0]] = None,
+ type: DocGenJobBaseV2025R0TypeField = DocGenJobBaseV2025R0TypeField.DOCGEN_JOB,
+ **kwargs
+ ):
+ """
+ :param source: Source of the request.
+ :type source: str
+ :param status: Status of the job.
+ :type status: DocGenJobV2025R0StatusField
+ :param output_type: Type of the generated file.
+ :type output_type: str
+ :param id: The unique identifier that represent a Box Doc Gen job.
+ :type id: str
+ :param created_at: Time of job creation., defaults to None
+ :type created_at: Optional[str], optional
+ :param type: The value will always be `docgen_job`., defaults to DocGenJobBaseV2025R0TypeField.DOCGEN_JOB
+ :type type: DocGenJobBaseV2025R0TypeField, optional
+ """
+ super().__init__(
+ batch=batch,
+ template_file=template_file,
+ template_file_version=template_file_version,
+ status=status,
+ output_type=output_type,
+ id=id,
+ output_file=output_file,
+ output_file_version=output_file_version,
+ type=type,
+ **kwargs
+ )
+ self.created_by = created_by
+ self.enterprise = enterprise
+ self.source = source
+ self.created_at = created_at
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py
new file mode 100644
index 000000000..43e37b347
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py
@@ -0,0 +1,64 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_base_v2025_r0 import (
+ DocGenJobBaseV2025R0TypeField,
+)
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_base_v2025_r0 import DocGenJobBaseV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_batch_base_v2025_r0 import (
+ DocGenBatchBaseV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.file_version_base_v2025_r0 import (
+ FileVersionBaseV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenJobV2025R0StatusField(str, Enum):
+ SUBMITTED = 'submitted'
+ COMPLETED = 'completed'
+ FAILED = 'failed'
+ COMPLETED_WITH_ERROR = 'completed_with_error'
+ PENDING = 'pending'
+
+
+class DocGenJobV2025R0(DocGenJobBaseV2025R0):
+ def __init__(
+ self,
+ batch: DocGenBatchBaseV2025R0,
+ template_file: FileReferenceV2025R0,
+ template_file_version: FileVersionBaseV2025R0,
+ status: DocGenJobV2025R0StatusField,
+ output_type: str,
+ id: str,
+ *,
+ output_file: Optional[Optional[FileReferenceV2025R0]] = None,
+ output_file_version: Optional[Optional[FileVersionBaseV2025R0]] = None,
+ type: DocGenJobBaseV2025R0TypeField = DocGenJobBaseV2025R0TypeField.DOCGEN_JOB,
+ **kwargs
+ ):
+ """
+ :param status: Status of the job.
+ :type status: DocGenJobV2025R0StatusField
+ :param output_type: Type of the generated file.
+ :type output_type: str
+ :param id: The unique identifier that represent a Box Doc Gen job.
+ :type id: str
+ :param type: The value will always be `docgen_job`., defaults to DocGenJobBaseV2025R0TypeField.DOCGEN_JOB
+ :type type: DocGenJobBaseV2025R0TypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.batch = batch
+ self.template_file = template_file
+ self.template_file_version = template_file_version
+ self.status = status
+ self.output_type = output_type
+ self.output_file = output_file
+ self.output_file_version = output_file_version
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_jobs_full_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_jobs_full_v2025_r0.py
new file mode 100644
index 000000000..029beff64
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_jobs_full_v2025_r0.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_full_v2025_r0 import DocGenJobFullV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenJobsFullV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[DocGenJobFullV2025R0]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: List of jobs., defaults to None
+ :type entries: Optional[List[DocGenJobFullV2025R0]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_jobs_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_jobs_v2025_r0.py
new file mode 100644
index 000000000..d5c8d66f9
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_jobs_v2025_r0.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_job_v2025_r0 import DocGenJobV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenJobsV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[DocGenJobV2025R0]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: List of jobs., defaults to None
+ :type entries: Optional[List[DocGenJobV2025R0]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_tag_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_tag_v2025_r0.py
new file mode 100644
index 000000000..7b33566ad
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_tag_v2025_r0.py
@@ -0,0 +1,38 @@
+from enum import Enum
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenTagV2025R0TagTypeField(str, Enum):
+ TEXT = 'text'
+ ARITHMETIC = 'arithmetic'
+ CONDITIONAL = 'conditional'
+ FOR_LOOP = 'for-loop'
+ TABLE_LOOP = 'table-loop'
+ IMAGE = 'image'
+
+
+class DocGenTagV2025R0(BaseObject):
+ def __init__(
+ self,
+ tag_content: str,
+ tag_type: DocGenTagV2025R0TagTypeField,
+ json_paths: List[str],
+ **kwargs
+ ):
+ """
+ :param tag_content: The content of the tag.
+ :type tag_content: str
+ :param tag_type: Type of the tag.
+ :type tag_type: DocGenTagV2025R0TagTypeField
+ :param json_paths: List of the paths.
+ :type json_paths: List[str]
+ """
+ super().__init__(**kwargs)
+ self.tag_content = tag_content
+ self.tag_type = tag_type
+ self.json_paths = json_paths
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_tags_processing_message_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_tags_processing_message_v2025_r0.py
new file mode 100644
index 000000000..00001b17c
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_tags_processing_message_v2025_r0.py
@@ -0,0 +1,13 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenTagsProcessingMessageV2025R0(BaseObject):
+ def __init__(self, message: str, **kwargs):
+ """
+ :param message: A message informing the user that document tags are still being processed.
+ :type message: str
+ """
+ super().__init__(**kwargs)
+ self.message = message
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_tags_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_tags_v2025_r0.py
new file mode 100644
index 000000000..b51284117
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_tags_v2025_r0.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_tag_v2025_r0 import DocGenTagV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenTagsV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[DocGenTagV2025R0]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: List of tags., defaults to None
+ :type entries: Optional[List[DocGenTagV2025R0]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_template_base_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_template_base_v2025_r0.py
new file mode 100644
index 000000000..aff11476f
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_template_base_v2025_r0.py
@@ -0,0 +1,13 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenTemplateBaseV2025R0(BaseObject):
+ def __init__(self, *, file: Optional[FileReferenceV2025R0] = None, **kwargs):
+ super().__init__(**kwargs)
+ self.file = file
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_template_create_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_template_create_request_v2025_r0.py
new file mode 100644
index 000000000..9927af5fd
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_template_create_request_v2025_r0.py
@@ -0,0 +1,11 @@
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenTemplateCreateRequestV2025R0(BaseObject):
+ def __init__(self, file: FileReferenceV2025R0, **kwargs):
+ super().__init__(**kwargs)
+ self.file = file
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_template_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_template_v2025_r0.py
new file mode 100644
index 000000000..2d4debdbd
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_template_v2025_r0.py
@@ -0,0 +1,25 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_template_base_v2025_r0 import (
+ DocGenTemplateBaseV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenTemplateV2025R0(DocGenTemplateBaseV2025R0):
+ def __init__(
+ self,
+ *,
+ file_name: Optional[str] = None,
+ file: Optional[FileReferenceV2025R0] = None,
+ **kwargs
+ ):
+ """
+ :param file_name: The name of the template., defaults to None
+ :type file_name: Optional[str], optional
+ """
+ super().__init__(file=file, **kwargs)
+ self.file_name = file_name
diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_templates_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_templates_v2025_r0.py
new file mode 100644
index 000000000..0bef7118b
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_templates_v2025_r0.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.doc_gen_template_v2025_r0 import DocGenTemplateV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class DocGenTemplatesV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[DocGenTemplateV2025R0]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of templates., defaults to None
+ :type entries: Optional[List[DocGenTemplateV2025R0]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/v2025_r0/enterprise_reference_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/enterprise_reference_v2025_r0.py
new file mode 100644
index 000000000..8a55a9250
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/enterprise_reference_v2025_r0.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class EnterpriseReferenceV2025R0TypeField(str, Enum):
+ ENTERPRISE = 'enterprise'
+
+
+class EnterpriseReferenceV2025R0(BaseObject):
+ _discriminator = 'type', {'enterprise'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[EnterpriseReferenceV2025R0TypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this enterprise., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `enterprise`., defaults to None
+ :type type: Optional[EnterpriseReferenceV2025R0TypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/file_reference_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/file_reference_v2025_r0.py
new file mode 100644
index 000000000..66216b28e
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/file_reference_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileReferenceV2025R0TypeField(str, Enum):
+ FILE = 'file'
+
+
+class FileReferenceV2025R0(BaseObject):
+ _discriminator = 'type', {'file'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: FileReferenceV2025R0TypeField = FileReferenceV2025R0TypeField.FILE,
+ **kwargs
+ ):
+ """
+ :param id: ID of the object.
+ :type id: str
+ :param type: The value will always be `file`., defaults to FileReferenceV2025R0TypeField.FILE
+ :type type: FileReferenceV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/file_version_base_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/file_version_base_v2025_r0.py
new file mode 100644
index 000000000..fb4cd1842
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/file_version_base_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FileVersionBaseV2025R0TypeField(str, Enum):
+ FILE_VERSION = 'file_version'
+
+
+class FileVersionBaseV2025R0(BaseObject):
+ _discriminator = 'type', {'file_version'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: FileVersionBaseV2025R0TypeField = FileVersionBaseV2025R0TypeField.FILE_VERSION,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a file version.
+ :type id: str
+ :param type: The value will always be `file_version`., defaults to FileVersionBaseV2025R0TypeField.FILE_VERSION
+ :type type: FileVersionBaseV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/folder_reference_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/folder_reference_v2025_r0.py
new file mode 100644
index 000000000..c45fccac3
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/folder_reference_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class FolderReferenceV2025R0TypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class FolderReferenceV2025R0(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: FolderReferenceV2025R0TypeField = FolderReferenceV2025R0TypeField.FOLDER,
+ **kwargs
+ ):
+ """
+ :param id: ID of the folder.
+ :type id: str
+ :param type: The value will always be `folder`., defaults to FolderReferenceV2025R0TypeField.FOLDER
+ :type type: FolderReferenceV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/group_base_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/group_base_v2025_r0.py
new file mode 100644
index 000000000..b14762bf1
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/group_base_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class GroupBaseV2025R0TypeField(str, Enum):
+ GROUP = 'group'
+
+
+class GroupBaseV2025R0(BaseObject):
+ _discriminator = 'type', {'group'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: GroupBaseV2025R0TypeField = GroupBaseV2025R0TypeField.GROUP,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object.
+ :type id: str
+ :param type: The value will always be `group`., defaults to GroupBaseV2025R0TypeField.GROUP
+ :type type: GroupBaseV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/group_mini_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/group_mini_v2025_r0.py
new file mode 100644
index 000000000..965e5e513
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/group_mini_v2025_r0.py
@@ -0,0 +1,39 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.schemas.v2025_r0.group_base_v2025_r0 import GroupBaseV2025R0TypeField
+
+from box_sdk_gen.schemas.v2025_r0.group_base_v2025_r0 import GroupBaseV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class GroupMiniV2025R0GroupTypeField(str, Enum):
+ MANAGED_GROUP = 'managed_group'
+ ALL_USERS_GROUP = 'all_users_group'
+
+
+class GroupMiniV2025R0(GroupBaseV2025R0):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ group_type: Optional[GroupMiniV2025R0GroupTypeField] = None,
+ type: GroupBaseV2025R0TypeField = GroupBaseV2025R0TypeField.GROUP,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this object.
+ :type id: str
+ :param name: The name of the group., defaults to None
+ :type name: Optional[str], optional
+ :param group_type: The type of the group., defaults to None
+ :type group_type: Optional[GroupMiniV2025R0GroupTypeField], optional
+ :param type: The value will always be `group`., defaults to GroupBaseV2025R0TypeField.GROUP
+ :type type: GroupBaseV2025R0TypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.name = name
+ self.group_type = group_type
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_access_grantee_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_access_grantee_v2025_r0.py
new file mode 100644
index 000000000..ccabcea22
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_access_grantee_v2025_r0.py
@@ -0,0 +1,11 @@
+from typing import Union
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_user_v2025_r0 import (
+ HubCollaborationUserV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.group_mini_v2025_r0 import GroupMiniV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+HubAccessGranteeV2025R0 = Union[HubCollaborationUserV2025R0, GroupMiniV2025R0]
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_action_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_action_v2025_r0.py
new file mode 100644
index 000000000..7e81ca860
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_action_v2025_r0.py
@@ -0,0 +1,8 @@
+from enum import Enum
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubActionV2025R0(str, Enum):
+ ADD = 'add'
+ REMOVE = 'remove'
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_base_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_base_v2025_r0.py
new file mode 100644
index 000000000..78212df31
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_base_v2025_r0.py
@@ -0,0 +1,36 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubBaseV2025R0TypeField(str, Enum):
+ HUBS = 'hubs'
+
+
+class HubBaseV2025R0(BaseObject):
+ _discriminator = 'type', {'hubs'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: HubBaseV2025R0TypeField = HubBaseV2025R0TypeField.HUBS,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting a hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ :type id: str
+ :param type: The value will always be `hubs`., defaults to HubBaseV2025R0TypeField.HUBS
+ :type type: HubBaseV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_collaboration_create_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_create_request_v2025_r0.py
new file mode 100644
index 000000000..cb926aa1f
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_create_request_v2025_r0.py
@@ -0,0 +1,84 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import Optional
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubCollaborationCreateRequestV2025R0HubTypeField(str, Enum):
+ HUBS = 'hubs'
+
+
+class HubCollaborationCreateRequestV2025R0HubField(BaseObject):
+ _discriminator = 'type', {'hubs'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: HubCollaborationCreateRequestV2025R0HubTypeField = HubCollaborationCreateRequestV2025R0HubTypeField.HUBS,
+ **kwargs
+ ):
+ """
+ :param id: ID of the object.
+ :type id: str
+ :param type: The value will always be `hubs`., defaults to HubCollaborationCreateRequestV2025R0HubTypeField.HUBS
+ :type type: HubCollaborationCreateRequestV2025R0HubTypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class HubCollaborationCreateRequestV2025R0AccessibleByField(BaseObject):
+ def __init__(
+ self,
+ type: str,
+ *,
+ id: Optional[str] = None,
+ login: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of collaborator to invite.
+ Possible values are `user` or `group`.
+ :type type: str
+ :param id: The ID of the user or group.
+
+ Alternatively, use `login` to specify a user by email
+ address., defaults to None
+ :type id: Optional[str], optional
+ :param login: The email address of the user who gets access to the item.
+
+ Alternatively, use `id` to specify a user by user ID., defaults to None
+ :type login: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+ self.login = login
+
+
+class HubCollaborationCreateRequestV2025R0(BaseObject):
+ def __init__(
+ self,
+ hub: HubCollaborationCreateRequestV2025R0HubField,
+ accessible_by: HubCollaborationCreateRequestV2025R0AccessibleByField,
+ role: str,
+ **kwargs
+ ):
+ """
+ :param hub: Hubs reference.
+ :type hub: HubCollaborationCreateRequestV2025R0HubField
+ :param accessible_by: The user or group who gets access to the item.
+ :type accessible_by: HubCollaborationCreateRequestV2025R0AccessibleByField
+ :param role: The level of access granted to hub.
+ Possible values are `editor`, `viewer`, and `co-owner`.
+ :type role: str
+ """
+ super().__init__(**kwargs)
+ self.hub = hub
+ self.accessible_by = accessible_by
+ self.role = role
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_collaboration_update_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_update_request_v2025_r0.py
new file mode 100644
index 000000000..28990c279
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_update_request_v2025_r0.py
@@ -0,0 +1,16 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubCollaborationUpdateRequestV2025R0(BaseObject):
+ def __init__(self, *, role: Optional[str] = None, **kwargs):
+ """
+ :param role: The level of access granted to hub.
+ Possible values are `editor`, `viewer`, and `co-owner`., defaults to None
+ :type role: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.role = role
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_collaboration_user_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_user_v2025_r0.py
new file mode 100644
index 000000000..cff4046ce
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_user_v2025_r0.py
@@ -0,0 +1,32 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.v2025_r0.user_base_v2025_r0 import UserBaseV2025R0TypeField
+
+from box_sdk_gen.schemas.v2025_r0.user_base_v2025_r0 import UserBaseV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubCollaborationUserV2025R0(UserBaseV2025R0):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ login: Optional[str] = None,
+ type: UserBaseV2025R0TypeField = UserBaseV2025R0TypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param name: The display name of this user. If the collaboration status is `pending`, an empty string is returned., defaults to None
+ :type name: Optional[str], optional
+ :param login: The primary email address of this user. If the collaboration status is `pending`, an empty string is returned., defaults to None
+ :type login: Optional[str], optional
+ :param type: The value will always be `user`., defaults to UserBaseV2025R0TypeField.USER
+ :type type: UserBaseV2025R0TypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.name = name
+ self.login = login
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_collaboration_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_v2025_r0.py
new file mode 100644
index 000000000..aa88f752f
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_collaboration_v2025_r0.py
@@ -0,0 +1,173 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_user_v2025_r0 import (
+ HubCollaborationUserV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.group_mini_v2025_r0 import GroupMiniV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.hub_base_v2025_r0 import HubBaseV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.hub_access_grantee_v2025_r0 import (
+ HubAccessGranteeV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.terms_of_service_base_v2025_r0 import (
+ TermsOfServiceBaseV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubCollaborationV2025R0TypeField(str, Enum):
+ HUB_COLLABORATION = 'hub_collaboration'
+
+
+class HubCollaborationV2025R0StatusField(str, Enum):
+ ACCEPTED = 'accepted'
+ PENDING = 'pending'
+ REJECTED = 'rejected'
+
+
+class HubCollaborationV2025R0AcceptanceRequirementsStatusTermsOfServiceRequirementField(
+ BaseObject
+):
+ def __init__(
+ self,
+ *,
+ is_accepted: Optional[bool] = None,
+ terms_of_service: Optional[TermsOfServiceBaseV2025R0] = None,
+ **kwargs
+ ):
+ """
+ :param is_accepted: Whether or not the terms of service have been accepted. The
+ field is `null` when there is no terms of service required., defaults to None
+ :type is_accepted: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.is_accepted = is_accepted
+ self.terms_of_service = terms_of_service
+
+
+class HubCollaborationV2025R0AcceptanceRequirementsStatusStrongPasswordRequirementField(
+ BaseObject
+):
+ def __init__(
+ self,
+ *,
+ enterprise_has_strong_password_required_for_external_users: Optional[
+ bool
+ ] = None,
+ user_has_strong_password: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param enterprise_has_strong_password_required_for_external_users: Whether or not the enterprise that owns the content requires
+ a strong password to collaborate on the content, or enforces
+ an exposed password detection for the external collaborators., defaults to None
+ :type enterprise_has_strong_password_required_for_external_users: Optional[bool], optional
+ :param user_has_strong_password: Whether or not the user has a strong and not exposed password set
+ for their account. The field is `null` when a strong password is
+ not required., defaults to None
+ :type user_has_strong_password: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.enterprise_has_strong_password_required_for_external_users = (
+ enterprise_has_strong_password_required_for_external_users
+ )
+ self.user_has_strong_password = user_has_strong_password
+
+
+class HubCollaborationV2025R0AcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField(
+ BaseObject
+):
+ def __init__(
+ self,
+ *,
+ enterprise_has_two_factor_auth_enabled: Optional[bool] = None,
+ user_has_two_factor_authentication_enabled: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param enterprise_has_two_factor_auth_enabled: Whether or not the enterprise that owns the content requires
+ two-factor authentication to be enabled in order to
+ collaborate on the content., defaults to None
+ :type enterprise_has_two_factor_auth_enabled: Optional[bool], optional
+ :param user_has_two_factor_authentication_enabled: Whether or not the user has two-factor authentication
+ enabled. The field is `null` when two-factor
+ authentication is not required., defaults to None
+ :type user_has_two_factor_authentication_enabled: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.enterprise_has_two_factor_auth_enabled = (
+ enterprise_has_two_factor_auth_enabled
+ )
+ self.user_has_two_factor_authentication_enabled = (
+ user_has_two_factor_authentication_enabled
+ )
+
+
+class HubCollaborationV2025R0AcceptanceRequirementsStatusField(BaseObject):
+ def __init__(
+ self,
+ *,
+ terms_of_service_requirement: Optional[
+ HubCollaborationV2025R0AcceptanceRequirementsStatusTermsOfServiceRequirementField
+ ] = None,
+ strong_password_requirement: Optional[
+ HubCollaborationV2025R0AcceptanceRequirementsStatusStrongPasswordRequirementField
+ ] = None,
+ two_factor_authentication_requirement: Optional[
+ HubCollaborationV2025R0AcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField
+ ] = None,
+ **kwargs
+ ):
+ super().__init__(**kwargs)
+ self.terms_of_service_requirement = terms_of_service_requirement
+ self.strong_password_requirement = strong_password_requirement
+ self.two_factor_authentication_requirement = (
+ two_factor_authentication_requirement
+ )
+
+
+class HubCollaborationV2025R0(BaseObject):
+ _discriminator = 'type', {'hub_collaboration'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: HubCollaborationV2025R0TypeField = HubCollaborationV2025R0TypeField.HUB_COLLABORATION,
+ hub: Optional[HubBaseV2025R0] = None,
+ accessible_by: Optional[HubAccessGranteeV2025R0] = None,
+ role: Optional[str] = None,
+ status: Optional[HubCollaborationV2025R0StatusField] = None,
+ acceptance_requirements_status: Optional[
+ HubCollaborationV2025R0AcceptanceRequirementsStatusField
+ ] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this collaboration.
+ :type id: str
+ :param type: The value will always be `hub_collaboration`., defaults to HubCollaborationV2025R0TypeField.HUB_COLLABORATION
+ :type type: HubCollaborationV2025R0TypeField, optional
+ :param role: The level of access granted to hub.
+ Possible values are `editor`, `viewer`, and `co-owner`., defaults to None
+ :type role: Optional[str], optional
+ :param status: The status of the collaboration invitation. If the status
+ is `pending`, `login` and `name` return an empty string., defaults to None
+ :type status: Optional[HubCollaborationV2025R0StatusField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.hub = hub
+ self.accessible_by = accessible_by
+ self.role = role
+ self.status = status
+ self.acceptance_requirements_status = acceptance_requirements_status
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_collaborations_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_collaborations_v2025_r0.py
new file mode 100644
index 000000000..b63fd5e66
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_collaborations_v2025_r0.py
@@ -0,0 +1,36 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.hub_collaboration_v2025_r0 import (
+ HubCollaborationV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubCollaborationsV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[HubCollaborationV2025R0]] = None,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list of hub collaborations., defaults to None
+ :type entries: Optional[List[HubCollaborationV2025R0]], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_copy_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_copy_request_v2025_r0.py
new file mode 100644
index 000000000..31da19359
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_copy_request_v2025_r0.py
@@ -0,0 +1,24 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubCopyRequestV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param title: Title of the Hub. It cannot be empty and should be less than 50 characters., defaults to None
+ :type title: Optional[str], optional
+ :param description: Description of the Hub., defaults to None
+ :type description: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.title = title
+ self.description = description
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_create_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_create_request_v2025_r0.py
new file mode 100644
index 000000000..16b9cd32e
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_create_request_v2025_r0.py
@@ -0,0 +1,18 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubCreateRequestV2025R0(BaseObject):
+ def __init__(self, title: str, *, description: Optional[str] = None, **kwargs):
+ """
+ :param title: Title of the Hub. It cannot be empty and should be less than 50 characters.
+ :type title: str
+ :param description: Description of the Hub., defaults to None
+ :type description: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.title = title
+ self.description = description
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_item_operation_result_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_item_operation_result_v2025_r0.py
new file mode 100644
index 000000000..f1423d2c2
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_item_operation_result_v2025_r0.py
@@ -0,0 +1,44 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.folder_reference_v2025_r0 import (
+ FolderReferenceV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.weblink_reference_v2025_r0 import (
+ WeblinkReferenceV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_reference_v2025_r0 import (
+ HubItemReferenceV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubItemOperationResultV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ action: Optional[str] = None,
+ item: Optional[HubItemReferenceV2025R0] = None,
+ status: Optional[int] = None,
+ error: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param action: The action performed on the item., defaults to None
+ :type action: Optional[str], optional
+ :param status: The HTTP status code of the operation., defaults to None
+ :type status: Optional[int], optional
+ :param error: Error message if the operation failed., defaults to None
+ :type error: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.action = action
+ self.item = item
+ self.status = status
+ self.error = error
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_item_operation_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_item_operation_v2025_r0.py
new file mode 100644
index 000000000..3584f0d20
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_item_operation_v2025_r0.py
@@ -0,0 +1,42 @@
+from enum import Enum
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.folder_reference_v2025_r0 import (
+ FolderReferenceV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.weblink_reference_v2025_r0 import (
+ WeblinkReferenceV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubItemOperationV2025R0ActionField(str, Enum):
+ ADD = 'add'
+ REMOVE = 'remove'
+
+
+class HubItemOperationV2025R0(BaseObject):
+ def __init__(
+ self,
+ action: HubItemOperationV2025R0ActionField,
+ item: Union[
+ FileReferenceV2025R0, FolderReferenceV2025R0, WeblinkReferenceV2025R0
+ ],
+ **kwargs
+ ):
+ """
+ :param action: The action to perform on a Hub item.
+ :type action: HubItemOperationV2025R0ActionField
+ :param item: Reference to an item that can be added to a Hub.
+ :type item: Union[FileReferenceV2025R0, FolderReferenceV2025R0, WeblinkReferenceV2025R0]
+ """
+ super().__init__(**kwargs)
+ self.action = action
+ self.item = item
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_item_reference_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_item_reference_v2025_r0.py
new file mode 100644
index 000000000..545cb7079
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_item_reference_v2025_r0.py
@@ -0,0 +1,17 @@
+from typing import Union
+
+from box_sdk_gen.schemas.v2025_r0.file_reference_v2025_r0 import FileReferenceV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.folder_reference_v2025_r0 import (
+ FolderReferenceV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.weblink_reference_v2025_r0 import (
+ WeblinkReferenceV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+HubItemReferenceV2025R0 = Union[
+ FileReferenceV2025R0, FolderReferenceV2025R0, WeblinkReferenceV2025R0
+]
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_item_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_item_v2025_r0.py
new file mode 100644
index 000000000..f2fae55a6
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_item_v2025_r0.py
@@ -0,0 +1,29 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubItemV2025R0TypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+ WEB_LINK = 'web_link'
+
+
+class HubItemV2025R0(BaseObject):
+ _discriminator = 'type', {'file', 'folder', 'web_link'}
+
+ def __init__(self, id: str, type: HubItemV2025R0TypeField, name: str, **kwargs):
+ """
+ :param id: The unique identifier for this item.
+ :type id: str
+ :param type: The type of the item.
+ :type type: HubItemV2025R0TypeField
+ :param name: The name of the item.
+ :type name: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_items_manage_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_items_manage_request_v2025_r0.py
new file mode 100644
index 000000000..563d2502d
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_items_manage_request_v2025_r0.py
@@ -0,0 +1,23 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_operation_v2025_r0 import (
+ HubItemOperationV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubItemsManageRequestV2025R0(BaseObject):
+ def __init__(
+ self, *, operations: Optional[List[HubItemOperationV2025R0]] = None, **kwargs
+ ):
+ """
+ :param operations: List of operations to perform on Hub items., defaults to None
+ :type operations: Optional[List[HubItemOperationV2025R0]], optional
+ """
+ super().__init__(**kwargs)
+ self.operations = operations
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_items_manage_response_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_items_manage_response_v2025_r0.py
new file mode 100644
index 000000000..36747ceaf
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_items_manage_response_v2025_r0.py
@@ -0,0 +1,19 @@
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_operation_result_v2025_r0 import (
+ HubItemOperationResultV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubItemsManageResponseV2025R0(BaseObject):
+ def __init__(self, operations: List[HubItemOperationResultV2025R0], **kwargs):
+ """
+ :param operations: List of operations performed on Hub items.
+ :type operations: List[HubItemOperationResultV2025R0]
+ """
+ super().__init__(**kwargs)
+ self.operations = operations
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_items_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_items_v2025_r0.py
new file mode 100644
index 000000000..652d1a114
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_items_v2025_r0.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.hub_item_v2025_r0 import HubItemV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubItemsV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[HubItemV2025R0]] = None,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list of Hub items., defaults to None
+ :type entries: Optional[List[HubItemV2025R0]], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_update_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_update_request_v2025_r0.py
new file mode 100644
index 000000000..dd75180d6
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_update_request_v2025_r0.py
@@ -0,0 +1,42 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubUpdateRequestV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ is_ai_enabled: Optional[bool] = None,
+ is_collaboration_restricted_to_enterprise: Optional[bool] = None,
+ can_non_owners_invite: Optional[bool] = None,
+ can_shared_link_be_created: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param title: Title of the Hub. It cannot be empty and should be less than 50 characters., defaults to None
+ :type title: Optional[str], optional
+ :param description: Description of the Hub., defaults to None
+ :type description: Optional[str], optional
+ :param is_ai_enabled: Indicates if AI features are enabled for the Hub., defaults to None
+ :type is_ai_enabled: Optional[bool], optional
+ :param is_collaboration_restricted_to_enterprise: Indicates if collaboration is restricted to the enterprise., defaults to None
+ :type is_collaboration_restricted_to_enterprise: Optional[bool], optional
+ :param can_non_owners_invite: Indicates if non-owners can invite others to the Hub., defaults to None
+ :type can_non_owners_invite: Optional[bool], optional
+ :param can_shared_link_be_created: Indicates if a shared link can be created for the Hub., defaults to None
+ :type can_shared_link_be_created: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.title = title
+ self.description = description
+ self.is_ai_enabled = is_ai_enabled
+ self.is_collaboration_restricted_to_enterprise = (
+ is_collaboration_restricted_to_enterprise
+ )
+ self.can_non_owners_invite = can_non_owners_invite
+ self.can_shared_link_be_created = can_shared_link_be_created
diff --git a/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py
new file mode 100644
index 000000000..efe6f8ef1
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hub_v2025_r0.py
@@ -0,0 +1,78 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.v2025_r0.hub_base_v2025_r0 import HubBaseV2025R0TypeField
+
+from box_sdk_gen.schemas.v2025_r0.hub_base_v2025_r0 import HubBaseV2025R0
+
+from box_sdk_gen.schemas.v2025_r0.user_mini_v2025_r0 import UserMiniV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class HubV2025R0(HubBaseV2025R0):
+ def __init__(
+ self,
+ id: str,
+ *,
+ title: Optional[str] = None,
+ description: Optional[str] = None,
+ created_at: Optional[DateTime] = None,
+ updated_at: Optional[DateTime] = None,
+ created_by: Optional[UserMiniV2025R0] = None,
+ updated_by: Optional[UserMiniV2025R0] = None,
+ view_count: Optional[int] = None,
+ is_ai_enabled: Optional[bool] = None,
+ is_collaboration_restricted_to_enterprise: Optional[bool] = None,
+ can_non_owners_invite: Optional[bool] = None,
+ can_shared_link_be_created: Optional[bool] = None,
+ type: HubBaseV2025R0TypeField = HubBaseV2025R0TypeField.HUBS,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier that represent a hub.
+
+ The ID for any hub can be determined
+ by visiting a hub in the web application
+ and copying the ID from the URL. For example,
+ for the URL `https://*.app.box.com/hubs/123`
+ the `hub_id` is `123`.
+ :type id: str
+ :param title: The title given to the hub., defaults to None
+ :type title: Optional[str], optional
+ :param description: The description of the hub. First 200 characters are returned., defaults to None
+ :type description: Optional[str], optional
+ :param created_at: The date and time when the folder was created. This value may
+ be `null` for some folders such as the root folder or the trash
+ folder., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param updated_at: The date and time when the hub was last updated., defaults to None
+ :type updated_at: Optional[DateTime], optional
+ :param view_count: The number of views for the hub., defaults to None
+ :type view_count: Optional[int], optional
+ :param is_ai_enabled: Indicates if AI features are enabled for the hub., defaults to None
+ :type is_ai_enabled: Optional[bool], optional
+ :param is_collaboration_restricted_to_enterprise: Indicates if collaboration is restricted to the enterprise., defaults to None
+ :type is_collaboration_restricted_to_enterprise: Optional[bool], optional
+ :param can_non_owners_invite: Indicates if non-owners can invite others to the hub., defaults to None
+ :type can_non_owners_invite: Optional[bool], optional
+ :param can_shared_link_be_created: Indicates if a shared link can be created for the hub., defaults to None
+ :type can_shared_link_be_created: Optional[bool], optional
+ :param type: The value will always be `hubs`., defaults to HubBaseV2025R0TypeField.HUBS
+ :type type: HubBaseV2025R0TypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.title = title
+ self.description = description
+ self.created_at = created_at
+ self.updated_at = updated_at
+ self.created_by = created_by
+ self.updated_by = updated_by
+ self.view_count = view_count
+ self.is_ai_enabled = is_ai_enabled
+ self.is_collaboration_restricted_to_enterprise = (
+ is_collaboration_restricted_to_enterprise
+ )
+ self.can_non_owners_invite = can_non_owners_invite
+ self.can_shared_link_be_created = can_shared_link_be_created
diff --git a/box_sdk_gen/schemas/v2025_r0/hubs_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/hubs_v2025_r0.py
new file mode 100644
index 000000000..47c8cc9f1
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/hubs_v2025_r0.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.hub_v2025_r0 import HubV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class HubsV2025R0(BaseObject):
+ def __init__(
+ self,
+ *,
+ entries: Optional[List[HubV2025R0]] = None,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param entries: A list of hubs., defaults to None
+ :type entries: Optional[List[HubV2025R0]], optional
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
+ self.limit = limit
+ self.next_marker = next_marker
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_country_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_country_v2025_r0.py
new file mode 100644
index 000000000..c1df40f1e
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_country_v2025_r0.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListContentCountryV2025R0TypeField(str, Enum):
+ COUNTRY = 'country'
+
+
+class ShieldListContentCountryV2025R0(BaseObject):
+ _discriminator = 'type', {'country'}
+
+ def __init__(
+ self,
+ country_codes: List[str],
+ *,
+ type: ShieldListContentCountryV2025R0TypeField = ShieldListContentCountryV2025R0TypeField.COUNTRY,
+ **kwargs
+ ):
+ """
+ :param country_codes: List of country codes values.
+ :type country_codes: List[str]
+ :param type: The type of content in the shield list., defaults to ShieldListContentCountryV2025R0TypeField.COUNTRY
+ :type type: ShieldListContentCountryV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.country_codes = country_codes
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_domain_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_domain_v2025_r0.py
new file mode 100644
index 000000000..6a0c0dae8
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_domain_v2025_r0.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListContentDomainV2025R0TypeField(str, Enum):
+ DOMAIN = 'domain'
+
+
+class ShieldListContentDomainV2025R0(BaseObject):
+ _discriminator = 'type', {'domain'}
+
+ def __init__(
+ self,
+ domains: List[str],
+ *,
+ type: ShieldListContentDomainV2025R0TypeField = ShieldListContentDomainV2025R0TypeField.DOMAIN,
+ **kwargs
+ ):
+ """
+ :param domains: List of domain.
+ :type domains: List[str]
+ :param type: The type of content in the shield list., defaults to ShieldListContentDomainV2025R0TypeField.DOMAIN
+ :type type: ShieldListContentDomainV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.domains = domains
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_email_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_email_v2025_r0.py
new file mode 100644
index 000000000..6883277bd
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_email_v2025_r0.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListContentEmailV2025R0TypeField(str, Enum):
+ EMAIL = 'email'
+
+
+class ShieldListContentEmailV2025R0(BaseObject):
+ _discriminator = 'type', {'email'}
+
+ def __init__(
+ self,
+ email_addresses: List[str],
+ *,
+ type: ShieldListContentEmailV2025R0TypeField = ShieldListContentEmailV2025R0TypeField.EMAIL,
+ **kwargs
+ ):
+ """
+ :param email_addresses: List of emails.
+ :type email_addresses: List[str]
+ :param type: The type of content in the shield list., defaults to ShieldListContentEmailV2025R0TypeField.EMAIL
+ :type type: ShieldListContentEmailV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.email_addresses = email_addresses
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_integration_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_integration_v2025_r0.py
new file mode 100644
index 000000000..a1a9f327b
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_integration_v2025_r0.py
@@ -0,0 +1,44 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListContentIntegrationV2025R0TypeField(str, Enum):
+ INTEGRATION = 'integration'
+
+
+class ShieldListContentIntegrationV2025R0IntegrationsField(BaseObject):
+ def __init__(self, *, id: Optional[str] = None, **kwargs):
+ """
+ :param id: The ID of the integration., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
+class ShieldListContentIntegrationV2025R0(BaseObject):
+ _discriminator = 'type', {'integration'}
+
+ def __init__(
+ self,
+ integrations: List[ShieldListContentIntegrationV2025R0IntegrationsField],
+ *,
+ type: ShieldListContentIntegrationV2025R0TypeField = ShieldListContentIntegrationV2025R0TypeField.INTEGRATION,
+ **kwargs
+ ):
+ """
+ :param integrations: List of integration.
+ :type integrations: List[ShieldListContentIntegrationV2025R0IntegrationsField]
+ :param type: The type of content in the shield list., defaults to ShieldListContentIntegrationV2025R0TypeField.INTEGRATION
+ :type type: ShieldListContentIntegrationV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.integrations = integrations
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_ip_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_ip_v2025_r0.py
new file mode 100644
index 000000000..fdaef0ecf
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_ip_v2025_r0.py
@@ -0,0 +1,32 @@
+from enum import Enum
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListContentIpV2025R0TypeField(str, Enum):
+ IP = 'ip'
+
+
+class ShieldListContentIpV2025R0(BaseObject):
+ _discriminator = 'type', {'ip'}
+
+ def __init__(
+ self,
+ ip_addresses: List[str],
+ *,
+ type: ShieldListContentIpV2025R0TypeField = ShieldListContentIpV2025R0TypeField.IP,
+ **kwargs
+ ):
+ """
+ :param ip_addresses: List of ips and cidrs.
+ :type ip_addresses: List[str]
+ :param type: The type of content in the shield list., defaults to ShieldListContentIpV2025R0TypeField.IP
+ :type type: ShieldListContentIpV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.ip_addresses = ip_addresses
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_request_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_request_v2025_r0.py
new file mode 100644
index 000000000..266a96244
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_request_v2025_r0.py
@@ -0,0 +1,26 @@
+from typing import Union
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import (
+ ShieldListContentCountryV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import (
+ ShieldListContentDomainV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import (
+ ShieldListContentEmailV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import (
+ ShieldListContentIpV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+ShieldListContentRequestV2025R0 = Union[
+ ShieldListContentCountryV2025R0,
+ ShieldListContentDomainV2025R0,
+ ShieldListContentEmailV2025R0,
+ ShieldListContentIpV2025R0,
+]
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_content_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_content_v2025_r0.py
new file mode 100644
index 000000000..9c5adacf8
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_content_v2025_r0.py
@@ -0,0 +1,31 @@
+from typing import Union
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import (
+ ShieldListContentCountryV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import (
+ ShieldListContentDomainV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import (
+ ShieldListContentEmailV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import (
+ ShieldListContentIpV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_integration_v2025_r0 import (
+ ShieldListContentIntegrationV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+ShieldListContentV2025R0 = Union[
+ ShieldListContentCountryV2025R0,
+ ShieldListContentDomainV2025R0,
+ ShieldListContentEmailV2025R0,
+ ShieldListContentIpV2025R0,
+ ShieldListContentIntegrationV2025R0,
+]
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_mini_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_mini_v2025_r0.py
new file mode 100644
index 000000000..1bd5f412d
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_mini_v2025_r0.py
@@ -0,0 +1,50 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListMiniV2025R0TypeField(str, Enum):
+ SHIELD_LIST = 'shield_list'
+
+
+class ShieldListMiniV2025R0ContentField(BaseObject):
+ def __init__(self, *, type: Optional[str] = None, **kwargs):
+ """
+ :param type: The type of content in the shield list., defaults to None
+ :type type: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+
+
+class ShieldListMiniV2025R0(BaseObject):
+ _discriminator = 'type', {'shield_list'}
+
+ def __init__(
+ self,
+ id: str,
+ name: str,
+ content: ShieldListMiniV2025R0ContentField,
+ *,
+ type: ShieldListMiniV2025R0TypeField = ShieldListMiniV2025R0TypeField.SHIELD_LIST,
+ **kwargs
+ ):
+ """
+ :param id: Unique global identifier for this list.
+ :type id: str
+ :param name: Name of Shield List.
+ :type name: str
+ :param type: The type of object., defaults to ShieldListMiniV2025R0TypeField.SHIELD_LIST
+ :type type: ShieldListMiniV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.name = name
+ self.content = content
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_list_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_list_v2025_r0.py
new file mode 100644
index 000000000..a7981b729
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_list_v2025_r0.py
@@ -0,0 +1,76 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import (
+ ShieldListContentCountryV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import (
+ ShieldListContentDomainV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import (
+ ShieldListContentEmailV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import (
+ ShieldListContentIpV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_integration_v2025_r0 import (
+ ShieldListContentIntegrationV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.enterprise_reference_v2025_r0 import (
+ EnterpriseReferenceV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_v2025_r0 import (
+ ShieldListContentV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class ShieldListV2025R0(BaseObject):
+ def __init__(
+ self,
+ id: str,
+ type: str,
+ name: str,
+ enterprise: EnterpriseReferenceV2025R0,
+ created_at: DateTime,
+ updated_at: DateTime,
+ content: ShieldListContentV2025R0,
+ *,
+ description: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: Unique identifier for the shield list.
+ :type id: str
+ :param type: Type of the object.
+ :type type: str
+ :param name: Name of the shield list.
+ :type name: str
+ :param created_at: ISO date time string when this shield list object was created.
+ :type created_at: DateTime
+ :param updated_at: ISO date time string when this shield list object was updated.
+ :type updated_at: DateTime
+ :param description: Description of Shield List., defaults to None
+ :type description: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+ self.enterprise = enterprise
+ self.created_at = created_at
+ self.updated_at = updated_at
+ self.content = content
+ self.description = description
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_lists_create_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_lists_create_v2025_r0.py
new file mode 100644
index 000000000..c582f4c8e
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_lists_create_v2025_r0.py
@@ -0,0 +1,48 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import (
+ ShieldListContentCountryV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import (
+ ShieldListContentDomainV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import (
+ ShieldListContentEmailV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import (
+ ShieldListContentIpV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_request_v2025_r0 import (
+ ShieldListContentRequestV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListsCreateV2025R0(BaseObject):
+ def __init__(
+ self,
+ name: str,
+ content: ShieldListContentRequestV2025R0,
+ *,
+ description: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param name: The name of the shield list.
+ :type name: str
+ :param description: Optional description of Shield List., defaults to None
+ :type description: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.content = content
+ self.description = description
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_lists_update_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_lists_update_v2025_r0.py
new file mode 100644
index 000000000..6a85584a9
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_lists_update_v2025_r0.py
@@ -0,0 +1,48 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_country_v2025_r0 import (
+ ShieldListContentCountryV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_domain_v2025_r0 import (
+ ShieldListContentDomainV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_email_v2025_r0 import (
+ ShieldListContentEmailV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_ip_v2025_r0 import (
+ ShieldListContentIpV2025R0,
+)
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_content_request_v2025_r0 import (
+ ShieldListContentRequestV2025R0,
+)
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListsUpdateV2025R0(BaseObject):
+ def __init__(
+ self,
+ name: str,
+ content: ShieldListContentRequestV2025R0,
+ *,
+ description: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param name: The name of the shield list.
+ :type name: str
+ :param description: Optional description of Shield List., defaults to None
+ :type description: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.content = content
+ self.description = description
diff --git a/box_sdk_gen/schemas/v2025_r0/shield_lists_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/shield_lists_v2025_r0.py
new file mode 100644
index 000000000..1b2beceeb
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/shield_lists_v2025_r0.py
@@ -0,0 +1,21 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.v2025_r0.shield_list_mini_v2025_r0 import ShieldListMiniV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ShieldListsV2025R0(BaseObject):
+ def __init__(
+ self, *, entries: Optional[List[ShieldListMiniV2025R0]] = None, **kwargs
+ ):
+ """
+ :param entries: A list of shield list objects., defaults to None
+ :type entries: Optional[List[ShieldListMiniV2025R0]], optional
+ """
+ super().__init__(**kwargs)
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/v2025_r0/terms_of_service_base_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/terms_of_service_base_v2025_r0.py
new file mode 100644
index 000000000..0d7c7ae0b
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/terms_of_service_base_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class TermsOfServiceBaseV2025R0TypeField(str, Enum):
+ TERMS_OF_SERVICE = 'terms_of_service'
+
+
+class TermsOfServiceBaseV2025R0(BaseObject):
+ _discriminator = 'type', {'terms_of_service'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: TermsOfServiceBaseV2025R0TypeField = TermsOfServiceBaseV2025R0TypeField.TERMS_OF_SERVICE,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this terms of service.
+ :type id: str
+ :param type: The value will always be `terms_of_service`., defaults to TermsOfServiceBaseV2025R0TypeField.TERMS_OF_SERVICE
+ :type type: TermsOfServiceBaseV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/user_base_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/user_base_v2025_r0.py
new file mode 100644
index 000000000..f5910d63f
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/user_base_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UserBaseV2025R0TypeField(str, Enum):
+ USER = 'user'
+
+
+class UserBaseV2025R0(BaseObject):
+ _discriminator = 'type', {'user'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: UserBaseV2025R0TypeField = UserBaseV2025R0TypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param type: The value will always be `user`., defaults to UserBaseV2025R0TypeField.USER
+ :type type: UserBaseV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/v2025_r0/user_mini_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/user_mini_v2025_r0.py
new file mode 100644
index 000000000..f9ef21883
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/user_mini_v2025_r0.py
@@ -0,0 +1,32 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.v2025_r0.user_base_v2025_r0 import UserBaseV2025R0TypeField
+
+from box_sdk_gen.schemas.v2025_r0.user_base_v2025_r0 import UserBaseV2025R0
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class UserMiniV2025R0(UserBaseV2025R0):
+ def __init__(
+ self,
+ id: str,
+ *,
+ name: Optional[str] = None,
+ login: Optional[str] = None,
+ type: UserBaseV2025R0TypeField = UserBaseV2025R0TypeField.USER,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this user.
+ :type id: str
+ :param name: The display name of this user., defaults to None
+ :type name: Optional[str], optional
+ :param login: The primary email address of this user., defaults to None
+ :type login: Optional[str], optional
+ :param type: The value will always be `user`., defaults to UserBaseV2025R0TypeField.USER
+ :type type: UserBaseV2025R0TypeField, optional
+ """
+ super().__init__(id=id, type=type, **kwargs)
+ self.name = name
+ self.login = login
diff --git a/box_sdk_gen/schemas/v2025_r0/weblink_reference_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/weblink_reference_v2025_r0.py
new file mode 100644
index 000000000..1e767a598
--- /dev/null
+++ b/box_sdk_gen/schemas/v2025_r0/weblink_reference_v2025_r0.py
@@ -0,0 +1,30 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class WeblinkReferenceV2025R0TypeField(str, Enum):
+ WEBLINK = 'weblink'
+
+
+class WeblinkReferenceV2025R0(BaseObject):
+ _discriminator = 'type', {'weblink'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: WeblinkReferenceV2025R0TypeField = WeblinkReferenceV2025R0TypeField.WEBLINK,
+ **kwargs
+ ):
+ """
+ :param id: ID of the weblink.
+ :type id: str
+ :param type: The value will always be `weblink`., defaults to WeblinkReferenceV2025R0TypeField.WEBLINK
+ :type type: WeblinkReferenceV2025R0TypeField, optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
diff --git a/box_sdk_gen/schemas/watermark.py b/box_sdk_gen/schemas/watermark.py
new file mode 100644
index 000000000..eb5464cdd
--- /dev/null
+++ b/box_sdk_gen/schemas/watermark.py
@@ -0,0 +1,34 @@
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class WatermarkWatermarkField(BaseObject):
+ def __init__(
+ self,
+ *,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ **kwargs
+ ):
+ """
+ :param created_at: When this watermark was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When this task was modified., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.created_at = created_at
+ self.modified_at = modified_at
+
+
+class Watermark(BaseObject):
+ def __init__(
+ self, *, watermark: Optional[WatermarkWatermarkField] = None, **kwargs
+ ):
+ super().__init__(**kwargs)
+ self.watermark = watermark
diff --git a/box_sdk_gen/schemas/web_link.py b/box_sdk_gen/schemas/web_link.py
new file mode 100644
index 000000000..c85512f47
--- /dev/null
+++ b/box_sdk_gen/schemas/web_link.py
@@ -0,0 +1,248 @@
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.schemas.web_link_base import WebLinkBaseTypeField
+
+from box_sdk_gen.schemas.web_link_base import WebLinkBase
+
+from box_sdk_gen.schemas.web_link_mini import WebLinkMini
+
+from box_sdk_gen.schemas.folder_mini import FolderMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class WebLinkPathCollectionField(BaseObject):
+ def __init__(self, total_count: int, entries: List[FolderMini], **kwargs):
+ """
+ :param total_count: The number of folders in this list.
+ :type total_count: int
+ :param entries: The parent folders for this item.
+ :type entries: List[FolderMini]
+ """
+ super().__init__(**kwargs)
+ self.total_count = total_count
+ self.entries = entries
+
+
+class WebLinkSharedLinkAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class WebLinkSharedLinkEffectiveAccessField(str, Enum):
+ OPEN = 'open'
+ COMPANY = 'company'
+ COLLABORATORS = 'collaborators'
+
+
+class WebLinkSharedLinkEffectivePermissionField(str, Enum):
+ CAN_EDIT = 'can_edit'
+ CAN_DOWNLOAD = 'can_download'
+ CAN_PREVIEW = 'can_preview'
+ NO_ACCESS = 'no_access'
+
+
+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
+ shared links on folders, this also applies to any items in the folder.
+
+ This value can be set to `true` when the effective access level is
+ set to `open` or `company`, not `collaborators`.
+ :type can_download: bool
+ :param can_preview: Defines if the shared link allows for the item to be previewed.
+
+ This value is always `true`. For shared links on folders this also
+ applies to any items in the folder.
+ :type can_preview: bool
+ :param can_edit: Defines if the shared link allows for the item to be edited.
+
+ This value can only be `true` if `can_download` is also `true` and if
+ the item has a type of `file`.
+ :type can_edit: bool
+ """
+ super().__init__(**kwargs)
+ self.can_download = can_download
+ self.can_preview = can_preview
+ self.can_edit = can_edit
+
+
+class WebLinkSharedLinkField(BaseObject):
+ def __init__(
+ self,
+ url: str,
+ 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[WebLinkSharedLinkAccessField] = None,
+ unshared_at: Optional[DateTime] = None,
+ permissions: Optional[WebLinkSharedLinkPermissionsField] = None,
+ **kwargs
+ ):
+ """
+ :param url: The URL that can be used to access the item on Box.
+
+ This URL will display the item in Box's preview UI where the file
+ can be downloaded if allowed.
+
+ This URL will continue to work even when a custom `vanity_url`
+ has been set for this shared link.
+ :type url: str
+ :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: 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: 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.
+ :type download_count: int
+ :param preview_count: The number of times this item has been previewed.
+ :type preview_count: int
+ :param download_url: A URL that can be used to download the file. This URL can be used in
+ a browser to download the file. This URL includes the file
+ extension so that the file will be saved with the right file type.
+
+ This property will be `null` for folders., defaults to None
+ :type download_url: Optional[str], optional
+ :param vanity_url: The "Custom URL" that can also be used to preview the item on Box. Custom
+ URLs can only be created or modified in the Box Web application., defaults to None
+ :type vanity_url: Optional[str], optional
+ :param vanity_name: The custom name of a shared link, as used in the `vanity_url` field., defaults to None
+ :type vanity_name: Optional[str], optional
+ :param access: The access level for this shared link.
+
+ * `open` - provides access to this item to anyone with this link
+ * `company` - only provides access to this item to people the same company
+ * `collaborators` - only provides access to this item to people who are
+ 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., defaults to None
+ :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., defaults to None
+ :type unshared_at: Optional[DateTime], 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., defaults to None
+ :type permissions: Optional[WebLinkSharedLinkPermissionsField], optional
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.effective_access = effective_access
+ self.effective_permission = effective_permission
+ self.is_password_enabled = is_password_enabled
+ self.download_count = download_count
+ self.preview_count = preview_count
+ self.download_url = download_url
+ self.vanity_url = vanity_url
+ self.vanity_name = vanity_name
+ self.access = access
+ self.unshared_at = unshared_at
+ self.permissions = permissions
+
+
+class WebLinkItemStatusField(str, Enum):
+ ACTIVE = 'active'
+ TRASHED = 'trashed'
+ DELETED = 'deleted'
+
+
+class WebLink(WebLinkMini):
+ def __init__(
+ self,
+ id: str,
+ *,
+ parent: Optional[FolderMini] = None,
+ description: Optional[str] = None,
+ path_collection: Optional[WebLinkPathCollectionField] = None,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ trashed_at: Optional[DateTime] = None,
+ purged_at: Optional[DateTime] = None,
+ created_by: Optional[UserMini] = None,
+ modified_by: Optional[UserMini] = None,
+ owned_by: Optional[UserMini] = None,
+ shared_link: Optional[WebLinkSharedLinkField] = None,
+ item_status: Optional[WebLinkItemStatusField] = None,
+ url: Optional[str] = None,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ type: WebLinkBaseTypeField = WebLinkBaseTypeField.WEB_LINK,
+ etag: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this web link.
+ :type id: str
+ :param description: The description accompanying the web link. This is
+ visible within the Box web application., defaults to None
+ :type description: Optional[str], optional
+ :param created_at: When this file was created on Box’s servers., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: When this file was last updated on the Box
+ servers., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param trashed_at: When this file was moved to the trash., defaults to None
+ :type trashed_at: Optional[DateTime], optional
+ :param purged_at: When this file will be permanently deleted., defaults to None
+ :type purged_at: Optional[DateTime], optional
+ :param item_status: Whether this item is deleted or not. Values include `active`,
+ `trashed` if the file has been moved to the trash, and `deleted` if
+ the file has been permanently deleted., defaults to None
+ :type item_status: Optional[WebLinkItemStatusField], optional
+ :param url: The URL this web link points to., defaults to None
+ :type url: Optional[str], optional
+ :param name: The name of the web link., defaults to None
+ :type name: Optional[str], optional
+ :param type: The value will always be `web_link`., defaults to WebLinkBaseTypeField.WEB_LINK
+ :type type: WebLinkBaseTypeField, optional
+ :param etag: The entity tag of this web link. Used with `If-Match`
+ headers., defaults to None
+ :type etag: Optional[str], optional
+ """
+ super().__init__(
+ id=id,
+ url=url,
+ sequence_id=sequence_id,
+ name=name,
+ type=type,
+ etag=etag,
+ **kwargs
+ )
+ self.parent = parent
+ self.description = description
+ self.path_collection = path_collection
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.trashed_at = trashed_at
+ self.purged_at = purged_at
+ self.created_by = created_by
+ self.modified_by = modified_by
+ self.owned_by = owned_by
+ self.shared_link = shared_link
+ self.item_status = item_status
diff --git a/box_sdk_gen/schemas/web_link_base.py b/box_sdk_gen/schemas/web_link_base.py
new file mode 100644
index 000000000..5047cf051
--- /dev/null
+++ b/box_sdk_gen/schemas/web_link_base.py
@@ -0,0 +1,37 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class WebLinkBaseTypeField(str, Enum):
+ WEB_LINK = 'web_link'
+
+
+class WebLinkBase(BaseObject):
+ _discriminator = 'type', {'web_link'}
+
+ def __init__(
+ self,
+ id: str,
+ *,
+ type: WebLinkBaseTypeField = WebLinkBaseTypeField.WEB_LINK,
+ etag: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this web link.
+ :type id: str
+ :param type: The value will always be `web_link`., defaults to WebLinkBaseTypeField.WEB_LINK
+ :type type: WebLinkBaseTypeField, optional
+ :param etag: The entity tag of this web link. Used with `If-Match`
+ headers., defaults to None
+ :type etag: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.etag = etag
diff --git a/box_sdk_gen/schemas/web_link_mini.py b/box_sdk_gen/schemas/web_link_mini.py
new file mode 100644
index 000000000..8beb65852
--- /dev/null
+++ b/box_sdk_gen/schemas/web_link_mini.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from box_sdk_gen.schemas.web_link_base import WebLinkBaseTypeField
+
+from box_sdk_gen.schemas.web_link_base import WebLinkBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class WebLinkMini(WebLinkBase):
+ def __init__(
+ self,
+ id: str,
+ *,
+ url: Optional[str] = None,
+ sequence_id: Optional[str] = None,
+ name: Optional[str] = None,
+ type: WebLinkBaseTypeField = WebLinkBaseTypeField.WEB_LINK,
+ etag: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this web link.
+ :type id: str
+ :param url: The URL this web link points to., defaults to None
+ :type url: Optional[str], optional
+ :param name: The name of the web link., defaults to None
+ :type name: Optional[str], optional
+ :param type: The value will always be `web_link`., defaults to WebLinkBaseTypeField.WEB_LINK
+ :type type: WebLinkBaseTypeField, optional
+ :param etag: The entity tag of this web link. Used with `If-Match`
+ headers., defaults to None
+ :type etag: Optional[str], optional
+ """
+ super().__init__(id=id, type=type, etag=etag, **kwargs)
+ self.url = url
+ self.sequence_id = sequence_id
+ self.name = name
diff --git a/box_sdk_gen/schemas/webhook.py b/box_sdk_gen/schemas/webhook.py
new file mode 100644
index 000000000..3cbf167f6
--- /dev/null
+++ b/box_sdk_gen/schemas/webhook.py
@@ -0,0 +1,96 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.webhook_mini import WebhookMiniTypeField
+
+from box_sdk_gen.schemas.webhook_mini import WebhookMiniTargetField
+
+from box_sdk_gen.schemas.webhook_mini import WebhookMini
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class WebhookTriggersField(str, Enum):
+ FILE_UPLOADED = 'FILE.UPLOADED'
+ FILE_PREVIEWED = 'FILE.PREVIEWED'
+ FILE_DOWNLOADED = 'FILE.DOWNLOADED'
+ FILE_TRASHED = 'FILE.TRASHED'
+ FILE_DELETED = 'FILE.DELETED'
+ FILE_RESTORED = 'FILE.RESTORED'
+ FILE_COPIED = 'FILE.COPIED'
+ FILE_MOVED = 'FILE.MOVED'
+ FILE_LOCKED = 'FILE.LOCKED'
+ FILE_UNLOCKED = 'FILE.UNLOCKED'
+ FILE_RENAMED = 'FILE.RENAMED'
+ COMMENT_CREATED = 'COMMENT.CREATED'
+ COMMENT_UPDATED = 'COMMENT.UPDATED'
+ COMMENT_DELETED = 'COMMENT.DELETED'
+ TASK_ASSIGNMENT_CREATED = 'TASK_ASSIGNMENT.CREATED'
+ TASK_ASSIGNMENT_UPDATED = 'TASK_ASSIGNMENT.UPDATED'
+ METADATA_INSTANCE_CREATED = 'METADATA_INSTANCE.CREATED'
+ METADATA_INSTANCE_UPDATED = 'METADATA_INSTANCE.UPDATED'
+ METADATA_INSTANCE_DELETED = 'METADATA_INSTANCE.DELETED'
+ FOLDER_CREATED = 'FOLDER.CREATED'
+ FOLDER_RENAMED = 'FOLDER.RENAMED'
+ FOLDER_DOWNLOADED = 'FOLDER.DOWNLOADED'
+ FOLDER_RESTORED = 'FOLDER.RESTORED'
+ FOLDER_DELETED = 'FOLDER.DELETED'
+ FOLDER_COPIED = 'FOLDER.COPIED'
+ FOLDER_MOVED = 'FOLDER.MOVED'
+ FOLDER_TRASHED = 'FOLDER.TRASHED'
+ WEBHOOK_DELETED = 'WEBHOOK.DELETED'
+ COLLABORATION_CREATED = 'COLLABORATION.CREATED'
+ COLLABORATION_ACCEPTED = 'COLLABORATION.ACCEPTED'
+ COLLABORATION_REJECTED = 'COLLABORATION.REJECTED'
+ COLLABORATION_REMOVED = 'COLLABORATION.REMOVED'
+ COLLABORATION_UPDATED = 'COLLABORATION.UPDATED'
+ SHARED_LINK_DELETED = 'SHARED_LINK.DELETED'
+ SHARED_LINK_CREATED = 'SHARED_LINK.CREATED'
+ SHARED_LINK_UPDATED = 'SHARED_LINK.UPDATED'
+ SIGN_REQUEST_COMPLETED = 'SIGN_REQUEST.COMPLETED'
+ SIGN_REQUEST_DECLINED = 'SIGN_REQUEST.DECLINED'
+ SIGN_REQUEST_EXPIRED = 'SIGN_REQUEST.EXPIRED'
+ SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED'
+
+
+class Webhook(WebhookMini):
+ def __init__(
+ self,
+ *,
+ created_by: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ address: Optional[str] = None,
+ triggers: Optional[List[WebhookTriggersField]] = None,
+ id: Optional[str] = None,
+ type: Optional[WebhookMiniTypeField] = None,
+ target: Optional[WebhookMiniTargetField] = None,
+ **kwargs
+ ):
+ """
+ :param created_at: A timestamp identifying the time that
+ the webhook was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param address: The URL that is notified by this webhook., defaults to None
+ :type address: Optional[str], optional
+ :param triggers: An array of event names that this webhook is
+ to be triggered for., defaults to None
+ :type triggers: Optional[List[WebhookTriggersField]], optional
+ :param id: The unique identifier for this webhook., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `webhook`., defaults to None
+ :type type: Optional[WebhookMiniTypeField], optional
+ :param target: The item that will trigger the webhook., defaults to None
+ :type target: Optional[WebhookMiniTargetField], optional
+ """
+ super().__init__(id=id, type=type, target=target, **kwargs)
+ self.created_by = created_by
+ self.created_at = created_at
+ self.address = address
+ self.triggers = triggers
diff --git a/box_sdk_gen/schemas/webhook_invocation.py b/box_sdk_gen/schemas/webhook_invocation.py
new file mode 100644
index 000000000..86ba116e8
--- /dev/null
+++ b/box_sdk_gen/schemas/webhook_invocation.py
@@ -0,0 +1,100 @@
+from enum import Enum
+
+from typing import Optional
+
+from typing import Union
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.webhook import Webhook
+
+from box_sdk_gen.schemas.user_mini import UserMini
+
+from box_sdk_gen.schemas.file import File
+
+from box_sdk_gen.schemas.folder import Folder
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class WebhookInvocationTypeField(str, Enum):
+ WEBHOOK_EVENT = 'webhook_event'
+
+
+class WebhookInvocationTriggerField(str, Enum):
+ FILE_UPLOADED = 'FILE.UPLOADED'
+ FILE_PREVIEWED = 'FILE.PREVIEWED'
+ FILE_DOWNLOADED = 'FILE.DOWNLOADED'
+ FILE_TRASHED = 'FILE.TRASHED'
+ FILE_DELETED = 'FILE.DELETED'
+ FILE_RESTORED = 'FILE.RESTORED'
+ FILE_COPIED = 'FILE.COPIED'
+ FILE_MOVED = 'FILE.MOVED'
+ FILE_LOCKED = 'FILE.LOCKED'
+ FILE_UNLOCKED = 'FILE.UNLOCKED'
+ FILE_RENAMED = 'FILE.RENAMED'
+ COMMENT_CREATED = 'COMMENT.CREATED'
+ COMMENT_UPDATED = 'COMMENT.UPDATED'
+ COMMENT_DELETED = 'COMMENT.DELETED'
+ TASK_ASSIGNMENT_CREATED = 'TASK_ASSIGNMENT.CREATED'
+ TASK_ASSIGNMENT_UPDATED = 'TASK_ASSIGNMENT.UPDATED'
+ METADATA_INSTANCE_CREATED = 'METADATA_INSTANCE.CREATED'
+ METADATA_INSTANCE_UPDATED = 'METADATA_INSTANCE.UPDATED'
+ METADATA_INSTANCE_DELETED = 'METADATA_INSTANCE.DELETED'
+ FOLDER_CREATED = 'FOLDER.CREATED'
+ FOLDER_RENAMED = 'FOLDER.RENAMED'
+ FOLDER_DOWNLOADED = 'FOLDER.DOWNLOADED'
+ FOLDER_RESTORED = 'FOLDER.RESTORED'
+ FOLDER_DELETED = 'FOLDER.DELETED'
+ FOLDER_COPIED = 'FOLDER.COPIED'
+ FOLDER_MOVED = 'FOLDER.MOVED'
+ FOLDER_TRASHED = 'FOLDER.TRASHED'
+ WEBHOOK_DELETED = 'WEBHOOK.DELETED'
+ COLLABORATION_CREATED = 'COLLABORATION.CREATED'
+ COLLABORATION_ACCEPTED = 'COLLABORATION.ACCEPTED'
+ COLLABORATION_REJECTED = 'COLLABORATION.REJECTED'
+ COLLABORATION_REMOVED = 'COLLABORATION.REMOVED'
+ COLLABORATION_UPDATED = 'COLLABORATION.UPDATED'
+ SHARED_LINK_DELETED = 'SHARED_LINK.DELETED'
+ SHARED_LINK_CREATED = 'SHARED_LINK.CREATED'
+ SHARED_LINK_UPDATED = 'SHARED_LINK.UPDATED'
+ SIGN_REQUEST_COMPLETED = 'SIGN_REQUEST.COMPLETED'
+ SIGN_REQUEST_DECLINED = 'SIGN_REQUEST.DECLINED'
+ SIGN_REQUEST_EXPIRED = 'SIGN_REQUEST.EXPIRED'
+ SIGN_REQUEST_SIGNER_EMAIL_BOUNCED = 'SIGN_REQUEST.SIGNER_EMAIL_BOUNCED'
+
+
+class WebhookInvocation(BaseObject):
+ _discriminator = 'type', {'webhook_event'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[WebhookInvocationTypeField] = None,
+ webhook: Optional[Webhook] = None,
+ created_by: Optional[UserMini] = None,
+ created_at: Optional[DateTime] = None,
+ trigger: Optional[WebhookInvocationTriggerField] = None,
+ source: Optional[Union[File, Folder]] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this webhook invocation., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `webhook_event`., defaults to None
+ :type type: Optional[WebhookInvocationTypeField], optional
+ :param created_at: A timestamp identifying the time that
+ the webhook event was triggered., defaults to None
+ :type created_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.webhook = webhook
+ self.created_by = created_by
+ self.created_at = created_at
+ self.trigger = trigger
+ self.source = source
diff --git a/box_sdk_gen/schemas/webhook_mini.py b/box_sdk_gen/schemas/webhook_mini.py
new file mode 100644
index 000000000..b9d33c3d8
--- /dev/null
+++ b/box_sdk_gen/schemas/webhook_mini.py
@@ -0,0 +1,62 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class WebhookMiniTypeField(str, Enum):
+ WEBHOOK = 'webhook'
+
+
+class WebhookMiniTargetTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class WebhookMiniTargetField(BaseObject):
+ _discriminator = 'type', {'file', 'folder'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[WebhookMiniTargetTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The ID of the item to trigger a webhook., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of item to trigger a webhook., defaults to None
+ :type type: Optional[WebhookMiniTargetTypeField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+
+
+class WebhookMini(BaseObject):
+ _discriminator = 'type', {'webhook'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[WebhookMiniTypeField] = None,
+ target: Optional[WebhookMiniTargetField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for this webhook., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `webhook`., defaults to None
+ :type type: Optional[WebhookMiniTypeField], optional
+ :param target: The item that will trigger the webhook., defaults to None
+ :type target: Optional[WebhookMiniTargetField], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.target = target
diff --git a/box_sdk_gen/schemas/webhooks.py b/box_sdk_gen/schemas/webhooks.py
new file mode 100644
index 000000000..779086e51
--- /dev/null
+++ b/box_sdk_gen/schemas/webhooks.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.webhook_mini import WebhookMini
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Webhooks(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[WebhookMini]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of webhooks., defaults to None
+ :type entries: Optional[List[WebhookMini]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/workflow.py b/box_sdk_gen/schemas/workflow.py
new file mode 100644
index 000000000..2d5ecc394
--- /dev/null
+++ b/box_sdk_gen/schemas/workflow.py
@@ -0,0 +1,295 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.schemas.workflow_mini import WorkflowMiniTypeField
+
+from box_sdk_gen.schemas.workflow_mini import WorkflowMini
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class WorkflowFlowsTypeField(str, Enum):
+ FLOW = 'flow'
+
+
+class WorkflowFlowsTriggerTypeField(str, Enum):
+ TRIGGER = 'trigger'
+
+
+class WorkflowFlowsTriggerTriggerTypeField(str, Enum):
+ WORKFLOW_MANUAL_START = 'WORKFLOW_MANUAL_START'
+
+
+class WorkflowFlowsTriggerScopeTypeField(str, Enum):
+ TRIGGER_SCOPE = 'trigger_scope'
+
+
+class WorkflowFlowsTriggerScopeObjectTypeField(str, Enum):
+ FOLDER = 'folder'
+
+
+class WorkflowFlowsTriggerScopeObjectField(BaseObject):
+ _discriminator = 'type', {'folder'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[WorkflowFlowsTriggerScopeObjectTypeField] = None,
+ id: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param type: The type of the object., defaults to None
+ :type type: Optional[WorkflowFlowsTriggerScopeObjectTypeField], optional
+ :param id: The id of the object., defaults to None
+ :type id: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class WorkflowFlowsTriggerScopeField(BaseObject):
+ _discriminator = 'type', {'trigger_scope'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[WorkflowFlowsTriggerScopeTypeField] = None,
+ ref: Optional[str] = None,
+ object: Optional[WorkflowFlowsTriggerScopeObjectField] = None,
+ **kwargs
+ ):
+ """
+ :param type: The trigger scope's resource type., defaults to None
+ :type type: Optional[WorkflowFlowsTriggerScopeTypeField], optional
+ :param ref: Indicates the path of the condition value to check., defaults to None
+ :type ref: Optional[str], optional
+ :param object: The object the `ref` points to., defaults to None
+ :type object: Optional[WorkflowFlowsTriggerScopeObjectField], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.ref = ref
+ self.object = object
+
+
+class WorkflowFlowsTriggerField(BaseObject):
+ _discriminator = 'type', {'trigger'}
+
+ def __init__(
+ self,
+ *,
+ type: Optional[WorkflowFlowsTriggerTypeField] = None,
+ trigger_type: Optional[WorkflowFlowsTriggerTriggerTypeField] = None,
+ scope: Optional[List[WorkflowFlowsTriggerScopeField]] = None,
+ **kwargs
+ ):
+ """
+ :param type: The trigger's resource type., defaults to None
+ :type type: Optional[WorkflowFlowsTriggerTypeField], optional
+ :param trigger_type: The type of trigger selected for this flow., defaults to None
+ :type trigger_type: Optional[WorkflowFlowsTriggerTriggerTypeField], optional
+ :param scope: List of trigger scopes., defaults to None
+ :type scope: Optional[List[WorkflowFlowsTriggerScopeField]], optional
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.trigger_type = trigger_type
+ self.scope = scope
+
+
+class WorkflowFlowsOutcomesTypeField(str, Enum):
+ OUTCOME = 'outcome'
+
+
+class WorkflowFlowsOutcomesActionTypeField(str, Enum):
+ ADD_METADATA = 'add_metadata'
+ ASSIGN_TASK = 'assign_task'
+ COPY_FILE = 'copy_file'
+ COPY_FOLDER = 'copy_folder'
+ CREATE_FOLDER = 'create_folder'
+ DELETE_FILE = 'delete_file'
+ DELETE_FOLDER = 'delete_folder'
+ LOCK_FILE = 'lock_file'
+ MOVE_FILE = 'move_file'
+ MOVE_FOLDER = 'move_folder'
+ REMOVE_WATERMARK_FILE = 'remove_watermark_file'
+ RENAME_FOLDER = 'rename_folder'
+ RESTORE_FOLDER = 'restore_folder'
+ SHARE_FILE = 'share_file'
+ SHARE_FOLDER = 'share_folder'
+ UNLOCK_FILE = 'unlock_file'
+ UPLOAD_FILE = 'upload_file'
+ WAIT_FOR_TASK = 'wait_for_task'
+ WATERMARK_FILE = 'watermark_file'
+ GO_BACK_TO_STEP = 'go_back_to_step'
+ APPLY_FILE_CLASSIFICATION = 'apply_file_classification'
+ APPLY_FOLDER_CLASSIFICATION = 'apply_folder_classification'
+ SEND_NOTIFICATION = 'send_notification'
+
+
+class WorkflowFlowsOutcomesIfRejectedTypeField(str, Enum):
+ OUTCOME = 'outcome'
+
+
+class WorkflowFlowsOutcomesIfRejectedActionTypeField(str, Enum):
+ ADD_METADATA = 'add_metadata'
+ ASSIGN_TASK = 'assign_task'
+ COPY_FILE = 'copy_file'
+ COPY_FOLDER = 'copy_folder'
+ CREATE_FOLDER = 'create_folder'
+ DELETE_FILE = 'delete_file'
+ DELETE_FOLDER = 'delete_folder'
+ LOCK_FILE = 'lock_file'
+ MOVE_FILE = 'move_file'
+ MOVE_FOLDER = 'move_folder'
+ REMOVE_WATERMARK_FILE = 'remove_watermark_file'
+ RENAME_FOLDER = 'rename_folder'
+ RESTORE_FOLDER = 'restore_folder'
+ SHARE_FILE = 'share_file'
+ SHARE_FOLDER = 'share_folder'
+ UNLOCK_FILE = 'unlock_file'
+ UPLOAD_FILE = 'upload_file'
+ WAIT_FOR_TASK = 'wait_for_task'
+ WATERMARK_FILE = 'watermark_file'
+ GO_BACK_TO_STEP = 'go_back_to_step'
+ APPLY_FILE_CLASSIFICATION = 'apply_file_classification'
+ APPLY_FOLDER_CLASSIFICATION = 'apply_folder_classification'
+ SEND_NOTIFICATION = 'send_notification'
+
+
+class WorkflowFlowsOutcomesIfRejectedField(BaseObject):
+ _discriminator = 'type', {'outcome'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[WorkflowFlowsOutcomesIfRejectedTypeField] = None,
+ name: Optional[str] = None,
+ action_type: Optional[WorkflowFlowsOutcomesIfRejectedActionTypeField] = None,
+ **kwargs
+ ):
+ """
+ :param id: The identifier of the outcome., defaults to None
+ :type id: Optional[str], optional
+ :param type: The outcomes resource type., defaults to None
+ :type type: Optional[WorkflowFlowsOutcomesIfRejectedTypeField], optional
+ :param name: The name of the outcome., defaults to None
+ :type name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+ self.action_type = action_type
+
+
+class WorkflowFlowsOutcomesField(BaseObject):
+ _discriminator = 'type', {'outcome'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[WorkflowFlowsOutcomesTypeField] = None,
+ name: Optional[str] = None,
+ action_type: Optional[WorkflowFlowsOutcomesActionTypeField] = None,
+ if_rejected: Optional[List[WorkflowFlowsOutcomesIfRejectedField]] = None,
+ **kwargs
+ ):
+ """
+ :param id: The identifier of the outcome., defaults to None
+ :type id: Optional[str], optional
+ :param type: The outcomes resource type., defaults to None
+ :type type: Optional[WorkflowFlowsOutcomesTypeField], optional
+ :param name: The name of the outcome., defaults to None
+ :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., defaults to None
+ :type if_rejected: Optional[List[WorkflowFlowsOutcomesIfRejectedField]], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+ self.action_type = action_type
+ self.if_rejected = if_rejected
+
+
+class WorkflowFlowsField(BaseObject):
+ _discriminator = 'type', {'flow'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[WorkflowFlowsTypeField] = None,
+ trigger: Optional[WorkflowFlowsTriggerField] = None,
+ outcomes: Optional[List[WorkflowFlowsOutcomesField]] = None,
+ created_at: Optional[DateTime] = None,
+ created_by: Optional[UserBase] = None,
+ **kwargs
+ ):
+ """
+ :param id: The identifier of the flow., defaults to None
+ :type id: Optional[str], optional
+ :param type: The flow's resource type., defaults to None
+ :type type: Optional[WorkflowFlowsTypeField], optional
+ :param created_at: When this flow was created., defaults to None
+ :type created_at: Optional[DateTime], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.trigger = trigger
+ self.outcomes = outcomes
+ self.created_at = created_at
+ self.created_by = created_by
+
+
+class Workflow(WorkflowMini):
+ def __init__(
+ self,
+ *,
+ flows: Optional[List[WorkflowFlowsField]] = None,
+ id: Optional[str] = None,
+ type: Optional[WorkflowMiniTypeField] = None,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ is_enabled: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param flows: A list of flows assigned to a workflow., defaults to None
+ :type flows: Optional[List[WorkflowFlowsField]], optional
+ :param id: The unique identifier for the workflow., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `workflow`., defaults to None
+ :type type: Optional[WorkflowMiniTypeField], optional
+ :param name: The name of the workflow., defaults to None
+ :type name: Optional[str], optional
+ :param description: The description for a workflow., defaults to None
+ :type description: Optional[str], optional
+ :param is_enabled: Specifies if this workflow is enabled., defaults to None
+ :type is_enabled: Optional[bool], optional
+ """
+ super().__init__(
+ id=id,
+ type=type,
+ name=name,
+ description=description,
+ is_enabled=is_enabled,
+ **kwargs
+ )
+ self.flows = flows
diff --git a/box_sdk_gen/schemas/workflow_full.py b/box_sdk_gen/schemas/workflow_full.py
new file mode 100644
index 000000000..38a783c23
--- /dev/null
+++ b/box_sdk_gen/schemas/workflow_full.py
@@ -0,0 +1,66 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.schemas.workflow_mini import WorkflowMiniTypeField
+
+from box_sdk_gen.schemas.workflow_mini import WorkflowMini
+
+from box_sdk_gen.schemas.workflow import WorkflowFlowsField
+
+from box_sdk_gen.schemas.workflow import Workflow
+
+from box_sdk_gen.schemas.user_base import UserBase
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class WorkflowFull(Workflow):
+ def __init__(
+ self,
+ *,
+ created_at: Optional[DateTime] = None,
+ modified_at: Optional[DateTime] = None,
+ created_by: Optional[UserBase] = None,
+ modified_by: Optional[UserBase] = None,
+ flows: Optional[List[WorkflowFlowsField]] = None,
+ id: Optional[str] = None,
+ type: Optional[WorkflowMiniTypeField] = None,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ is_enabled: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param created_at: The date and time when the workflow was created on Box., defaults to None
+ :type created_at: Optional[DateTime], optional
+ :param modified_at: The date and time when the workflow was last updated on Box., defaults to None
+ :type modified_at: Optional[DateTime], optional
+ :param flows: A list of flows assigned to a workflow., defaults to None
+ :type flows: Optional[List[WorkflowFlowsField]], optional
+ :param id: The unique identifier for the workflow., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `workflow`., defaults to None
+ :type type: Optional[WorkflowMiniTypeField], optional
+ :param name: The name of the workflow., defaults to None
+ :type name: Optional[str], optional
+ :param description: The description for a workflow., defaults to None
+ :type description: Optional[str], optional
+ :param is_enabled: Specifies if this workflow is enabled., defaults to None
+ :type is_enabled: Optional[bool], optional
+ """
+ super().__init__(
+ flows=flows,
+ id=id,
+ type=type,
+ name=name,
+ description=description,
+ is_enabled=is_enabled,
+ **kwargs
+ )
+ self.created_at = created_at
+ self.modified_at = modified_at
+ self.created_by = created_by
+ self.modified_by = modified_by
diff --git a/box_sdk_gen/schemas/workflow_mini.py b/box_sdk_gen/schemas/workflow_mini.py
new file mode 100644
index 000000000..7b5f9e386
--- /dev/null
+++ b/box_sdk_gen/schemas/workflow_mini.py
@@ -0,0 +1,44 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class WorkflowMiniTypeField(str, Enum):
+ WORKFLOW = 'workflow'
+
+
+class WorkflowMini(BaseObject):
+ _discriminator = 'type', {'workflow'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[WorkflowMiniTypeField] = None,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ is_enabled: Optional[bool] = None,
+ **kwargs
+ ):
+ """
+ :param id: The unique identifier for the workflow., defaults to None
+ :type id: Optional[str], optional
+ :param type: The value will always be `workflow`., defaults to None
+ :type type: Optional[WorkflowMiniTypeField], optional
+ :param name: The name of the workflow., defaults to None
+ :type name: Optional[str], optional
+ :param description: The description for a workflow., defaults to None
+ :type description: Optional[str], optional
+ :param is_enabled: Specifies if this workflow is enabled., defaults to None
+ :type is_enabled: Optional[bool], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+ self.description = description
+ self.is_enabled = is_enabled
diff --git a/box_sdk_gen/schemas/workflows.py b/box_sdk_gen/schemas/workflows.py
new file mode 100644
index 000000000..0fdb1abad
--- /dev/null
+++ b/box_sdk_gen/schemas/workflows.py
@@ -0,0 +1,38 @@
+from typing import Optional
+
+from typing import List
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.schemas.workflow import Workflow
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class Workflows(BaseObject):
+ def __init__(
+ self,
+ *,
+ limit: Optional[int] = None,
+ next_marker: Optional[str] = None,
+ prev_marker: Optional[str] = None,
+ entries: Optional[List[Workflow]] = None,
+ **kwargs
+ ):
+ """
+ :param limit: The limit that was used for these entries. This will be the same as the
+ `limit` query parameter unless that value exceeded the maximum value
+ allowed. The maximum value varies by API., defaults to None
+ :type limit: Optional[int], optional
+ :param next_marker: The marker for the start of the next page of results., defaults to None
+ :type next_marker: Optional[str], optional
+ :param prev_marker: The marker for the start of the previous page of results., defaults to None
+ :type prev_marker: Optional[str], optional
+ :param entries: A list of workflows., defaults to None
+ :type entries: Optional[List[Workflow]], optional
+ """
+ super().__init__(**kwargs)
+ self.limit = limit
+ self.next_marker = next_marker
+ self.prev_marker = prev_marker
+ self.entries = entries
diff --git a/box_sdk_gen/schemas/zip_download.py b/box_sdk_gen/schemas/zip_download.py
new file mode 100644
index 000000000..37d5c22bd
--- /dev/null
+++ b/box_sdk_gen/schemas/zip_download.py
@@ -0,0 +1,103 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+from box_sdk_gen.internal.utils import DateTime
+
+
+class ZipDownloadNameConflictsTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class ZipDownloadNameConflictsField(BaseObject):
+ _discriminator = 'type', {'file', 'folder'}
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[ZipDownloadNameConflictsTypeField] = None,
+ original_name: Optional[str] = None,
+ download_name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param id: The identifier of the item., defaults to None
+ :type id: Optional[str], optional
+ :param type: The type of this item., defaults to None
+ :type type: Optional[ZipDownloadNameConflictsTypeField], optional
+ :param original_name: Box Developer Documentation., defaults to None
+ :type original_name: Optional[str], optional
+ :param download_name: The new name of this item as it will appear in the
+ downloaded `zip` archive., defaults to None
+ :type download_name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.original_name = original_name
+ self.download_name = download_name
+
+
+class ZipDownload(BaseObject):
+ def __init__(
+ self,
+ *,
+ download_url: Optional[str] = None,
+ status_url: Optional[str] = None,
+ expires_at: Optional[DateTime] = None,
+ name_conflicts: Optional[List[List[ZipDownloadNameConflictsField]]] = None,
+ **kwargs
+ ):
+ """
+ :param download_url: The URL that can be used to download the `zip` archive. A `Get` request to
+ this URL will start streaming the items requested. By default, this URL
+ is only valid for a few seconds, until the `expires_at` time, unless a
+ download is started after which it is valid for the duration of the
+ download.
+
+ It is important to note that the domain and path of this URL might change
+ between API calls, and therefore it's important to use this URL as-is., defaults to None
+ :type download_url: Optional[str], optional
+ :param status_url: The URL that can be used to get the status of the `zip` archive being
+ downloaded. A `Get` request to this URL will return the number of files
+ in the archive as well as the number of items already downloaded or
+ skipped. By default, this URL is only valid for a few seconds, until the
+ `expires_at` time, unless a download is started after which the URL is
+ valid for 12 hours from the start of the download.
+
+ It is important to note that the domain and path of this URL might change
+ between API calls, and therefore it's important to use this URL as-is., defaults to None
+ :type status_url: Optional[str], optional
+ :param expires_at: The time and date when this archive will expire. After this time the
+ `status_url` and `download_url` will return an error.
+
+ By default, these URLs are only valid for a few seconds, unless a download
+ is started after which the `download_url` is valid for the duration of the
+ download, and the `status_url` is valid for 12 hours from the start of the
+ download., defaults to None
+ :type expires_at: Optional[DateTime], optional
+ :param name_conflicts: A list of conflicts that occurred when trying to create the archive. This
+ would occur when multiple items have been requested with the
+ same name.
+
+ To solve these conflicts, the API will automatically rename an item
+ and return a mapping between the original item's name and its new
+ name.
+
+ For every conflict, both files will be renamed and therefore this list
+ will always be a multiple of 2., defaults to None
+ :type name_conflicts: Optional[List[List[ZipDownloadNameConflictsField]]], optional
+ """
+ super().__init__(**kwargs)
+ self.download_url = download_url
+ self.status_url = status_url
+ self.expires_at = expires_at
+ self.name_conflicts = name_conflicts
diff --git a/box_sdk_gen/schemas/zip_download_request.py b/box_sdk_gen/schemas/zip_download_request.py
new file mode 100644
index 000000000..45185b6f5
--- /dev/null
+++ b/box_sdk_gen/schemas/zip_download_request.py
@@ -0,0 +1,51 @@
+from enum import Enum
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from typing import List
+
+from typing import Optional
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ZipDownloadRequestItemsTypeField(str, Enum):
+ FILE = 'file'
+ FOLDER = 'folder'
+
+
+class ZipDownloadRequestItemsField(BaseObject):
+ _discriminator = 'type', {'file', 'folder'}
+
+ def __init__(self, type: ZipDownloadRequestItemsTypeField, id: str, **kwargs):
+ """
+ :param type: The type of the item to add to the archive.
+ :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
+ """
+ super().__init__(**kwargs)
+ self.type = type
+ self.id = id
+
+
+class ZipDownloadRequest(BaseObject):
+ def __init__(
+ self,
+ items: List[ZipDownloadRequestItemsField],
+ *,
+ download_file_name: Optional[str] = None,
+ **kwargs
+ ):
+ """
+ :param items: A list of items to add to the `zip` archive. These can
+ be folders or files.
+ :type items: List[ZipDownloadRequestItemsField]
+ :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`., defaults to None
+ :type download_file_name: Optional[str], optional
+ """
+ super().__init__(**kwargs)
+ self.items = items
+ self.download_file_name = download_file_name
diff --git a/box_sdk_gen/schemas/zip_download_status.py b/box_sdk_gen/schemas/zip_download_status.py
new file mode 100644
index 000000000..2923e3a0a
--- /dev/null
+++ b/box_sdk_gen/schemas/zip_download_status.py
@@ -0,0 +1,50 @@
+from enum import Enum
+
+from typing import Optional
+
+from box_sdk_gen.internal.base_object import BaseObject
+
+from box_sdk_gen.box.errors import BoxSDKError
+
+
+class ZipDownloadStatusStateField(str, Enum):
+ IN_PROGRESS = 'in_progress'
+ FAILED = 'failed'
+ SUCCEEDED = 'succeeded'
+
+
+class ZipDownloadStatus(BaseObject):
+ def __init__(
+ self,
+ *,
+ total_file_count: Optional[int] = None,
+ downloaded_file_count: Optional[int] = None,
+ skipped_file_count: Optional[int] = None,
+ skipped_folder_count: Optional[int] = None,
+ state: Optional[ZipDownloadStatusStateField] = None,
+ **kwargs
+ ):
+ """
+ :param total_file_count: The total number of files in the archive., defaults to None
+ :type total_file_count: Optional[int], optional
+ :param downloaded_file_count: The number of files that have already been downloaded., defaults to None
+ :type downloaded_file_count: Optional[int], optional
+ :param skipped_file_count: The number of files that have been skipped as they could not be
+ downloaded. In many cases this is due to permission issues that have
+ surfaced between the creation of the request for the archive and the
+ archive being downloaded., defaults to None
+ :type skipped_file_count: Optional[int], optional
+ :param skipped_folder_count: The number of folders that have been skipped as they could not be
+ downloaded. In many cases this is due to permission issues that have
+ surfaced between the creation of the request for the archive and the
+ archive being downloaded., defaults to None
+ :type skipped_folder_count: Optional[int], optional
+ :param state: The state of the archive being downloaded., defaults to None
+ :type state: Optional[ZipDownloadStatusStateField], optional
+ """
+ super().__init__(**kwargs)
+ self.total_file_count = total_file_count
+ self.downloaded_file_count = downloaded_file_count
+ self.skipped_file_count = skipped_file_count
+ self.skipped_folder_count = skipped_folder_count
+ self.state = state
diff --git a/box_sdk_gen/serialization/__init__.py b/box_sdk_gen/serialization/__init__.py
new file mode 100644
index 000000000..c4b7d4cac
--- /dev/null
+++ b/box_sdk_gen/serialization/__init__.py
@@ -0,0 +1 @@
+from box_sdk_gen.serialization.json import *
diff --git a/box_sdk_gen/serialization/json.py b/box_sdk_gen/serialization/json.py
new file mode 100644
index 000000000..7d7b580c0
--- /dev/null
+++ b/box_sdk_gen/serialization/json.py
@@ -0,0 +1,66 @@
+import json
+from typing import Dict, get_origin, Union, Type
+from urllib.parse import urlencode
+
+from ..internal.base_object import BaseObject
+
+SerializedData = Dict
+
+
+def json_to_serialized_data(data: str) -> SerializedData:
+ return json.loads(data)
+
+
+def sd_to_json(data: SerializedData) -> str:
+ return json.dumps(data)
+
+
+def sd_to_url_params(data: SerializedData) -> str:
+ return urlencode(data)
+
+
+def get_sd_value_by_key(data: SerializedData, key: str):
+ return data.get(key)
+
+
+def serialize(obj: Union[BaseObject, dict, list]) -> SerializedData:
+ if isinstance(obj, dict):
+ obj = BaseObject(**obj).to_dict()
+ if isinstance(obj, BaseObject):
+ obj = obj.to_dict()
+ if isinstance(obj, list):
+ obj = [
+ element.to_dict() if isinstance(element, BaseObject) else element
+ for element in obj
+ ]
+ return obj
+
+
+def deserialize(value: SerializedData, type: Type[BaseObject]):
+ if get_origin(type) == Union:
+ type = BaseObject._deserialize_union('', value, type)
+ obj = type.from_dict(value)
+ obj._raw_data = value
+ return obj
+
+
+def sanitized_value() -> str:
+ return '---[redacted]---'
+
+
+def sanitize_serialized_data(
+ sd: SerializedData, keys_to_sanitize: Dict[str, str]
+) -> SerializedData:
+ if not isinstance(sd, Dict):
+ return sd
+ sanitized_dictionary = {}
+ for key, value in sd.items():
+ if key.lower() in keys_to_sanitize and isinstance(value, str):
+ sanitized_dictionary[key] = sanitized_value()
+ elif isinstance(value, Dict):
+ sanitized_dictionary[key] = sanitize_serialized_data(
+ value, keys_to_sanitize
+ )
+ else:
+ sanitized_dictionary[key] = value
+ return sanitized_dictionary
diff --git a/boxsdk/__init__.py b/boxsdk/__init__.py
deleted file mode 100644
index 88e1d64fb..000000000
--- a/boxsdk/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from .auth import JWTAuth, OAuth2, CCGAuth
-from .client import * # pylint:disable=wildcard-import,redefined-builtin
-from .exception import * # pylint:disable=wildcard-import
-from .object import * # pylint:disable=wildcard-import,redefined-builtin
-from .util.log import setup_logging
-from .version import __version__
diff --git a/boxsdk/auth/__init__.py b/boxsdk/auth/__init__.py
deleted file mode 100644
index 4ff79476d..000000000
--- a/boxsdk/auth/__init__.py
+++ /dev/null
@@ -1,17 +0,0 @@
-from .cooperatively_managed_oauth2 import CooperativelyManagedOAuth2
-from .developer_token_auth import DeveloperTokenAuth
-try:
- from .jwt_auth import JWTAuth
-except ImportError:
- JWTAuth = None # If extras[jwt] are not installed, JWTAuth won't be available.
-from .ccg_auth import CCGAuth
-from .oauth2 import OAuth2
-try:
- from .redis_managed_oauth2 import RedisManagedOAuth2
-except ImportError:
- RedisManagedOAuth2 = None # If extras[redis] are not installed, RedisManagedOAuth2 won't be available.
-try:
- from .redis_managed_jwt_auth import RedisManagedJWTAuth
-except ImportError:
- RedisManagedJWTAuth = None # If extras[jwt,redis] are not installed, RedisManagedJWTAuth won't be available.
-from .remote_managed_oauth2 import RemoteOAuth2
diff --git a/boxsdk/auth/ccg_auth.py b/boxsdk/auth/ccg_auth.py
deleted file mode 100644
index fb7155057..000000000
--- a/boxsdk/auth/ccg_auth.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from datetime import datetime
-from typing import Optional
-
-from boxsdk.auth.server_auth import ServerAuth
-
-
-class CCGAuth(ServerAuth):
- _GRANT_TYPE = 'client_credentials'
-
- def _fetch_access_token(self, subject_id: str, subject_type: str, now_time: Optional[datetime] = None) -> str:
- data = {
- 'grant_type': self._GRANT_TYPE,
- 'client_id': self._client_id,
- 'client_secret': self._client_secret,
- 'box_subject_id': subject_id,
- 'box_subject_type': subject_type,
- }
-
- return self.send_token_request(data, access_token=None, expect_refresh_token=False)[0]
diff --git a/boxsdk/auth/cooperatively_managed_oauth2.py b/boxsdk/auth/cooperatively_managed_oauth2.py
deleted file mode 100644
index f324a84e7..000000000
--- a/boxsdk/auth/cooperatively_managed_oauth2.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from typing import Callable, Tuple, Any
-
-from .oauth2 import OAuth2
-
-
-class CooperativelyManagedOAuth2Mixin(OAuth2):
- """
- Box SDK OAuth2 mixin.
- Allows for sharing auth tokens between multiple clients.
- """
- def __init__(self, retrieve_tokens: Callable[[], Tuple[str, str]] = None, *args: Any, **kwargs: Any):
- """
- :param retrieve_tokens:
- Callback to get the current access/refresh token pair.
- """
- # pylint:disable=keyword-arg-before-vararg
- self._retrieve_tokens = retrieve_tokens
- super().__init__(*args, **kwargs)
-
- def _get_tokens(self) -> Tuple[str, str]:
- """
- Base class override. Get the tokens from the user-specified callback.
- """
- return self._retrieve_tokens()
-
-
-class CooperativelyManagedOAuth2(CooperativelyManagedOAuth2Mixin):
- """
- Box SDK OAuth2 subclass.
- Allows for sharing auth tokens between multiple clients. The retrieve_tokens callback should
- return the current access/refresh token pair.
- """
diff --git a/boxsdk/auth/developer_token_auth.py b/boxsdk/auth/developer_token_auth.py
deleted file mode 100644
index 30a17132e..000000000
--- a/boxsdk/auth/developer_token_auth.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from typing import Callable, Any, Tuple, Optional
-
-from .oauth2 import OAuth2
-
-
-class DeveloperTokenAuth(OAuth2):
- ENTER_TOKEN_PROMPT = 'Enter developer token: '
-
- def __init__(self, get_new_token_callback: Callable[[], str] = None, **kwargs: Any):
- self._get_new_token = get_new_token_callback
- super().__init__(
- client_id=None,
- client_secret=None,
- access_token=self._refresh_developer_token(),
- **kwargs
- )
-
- def _refresh_developer_token(self) -> str:
- if self._get_new_token is not None:
- return self._get_new_token()
-
- return input(self.ENTER_TOKEN_PROMPT)
-
- def _refresh(self, access_token: str) -> Tuple[str, Optional[str]]:
- """
- Base class override.
- Ask for a new developer token.
- """
- self._access_token = self._refresh_developer_token()
- return self._access_token, None
-
- def revoke(self) -> None:
- """
- Base class override.
- Do nothing; developer tokens can't be revoked without client ID and secret.
- """
diff --git a/boxsdk/auth/jwt_auth.py b/boxsdk/auth/jwt_auth.py
deleted file mode 100644
index faf245828..000000000
--- a/boxsdk/auth/jwt_auth.py
+++ /dev/null
@@ -1,271 +0,0 @@
-from datetime import datetime, timedelta
-import json
-import random
-import string
-from io import IOBase
-from typing import Optional, Union, Callable, TYPE_CHECKING, Any
-from cryptography.hazmat.backends import default_backend
-from cryptography.hazmat.primitives import serialization
-from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey
-import jwt
-
-from boxsdk.auth.server_auth import ServerAuth
-
-if TYPE_CHECKING:
- from boxsdk.network.network_interface import Network
- from boxsdk.object.user import User
-
-
-class JWTAuth(ServerAuth):
- """
- Responsible for handling JWT Auth for Box Developer Edition. Can authenticate enterprise instances or app users.
- """
- _GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:jwt-bearer'
-
- def __init__(
- self,
- client_id: str,
- client_secret: str,
- enterprise_id: Optional[str],
- jwt_key_id: str,
- rsa_private_key_file_sys_path: Optional[str] = None,
- rsa_private_key_passphrase: Optional[Union[str, bytes]] = None,
- user: Optional[Union[str, 'User']] = None,
- store_tokens: Optional[Callable[[str, str], None]] = None,
- box_device_id: str = '0',
- box_device_name: str = '',
- access_token: str = None,
- session: Optional['Network'] = None,
- jwt_algorithm: str = 'RS256',
- rsa_private_key_data: Union[bytes, IOBase, RSAPrivateKey] = None,
- **kwargs
- ):
- """Extends baseclass method.
-
- Must pass exactly one of either `rsa_private_key_file_sys_path` or
- `rsa_private_key_data`.
-
- If both `enterprise_id` and `user` are non-`None`, the `user` takes
- precedence when `refresh()` is called. This can be overruled with a
- call to `authenticate_instance()`.
-
- :param client_id:
- Box API key used for identifying the application the user is authenticating with.
- :param client_secret:
- Box API secret used for making OAuth2 requests.
- :param enterprise_id:
- The ID of the Box Developer Edition enterprise.
-
- May be `None`, if the caller knows that it will not be
- authenticating as an enterprise instance / service account.
-
- If `user` is passed, this value is not used, unless
- `authenticate_instance()` is called to clear the user and
- authenticate as the enterprise instance.
- :param jwt_key_id:
- Key ID for the JWT assertion.
- :param rsa_private_key_file_sys_path:
- (optional) Path to an RSA private key file, used for signing the JWT assertion.
- :param rsa_private_key_passphrase:
- Passphrase used to unlock the private key. Do not pass a unicode string - this must be bytes.
- :param user:
- (optional) The user to authenticate, expressed as a Box User ID or
- as a :class:`User` instance.
-
- This value is not required. But if it is provided, then the user
- will be auto-authenticated at the time of the first API call or
- when calling `authenticate_user()` without any arguments.
-
- Should be `None` if the intention is to authenticate as the
- enterprise instance / service account. If both `enterprise_id` and
- `user` are non-`None`, the `user` takes precedense when `refresh()`
- is called.
-
- May be one of this application's created App User. Depending on the
- configured User Access Level, may also be any other App User or
- Managed User in the enterprise.
-
-
-
- :param store_tokens:
- Optional callback to get access to tokens and store them. Callback method should take two
- paramaters - access_token: str and refresh_token: str - and it is not expected to return anything.
- :param box_device_id:
- Optional unique ID of this device. Used for applications that want to support device-pinning.
- :param box_device_name:
- Optional human-readable name for this device.
- :param access_token:
- Access token to use for auth until it expires.
- :param session:
- If specified, use it to make network requests. If not, the default session will be used.
- :param jwt_algorithm:
- Which algorithm to use for signing the JWT assertion. Must be one of 'RS256', 'RS384', 'RS512'.
- :param rsa_private_key_data:
- (optional) Contents of RSA private key, used for signing the JWT assertion. Do not pass a
- unicode string. Can pass a byte string, or a file-like object that returns bytes, or an
- already-loaded `RSAPrivateKey` object.
- """
- rsa_private_key = self._normalize_rsa_private_key(
- file_sys_path=rsa_private_key_file_sys_path,
- data=rsa_private_key_data,
- passphrase=rsa_private_key_passphrase,
- )
- del rsa_private_key_data
- del rsa_private_key_file_sys_path
- super().__init__(
- client_id=client_id,
- client_secret=client_secret,
- enterprise_id=enterprise_id,
- user=user,
- store_tokens=store_tokens,
- box_device_id=box_device_id,
- box_device_name=box_device_name,
- access_token=access_token,
- refresh_token=None,
- session=session,
- **kwargs
- )
- self._rsa_private_key = rsa_private_key
- self._jwt_algorithm = jwt_algorithm
- self._jwt_key_id = jwt_key_id
-
- def _fetch_access_token(self, subject_id: str, subject_type: str, now_time: Optional[datetime] = None) -> str:
- """
- Construct the claims used for JWT auth and send a request to get a JWT.
- Pass an enterprise ID to get an enterprise token (which can be used to provision/deprovision users),
- or a user ID to get a user token.
-
- :param subject_id:
- The enterprise ID or user ID to auth.
- :param subject_type:
- Either 'enterprise' or 'user'
- :param now_time:
- Optional. The current UTC time is needed in order to construct the expiration time of the JWT claim.
- If None, `datetime.utcnow()` will be used.
- :return:
- The access token for the enterprise or app user.
- """
- system_random = random.SystemRandom()
- jti_length = system_random.randint(16, 128)
- ascii_alphabet = string.ascii_letters + string.digits
- ascii_len = len(ascii_alphabet)
- jti = ''.join(ascii_alphabet[int(system_random.random() * ascii_len)] for _ in range(jti_length))
- if now_time is None:
- now_time = datetime.utcnow()
- now_plus_30 = now_time + timedelta(seconds=30)
- assertion = jwt.encode(
- {
- 'iss': self._client_id,
- 'sub': subject_id,
- 'box_sub_type': subject_type,
- 'aud': 'https://api.box.com/oauth2/token',
- 'jti': jti,
- 'exp': int((now_plus_30 - datetime(1970, 1, 1)).total_seconds()),
- },
- self._rsa_private_key,
- algorithm=self._jwt_algorithm,
- headers={
- 'kid': self._jwt_key_id,
- },
- )
- data = {
- 'grant_type': self._GRANT_TYPE,
- 'client_id': self._client_id,
- 'client_secret': self._client_secret,
- 'assertion': assertion,
- }
- if self._box_device_id:
- data['box_device_id'] = self._box_device_id
- if self._box_device_name:
- data['box_device_name'] = self._box_device_name
- return self.send_token_request(data, access_token=None, expect_refresh_token=False)[0]
-
- @classmethod
- def _normalize_rsa_private_key(
- cls,
- file_sys_path: str,
- data: Union[bytes, IOBase, RSAPrivateKey],
- passphrase: Optional[Union[str, bytes]] = None
- ) -> Any:
- if len(list(filter(None, [file_sys_path, data]))) != 1:
- raise TypeError("must pass exactly one of either rsa_private_key_file_sys_path or rsa_private_key_data")
- if file_sys_path:
- with open(file_sys_path, 'rb') as key_file:
- data = key_file.read()
- if hasattr(data, 'read') and callable(data.read):
- data = data.read()
- if isinstance(data, str):
- try:
- data = data.encode('ascii')
- except UnicodeError as unicode_error:
- raise TypeError(
- "rsa_private_key_data must contain binary data (bytes/str), not a text/unicode string"
- ) from unicode_error
-
- if isinstance(data, bytes):
- passphrase = cls._normalize_rsa_private_key_passphrase(passphrase)
- return serialization.load_pem_private_key(
- data,
- password=passphrase,
- backend=default_backend(),
- )
- if isinstance(data, RSAPrivateKey):
- return data
- raise TypeError(
- 'rsa_private_key_data must be binary data (bytes/str), '
- 'a file-like object with a read() method, '
- 'or an instance of RSAPrivateKey, '
- f'but got {data.__class__.__name__!r}'
- )
-
- @staticmethod
- def _normalize_rsa_private_key_passphrase(passphrase: Any):
- if isinstance(passphrase, str):
- try:
- return passphrase.encode('ascii')
- except UnicodeError as unicode_error:
- raise TypeError(
- "rsa_private_key_passphrase must contain binary data (bytes/str), not a text/unicode string"
- ) from unicode_error
-
- if not isinstance(passphrase, (bytes, type(None))):
- raise TypeError(
- f"rsa_private_key_passphrase must contain binary data (bytes/str), "
- f"got {passphrase.__class__.__name__!r}"
- )
- return passphrase
-
- @classmethod
- def from_settings_dictionary(cls, settings_dictionary: dict, **kwargs: Any) -> 'JWTAuth':
- """
- Create an auth instance as defined by the given settings dictionary.
-
- The dictionary should have the structure of the JSON file downloaded from the Box Developer Console.
-
- :param settings_dictionary: Dictionary containing settings for configuring app auth.
- :return: Auth instance configured as specified by the config dictionary.
- """
- if 'boxAppSettings' not in settings_dictionary:
- raise ValueError('boxAppSettings not present in configuration')
- return cls(
- client_id=settings_dictionary['boxAppSettings']['clientID'],
- client_secret=settings_dictionary['boxAppSettings']['clientSecret'],
- enterprise_id=settings_dictionary.get('enterpriseID', None),
- jwt_key_id=settings_dictionary['boxAppSettings']['appAuth'].get('publicKeyID', None),
- rsa_private_key_data=settings_dictionary['boxAppSettings']['appAuth'].get('privateKey', None),
- rsa_private_key_passphrase=settings_dictionary['boxAppSettings']['appAuth'].get('passphrase', None),
- **kwargs
- )
-
- @classmethod
- def from_settings_file(cls, settings_file_sys_path: str, **kwargs: Any) -> 'JWTAuth':
- """
- Create an auth instance as defined by a JSON file downloaded from the Box Developer Console.
- See https://developer.box.com/en/guides/authentication/jwt/ for more information.
-
- :param settings_file_sys_path: Path to the JSON file containing the configuration.
- :return: Auth instance configured as specified by the JSON file.
- """
- with open(settings_file_sys_path, encoding='utf-8') as config_file:
- config_dictionary = json.load(config_file)
- return cls.from_settings_dictionary(config_dictionary, **kwargs)
diff --git a/boxsdk/auth/oauth2.py b/boxsdk/auth/oauth2.py
deleted file mode 100644
index adbba8384..000000000
--- a/boxsdk/auth/oauth2.py
+++ /dev/null
@@ -1,455 +0,0 @@
-from contextlib import contextmanager
-from logging import getLogger
-import random
-import string # pylint:disable=deprecated-module
-from threading import Lock
-from typing import Optional, Callable, ContextManager, Tuple, TYPE_CHECKING, Any, Union
-from urllib.parse import urlunsplit, urlencode
-
-from ..config import API
-from ..exception import BoxOAuthException, BoxAPIException
-from ..object.base_api_json_object import BaseAPIJSONObject
-from ..session.session import Session
-from ..util.json import is_json_response
-from ..util.text_enum import TextEnum
-
-if TYPE_CHECKING:
- from boxsdk.session.box_response import BoxResponse
- from boxsdk import NetworkResponse
-
-
-class TokenScope(TextEnum):
- """ Scopes used for a downscope token request.
-
- See https://developer.box.com/en/guides/authentication/access-tokens/downscope/.
- """
- ITEM_READ = 'item_read'
- ITEM_READWRITE = 'item_readwrite'
- ITEM_PREVIEW = 'item_preview'
- ITEM_UPLOAD = 'item_upload'
- ITEM_SHARE = 'item_share'
- ITEM_DELETE = 'item_delete'
- ITEM_DOWNLOAD = 'item_download'
-
-
-class TokenResponse(BaseAPIJSONObject):
- """ Represents the response for a token request. """
-
-
-class OAuth2:
- """
- Responsible for handling OAuth2 for the Box API. Can authenticate and refresh tokens.
-
- Can be used as a closeable resource, similar to a file. When `close()` is
- called, the current tokens are revoked, and the object is put into a state
- where it can no longer request new tokens. This action can also be managed
- with the `closing()` context manager method.
- """
-
- def __init__(
- self,
- client_id: Optional[str],
- client_secret: Optional[str],
- store_tokens: Optional[Callable[[str, str], None]] = None,
- box_device_id: str = '0',
- box_device_name: str = '',
- access_token: Optional[str] = None,
- refresh_token: Optional[str] = None,
- session: Optional[Session] = None,
- refresh_lock: Optional[ContextManager] = None,
- ):
- """
- :param client_id:
- Box API key used for identifying the application the user is authenticating with.
- :param client_secret:
- Box API secret used for making OAuth2 requests.
- :param store_tokens:
- Optional callback to get access to tokens and store them. Callback method should take two
- paramaters - access_token: str and refresh_token: str - and it is not expected to return anything.
- :param box_device_id:
- Optional unique ID of this device. Used for applications that want to support device-pinning.
- :param box_device_name:
- Optional human-readable name for this device.
- :param access_token:
- Access token to use for auth until it expires.
- :param refresh_token:
- Refresh token to use for auth until it expires or is used.
- :param session:
- If specified, use it to make network requests. If not, the default session will be used.
- :param refresh_lock:
- Lock used to synchronize token refresh. If not specified, then a :class:`threading.Lock` will be used.
- """
- self._client_id = client_id
- self._client_secret = client_secret
- self._store_tokens_callback = store_tokens
- self._access_token = access_token
- self._refresh_token = refresh_token
- self._session = session or Session()
- self._refresh_lock = refresh_lock or Lock()
- self._box_device_id = box_device_id
- self._box_device_name = box_device_name
- self._closed = False
- self._api_config = API()
- self._logger = getLogger(__name__)
-
- @property
- def access_token(self) -> str:
- """
- Get the current access token.
-
- :return:
- current access token
- """
- return self._access_token
-
- @property
- def closed(self) -> bool:
- """True iff the auth object has been closed.
-
- When in the closed state, it can no longer request new tokens.
- """
- return self._closed
-
- @property
- def api_config(self) -> API:
- return self._api_config
-
- def get_authorization_url(self, redirect_url: Optional[str]) -> Tuple[str, str]:
- """
- Get the authorization url based on the client id and the redirect url passed in
-
- :param redirect_url:
- An HTTPS URI or custom URL scheme where the response will be redirected. Optional if the redirect URI is
- registered with Box already.
- :return:
- A tuple of the URL of Box's authorization page and the CSRF token.
- This is the URL that your application should forward the user to in first leg of OAuth 2.
- """
- csrf_token = self._get_state_csrf_token()
- # For the query string parameters, use a sequence of two-element
- # tuples, rather than a dictionary, in order to get a consistent and
- # predictable order of parameters in the output of `urlencode()`.
- params = [
- ('state', csrf_token),
- ('response_type', 'code'),
- ('client_id', self._client_id),
- ]
- if redirect_url:
- params.append(('redirect_uri', redirect_url))
- # `urlencode()` doesn't work with non-ASCII unicode characters, so
- # encode the parameters as ASCII bytes.
- params = [(key.encode('utf-8'), value.encode('utf-8')) for (key, value) in params]
- query_string = urlencode(params)
- return urlunsplit(('', '', self._api_config.OAUTH2_AUTHORIZE_URL, query_string, '')), csrf_token
-
- def authenticate(self, auth_code: Optional[str]) -> Tuple[str, str]:
- """
- Send token request and return the access_token, refresh_token tuple. The access token and refresh token will be
- stored by calling the `store_tokens` callback if provided in __init__.
-
- :param auth_code:
- An authorization code you retrieved in the first leg of OAuth 2.
- :return:
- (access_token, refresh_token)
- """
- data = {
- 'grant_type': 'authorization_code',
- 'code': auth_code,
- 'client_id': self._client_id,
- 'client_secret': self._client_secret,
- }
- if self._box_device_id:
- data['box_device_id'] = self._box_device_id
- if self._box_device_name:
- data['box_device_name'] = self._box_device_name
- return self.send_token_request(data, access_token=None)
-
- def _refresh(self, access_token: str) -> Tuple[str, str]:
- data = {
- 'grant_type': 'refresh_token',
- 'refresh_token': self._refresh_token,
- 'client_id': self._client_id,
- 'client_secret': self._client_secret,
- }
- if self._box_device_id:
- data['box_device_id'] = self._box_device_id
- if self._box_device_name:
- data['box_device_name'] = self._box_device_name
-
- return self.send_token_request(data, access_token)
-
- def _get_tokens(self) -> Tuple[Optional[str], Optional[str]]:
- """
- Get the current access and refresh tokens.
-
- This is a protected method that can be overridden to look up tokens
- from an external source (the inverse of the `store_tokens` callback).
-
- This method does not need to update this object's private token
- attributes. Its caller in :class:`OAuth2` is responsible for that.
-
- :return:
- Tuple containing the current access token and refresh token.
- One or both of them may be `None`, if they aren't set.
- """
- return self._access_token, self._refresh_token
-
- def refresh(self, access_token_to_refresh: Optional[str]) -> Tuple[str, Optional[str]]:
- """
- Refresh the access token and the refresh token and return the access_token, refresh_token tuple. The access
- token and refresh token will be stored by calling the `store_tokens` callback if provided in __init__.
-
- :param access_token_to_refresh:
- The expired access token, which needs to be refreshed.
- Pass `None` if you don't have the access token.
- :return:
- Tuple containing the new access token and refresh token.
- The refresh token may be `None`, if the authentication scheme
- doesn't use one, or keeps it hidden from this client.
- """
- self._check_closed()
- with self._refresh_lock:
- self._check_closed()
- self._logger.debug('Refreshing tokens.')
- access_token, refresh_token = self._get_and_update_current_tokens()
- # The lock here is for handling that case that multiple requests fail, due to access token expired, at the
- # same time to avoid multiple session renewals.
- if (access_token is None) or (access_token_to_refresh == access_token):
- # If the active access token is the same as the token that needs to
- # be refreshed, or if we don't currently have any active access
- # token, we make the request to refresh the token.
- access_token, refresh_token = self._refresh(access_token_to_refresh)
- # Else, if the active access token (self._access_token) is not the same as the token needs to be refreshed,
- # it means the expired token has already been refreshed. Simply return the current active tokens.
- return access_token, refresh_token
-
- @staticmethod
- def _get_state_csrf_token() -> str:
- """ Generate a random state CSRF token to be used in the authorization url.
- Example: box_csrf_token_Iijw9aU31sNdgiQu
-
- :return:
- The security token
- """
- system_random = random.SystemRandom()
- ascii_alphabet = string.ascii_letters + string.digits
- ascii_len = len(ascii_alphabet)
- return 'box_csrf_token_' + ''.join(ascii_alphabet[int(system_random.random() * ascii_len)] for _ in range(16))
-
- def _store_tokens(self, access_token: Optional[str], refresh_token: Optional[str]) -> None:
- self._update_current_tokens(access_token, refresh_token)
- if self._store_tokens_callback is not None:
- self._store_tokens_callback(access_token, refresh_token)
-
- def _get_and_update_current_tokens(self) -> Tuple[Optional[str], Optional[str]]:
- """Get the current access and refresh tokens, while also storing them in this object's private attributes.
-
- :return:
- Same as for :meth:`_get_tokens()`.
- """
- tokens = self._get_tokens()
- self._update_current_tokens(*tokens)
- return tokens
-
- def _update_current_tokens(self, access_token: Optional[str], refresh_token: Optional[str]) -> None:
- """Store the latest tokens in this object's private attributes.
-
- :param access_token:
- The latest access token.
- May be `None`, if it hasn't been provided.
- :param refresh_token:
- The latest refresh token.
- May be `None`, if the authentication scheme doesn't use one, or if
- it hasn't been provided.
- """
- self._access_token, self._refresh_token = access_token, refresh_token
-
- def _execute_token_request(
- self,
- data: dict,
- access_token: Optional[str],
- expect_refresh_token: bool = True
- ) -> TokenResponse:
- """
- Send the request to acquire or refresh an access token.
-
- :param data:
- Dictionary containing the request parameters as specified by the Box API.
- :param access_token:
- The current access token.
- :return:
- The response for the token request.
- """
- self._check_closed()
- url = f'{self._api_config.OAUTH2_API_URL}/token'
- headers = {'content-type': 'application/x-www-form-urlencoded'}
- try:
- network_response = self._session.request(
- 'POST',
- url,
- data=data,
- headers=headers,
- access_token=access_token,
- )
- except BoxAPIException as box_api_exception:
- raise self._oauth_exception(box_api_exception.network_response, url) from box_api_exception
-
- if not network_response.ok:
- raise self._oauth_exception(network_response, url)
- try:
- token_response = TokenResponse(network_response.json())
- except ValueError as value_exception:
- raise self._oauth_exception(network_response, url) from value_exception
-
- if ('access_token' not in token_response) or (expect_refresh_token and 'refresh_token' not in token_response):
- raise self._oauth_exception(network_response, url)
-
- return token_response
-
- @staticmethod
- def _oauth_exception(network_response: Union['NetworkResponse', 'BoxResponse'], url: str) -> BoxOAuthException:
- """
- Create a BoxOAuthException instance to raise. If the error response is JSON, parse it and include the
- code and message in the exception.
- """
- exception_kwargs = dict(
- status=network_response.status_code,
- url=url,
- method='POST',
- network_response=network_response,
- )
- if is_json_response(network_response):
- json_response = network_response.json()
- exception_kwargs.update(dict(
- code=json_response.get('code') or json_response.get('error'),
- message=json_response.get('message') or json_response.get('error_description'),
- ))
- else:
- exception_kwargs['message'] = network_response.content
- return BoxOAuthException(**exception_kwargs)
-
- def send_token_request(
- self,
- data: dict,
- access_token: Optional[str],
- expect_refresh_token: bool = True
- ) -> Tuple[str, str]:
- """
- Send the request to acquire or refresh an access token, and store the tokens.
-
- :param data:
- Dictionary containing the request parameters as specified by the Box API.
- :param access_token:
- The current access token.
- :param expect_refresh_token:
- Information if shoul we expect refresh token
- :return:
- The access token and refresh token.
- """
- token_response = self._execute_token_request(data, access_token, expect_refresh_token)
- # pylint:disable=no-member
- refresh_token = token_response.refresh_token if 'refresh_token' in token_response else None
- self._store_tokens(token_response.access_token, refresh_token)
- return self._access_token, self._refresh_token
-
- def revoke(self) -> None:
- """
- Revoke the authorization for the current access/refresh token pair.
- """
- with self._refresh_lock:
- access_token, refresh_token = self._get_and_update_current_tokens()
- token_to_revoke = access_token or refresh_token
- if token_to_revoke is None:
- return
- url = f'{self._api_config.OAUTH2_API_URL}/revoke'
- try:
- network_response = self._session.request(
- 'POST',
- url,
- data={
- 'client_id': self._client_id,
- 'client_secret': self._client_secret,
- 'token': token_to_revoke,
- },
- access_token=access_token,
- )
- except BoxAPIException as box_api_exception:
- raise self._oauth_exception(box_api_exception.network_response, url) from box_api_exception
-
- if not network_response.ok:
- raise BoxOAuthException(
- network_response.status_code,
- network_response.content,
- url,
- 'POST',
- network_response,
- )
- self._store_tokens(None, None)
-
- def close(self, revoke: bool = True) -> None:
- """Close the auth object.
-
- After this action is performed, the auth object can no longer request
- new tokens.
-
- This method may be called even if the auth object is already closed.
-
- :param revoke:
- (optional) Whether the current tokens should be revoked, via `revoke()`.
- Defaults to `True` as a security precaution, so that the tokens aren't usable
- by any adversaries after you are done with them.
- Note that the revoke isn't guaranteed to succeed (the network connection might
- fail, or the API call might respond with a non-200 HTTP response), so this
- isn't a fool-proof security mechanism.
- If the revoke fails, an exception is raised.
- The auth object is still considered to be closed, even if the revoke fails.
- """
- self._closed = True
- if revoke:
- self.revoke()
-
- @contextmanager
- def closing(self, **close_kwargs: Any) -> None:
- """Context manager to close the auth object on exit.
-
- The behavior is somewhat similar to `contextlib.closing(self)`, but has
- some differences.
-
- The context manager cannot be entered if the auth object is closed.
-
- If a non-`Exception` (e.g. `KeyboardInterrupt`) is caught from the
- block, this context manager prioritizes re-raising the exception as
- fast as possible, without blocking. Thus, in this case, the tokens will
- not be revoked, even if `revoke=True` was passed to this method.
-
- If exceptions are raised both from the block and from `close()`, the
- exception from the block will be reraised, and the exception from
- `close()` will be swallowed. The assumption is that the exception from
- the block is more relevant to the client, especially since the revoke
- can fail if the network is unavailable.
-
- :param close_kwargs: Keyword arguments to pass to `close()`.
- """
- self._check_closed()
- exc_infos = []
-
- # pylint:disable=broad-except
- try:
- yield self
- except Exception as exception:
- exc_infos.append(exception)
- except BaseException as base_exception:
- exc_infos.append(base_exception)
- close_kwargs['revoke'] = False
-
- try:
- self.close(**close_kwargs)
- except Exception as exception:
- exc_infos.append(exception)
-
- if exc_infos:
- raise exc_infos[0]
-
- def _check_closed(self) -> None:
- if self.closed:
- raise ValueError("operation on a closed auth object")
diff --git a/boxsdk/auth/redis_managed_jwt_auth.py b/boxsdk/auth/redis_managed_jwt_auth.py
deleted file mode 100644
index d93c400b1..000000000
--- a/boxsdk/auth/redis_managed_jwt_auth.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from typing import Tuple
-
-from .jwt_auth import JWTAuth
-from .redis_managed_oauth2 import RedisManagedOAuth2Mixin
-
-
-class RedisManagedJWTAuth(RedisManagedOAuth2Mixin, JWTAuth):
- """
- JWT Auth subclass which uses Redis to manage access tokens.
- """
- def _auth_with_jwt(self, sub: str, sub_type: str) -> Tuple[str, None]:
- """
- Base class override. Returns the access token in a tuple to match the OAuth2 interface.
- """
- return super()._authenticate(subject_id=sub, subject_type=sub_type), None
diff --git a/boxsdk/auth/redis_managed_oauth2.py b/boxsdk/auth/redis_managed_oauth2.py
deleted file mode 100644
index 553f04927..000000000
--- a/boxsdk/auth/redis_managed_oauth2.py
+++ /dev/null
@@ -1,57 +0,0 @@
-from typing import Any, Tuple, Optional
-from uuid import uuid4
-
-from redis import StrictRedis, Redis
-from redis.lock import Lock
-
-from .oauth2 import OAuth2
-
-
-class RedisManagedOAuth2Mixin(OAuth2):
- """
- Box SDK OAuth2 subclass.
- Allows for storing auth tokens in redis.
- """
- def __init__(self, unique_id: str = uuid4(), redis_server: Redis = None, *args: Any, **kwargs: Any):
- """
- :param unique_id:
- An identifier for this auth object. Auth instances which wish to share tokens must use the same ID.
- :param redis_server:
- An instance of a Redis server, configured to talk to Redis.
- """
- # pylint:disable=keyword-arg-before-vararg
- self._unique_id = unique_id
- self._redis_server = redis_server or StrictRedis()
- refresh_lock = Lock(redis=self._redis_server, name=f'{self._unique_id}_lock')
- super().__init__(*args, refresh_lock=refresh_lock, **kwargs)
- if self._access_token is None:
- self._get_and_update_current_tokens()
-
- @property
- def unique_id(self) -> str:
- """
- Get the unique ID used by this auth instance. Other instances can share tokens with this instance
- if they share the ID with this instance.
- """
- return self._unique_id
-
- def _get_tokens(self) -> Tuple[Optional[str], Optional[str]]:
- """
- Base class override.
- Gets the latest tokens from redis before returning them.
- """
- return self._redis_server.hvals(self._unique_id) or (None, None)
-
- def _store_tokens(self, access_token: str, refresh_token: str) -> None:
- """
- Base class override.
- Saves the refreshed tokens in redis.
- """
- super()._store_tokens(access_token, refresh_token)
- self._redis_server.hmset(self._unique_id, {'access': access_token, 'refresh': refresh_token})
-
-
-class RedisManagedOAuth2(RedisManagedOAuth2Mixin):
- """
- OAuth2 subclass which uses Redis to manage tokens.
- """
diff --git a/boxsdk/auth/remote_managed_oauth2.py b/boxsdk/auth/remote_managed_oauth2.py
deleted file mode 100644
index b716fbef4..000000000
--- a/boxsdk/auth/remote_managed_oauth2.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from typing import Callable, Any, Tuple
-
-from .oauth2 import OAuth2
-
-
-class RemoteOAuth2Mixin(OAuth2):
- """
- Box SDK OAuth2 mixin.
- Allows for storing auth tokens remotely.
-
- """
- def __init__(self, retrieve_access_token: Callable[[str], str] = None, *args: Any, **kwargs: Any):
- """
- :param retrieve_access_token:
- Callback to exchange an existing access token for a new one.
- """
- # pylint:disable=keyword-arg-before-vararg
- self._retrieve_access_token = retrieve_access_token
- super().__init__(*args, **kwargs)
-
- def _refresh(self, access_token: str) -> Tuple[str, None]:
- """
- Base class override. Ask the remote host for a new token.
- """
- self._access_token = self._retrieve_access_token(access_token)
- return self._access_token, None
-
-
-class RemoteOAuth2(RemoteOAuth2Mixin):
- """
- Box SDK OAuth2 subclass.
- Allows for storing auth tokens remotely. The retrieve_access_token callback should
- return an access token, presumably acquired from a remote server on which your auth credentials are available.
- """
diff --git a/boxsdk/auth/server_auth.py b/boxsdk/auth/server_auth.py
deleted file mode 100644
index 59e46e3a7..000000000
--- a/boxsdk/auth/server_auth.py
+++ /dev/null
@@ -1,212 +0,0 @@
-import time
-from abc import ABC, abstractmethod
-from datetime import datetime
-from typing import Optional, Tuple, TYPE_CHECKING, Union, Any
-
-from boxsdk.auth.oauth2 import OAuth2
-from boxsdk.exception import BoxOAuthException
-from boxsdk.config import API
-from boxsdk.object.user import User
-
-if TYPE_CHECKING:
- from boxsdk.network.network_interface import NetworkResponse
-
-
-class ServerAuth(ABC, OAuth2):
- USER_SUBJECT_TYPE = 'user'
- ENTERPRISE_SUBJECT_TYPE = 'enterprise'
-
- def __init__(
- self,
- client_id: str,
- client_secret: str,
- enterprise_id: Optional[str] = None,
- user: Optional[Union[str, 'User']] = None,
- **kwargs: Any
- ):
- super().__init__(client_id=client_id, client_secret=client_secret, **kwargs)
- self._enterprise_id = enterprise_id
- self._user_id = self._normalize_user_id(user)
-
- def _refresh(self, access_token: str) -> Tuple[str, None]:
- """
- Base class override.
-
- Instead of refreshing an access token using a refresh token, we just issue a new JWT request.
- """
- # pylint:disable=unused-argument
- if self._user_id is None:
- new_access_token = self.authenticate_instance()
- else:
- new_access_token = self.authenticate_user()
- return new_access_token, None
-
- def authenticate_user(self, user: Union[str, 'User'] = None) -> str:
- """
- Get an access token for a User.
-
- May be one of this application's created App User. Depending on the
- configured User Access Level, may also be any other App User or Managed
- User in the enterprise.
-
-
-
-
- :param user:
- (optional) The user to authenticate, expressed as a Box User ID or
- as a :class:`User` instance.
-
- If not given, then the most recently provided user ID, if
- available, will be used.
- :raises:
- :exc:`ValueError` if no user ID was passed and the object is not
- currently configured with one.
- :return:
- The access token for the user.
- """
- sub = self._normalize_user_id(user) or self._user_id
- if not sub:
- raise ValueError("authenticate_user: Requires the user ID, but it was not provided.")
- self._user_id = sub
- return self._authenticate(sub, self.USER_SUBJECT_TYPE)
-
- authenticate_app_user = authenticate_user
-
- def authenticate_instance(self, enterprise: Optional[str] = None) -> str:
- """
- Get an access token for a Box Developer Edition enterprise.
-
- :param enterprise:
- The ID of the Box Developer Edition enterprise.
-
- Optional if the value was already given to `__init__`,
- otherwise required.
- :raises:
- :exc:`ValueError` if `None` was passed for the enterprise ID here
- and in `__init__`, or if the non-`None` value passed here does not
- match the non-`None` value passed to `__init__`.
- :return:
- The access token for the enterprise which can provision/deprovision app users.
- """
- enterprises = [enterprise, self._enterprise_id]
- if not any(enterprises):
- raise ValueError("authenticate_instance: Requires the enterprise ID, but it was not provided.")
- if all(enterprises) and (enterprise != self._enterprise_id):
- raise ValueError(
- f"authenticate_instance: Given enterprise ID {enterprise!r}, "
- f"but {self} already has ID {self._enterprise_id!r}"
- )
- if not self._enterprise_id:
- self._enterprise_id = enterprise
- self._user_id = None
- return self._authenticate(self._enterprise_id, self.ENTERPRISE_SUBJECT_TYPE)
-
- def _authenticate(self, subject_id: str, subject_type: str) -> str:
- """
- Authenticate with server type authentication (JWT or CCG).
- If authorization fails because the expiration time is out of sync with the Box servers,
- retry using the time returned in the error response.
- Pass an enterprise ID to get an enterprise token (which can be used to provision/deprovision users),
- or a user ID to get a user token.
-
- :param subject_id:
- The enterprise ID or user ID to auth.
- :param subject_type:
- Either 'enterprise' or 'user'
- :return:
- The access token for the enterprise or app user.
- """
- attempt_number = 0
- date = None
- while True:
- try:
- return self._fetch_access_token(subject_id, subject_type, date)
- except BoxOAuthException as ex:
- network_response = ex.network_response
- code = network_response.status_code # pylint: disable=maybe-no-member
- box_datetime = self._get_date_header(network_response)
-
- if attempt_number >= API.MAX_RETRY_ATTEMPTS:
- raise ex
-
- if code == 429 or code >= 500:
- date = None
- elif box_datetime is not None and self._is_auth_error_retryable(network_response):
- date = box_datetime
- else:
- raise ex
-
- time_delay = self._session.get_retry_after_time(
- attempt_number,
- network_response.headers.get('Retry-After', None)
- )
- time.sleep(time_delay)
- attempt_number += 1
- self._logger.debug('Retrying authentication request')
-
- @abstractmethod
- def _fetch_access_token(self, subject_id: str, subject_type: str, now_time: Optional[datetime] = None) -> str:
- pass
-
- @staticmethod
- def _get_date_header(network_response: 'NetworkResponse') -> Optional[datetime]:
- """
- Get datetime object for Date header, if the Date header is available.
-
- :param network_response:
- The response from the Box API that should include a Date header.
- :return:
- The datetime parsed from the Date header, or None if the header is absent or if it couldn't be parsed.
- """
- box_date_header = network_response.headers.get('Date', None)
- if box_date_header is not None:
- try:
- return datetime.strptime(box_date_header, '%a, %d %b %Y %H:%M:%S %Z')
- except ValueError:
- pass
- return None
-
- @staticmethod
- def _is_auth_error_retryable(network_response: 'NetworkResponse') -> bool:
- """
- Determine whether the network response indicates that the authorization request was rejected because of
- the exp or jti claim and can be retried. Exp claim error can happen if the current system time is too
- different from the Box server time. If got an error: "A unique 'jti' value is required",
- we also retry auth in order to use new 'jti' claim.
-
- Returns True if the status code is 400, the error code is invalid_grant, and the error description indicates
- a problem with the exp or jti claim; False, otherwise.
-
- :param network_response:
- The response from the Box API that should include a Date header.
- """
- status_code = network_response.status_code
- try:
- json_response = network_response.json()
- except ValueError:
- return False
- error_code = json_response.get('error', '')
- error_description = json_response.get('error_description', '')
- return status_code == 400 and error_code == 'invalid_grant' \
- and ('exp' in error_description or 'jti' in error_description)
-
- @classmethod
- def _normalize_user_id(cls, user: Any) -> Optional[str]:
- """Get a Box user ID from a selection of supported param types.
-
- :param user:
- An object representing the user or user ID.
-
- Currently supported types are `unicode` (which represents the user
- ID) and :class:`User`.
-
- If `None`, returns `None`.
- :raises: :exc:`TypeError` for unsupported types.
- """
- if user is None:
- return None
- if isinstance(user, User):
- return user.object_id
- if isinstance(user, str):
- return str(user)
- raise TypeError(f"Got unsupported type {user.__class__.__name__!r} for user.")
diff --git a/boxsdk/client/__init__.py b/boxsdk/client/__init__.py
deleted file mode 100644
index 43e33c306..000000000
--- a/boxsdk/client/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from .client import Client
-from .developer_token_client import DeveloperTokenClient
-from .development_client import DevelopmentClient
-from .logging_client import LoggingClient
diff --git a/boxsdk/client/client.py b/boxsdk/client/client.py
deleted file mode 100644
index e6b12049a..000000000
--- a/boxsdk/client/client.py
+++ /dev/null
@@ -1,1904 +0,0 @@
-# pylint: disable=too-many-lines
-import json
-from datetime import datetime
-from typing import TYPE_CHECKING, Optional, Iterable, Union, Any, IO
-from warnings import warn
-
-from ..auth.oauth2 import TokenResponse
-from ..session.session import Session, AuthorizedSession
-from ..object.cloneable import Cloneable
-from ..util.api_call_decorator import api_call
-from ..object.search import Search
-from ..object.events import Events
-from ..object.collaboration_allowlist import CollaborationAllowlist
-from ..object.trash import Trash
-from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..util.datetime_formatter import normalize_date_to_rfc3339_format
-from ..util.shared_link import get_shared_link_header
-from ..util.deprecation_decorator import deprecated
-
-if TYPE_CHECKING:
- from boxsdk import OAuth2
- from boxsdk.util.translator import Translator
- from boxsdk.object.folder import Folder
- from boxsdk.object.file import File
- from boxsdk.object.file_request import FileRequest
- from boxsdk.object.file_version import FileVersion
- from boxsdk.object.upload_session import UploadSession
- from boxsdk.object.comment import Comment
- from boxsdk.object.legal_hold import LegalHold
- from boxsdk.object.legal_hold_policy_assignment import LegalHoldPolicyAssignment
- from boxsdk.object.legal_hold_policy import LegalHoldPolicy
- from boxsdk.object.collaboration_allowlist_exempt_target import CollaborationAllowlistExemptTarget
- from boxsdk.object.collaboration_allowlist_entry import CollaborationAllowlistEntry
- from boxsdk.object.collaboration import Collaboration
- from boxsdk.object.group import Group
- from boxsdk.object.email_alias import EmailAlias
- from boxsdk.object.invite import Invite
- from boxsdk.object.user import User
- from boxsdk.object.sign_request import SignRequest
- from boxsdk.object.folder_lock import FolderLock
- from boxsdk.object.metadata_template import MetadataTemplate, MetadataField
- from boxsdk.object.metadata_cascade_policy import MetadataCascadePolicy
- from boxsdk.object.device_pinner import DevicePinner
- from boxsdk.auth.oauth2 import TokenScope
- from boxsdk.session.box_response import BoxResponse
- from boxsdk.object.item import Item
- from boxsdk.object.web_link import WebLink
- from boxsdk.object.retention_policy_assignment import RetentionPolicyAssignment
- from boxsdk.object.file_version_retention import FileVersionRetention
- from boxsdk.object.retention_policy import RetentionPolicy
- from boxsdk.object.task_assignment import TaskAssignment
- from boxsdk.object.task import Task
- from boxsdk.object.terms_of_service_user_status import TermsOfServiceUserStatus
- from boxsdk.object.terms_of_service import TermsOfService, TermsOfServiceType, TermsOfServiceStatus
- from boxsdk.object.storage_policy_assignment import StoragePolicyAssignment
- from boxsdk.object.storage_policy import StoragePolicy
- from boxsdk.object.webhook import Webhook
- from boxsdk.object.group_membership import GroupMembership
- from boxsdk.object.enterprise import Enterprise
- from boxsdk.object.collection import Collection
- from boxsdk.object.sign_template import SignTemplate
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class Client(Cloneable):
- unauthorized_session_class = Session
- authorized_session_class = AuthorizedSession
-
- def __init__(self, oauth: 'OAuth2', session: Session = None):
- """
- :param oauth:
- OAuth2 object used by the session to authorize requests.
- :param session:
- The session object to use. If None is provided then an instance of :class:`AuthorizedSession` will be used.
- """
- super().__init__()
- warn('Package \'boxsdk\' is going to be deprecated soon. Please use \'box-sdk-gen\' instead.', DeprecationWarning)
- self._oauth = oauth
- if session is not None:
- self._session = session
- else:
- session = session or self.unauthorized_session_class()
- self._session = self.authorized_session_class(self._oauth, **session.get_constructor_kwargs())
-
- @property
- def auth(self) -> 'OAuth2':
- """
- Get the :class:`OAuth2` instance the client is using for auth to Box.
- """
- return self._oauth
-
- @property
- def session(self) -> Session:
- """
- Get the :class:`BoxSession` instance the client is using.
- """
- return self._session
-
- @property
- def translator(self) -> 'Translator':
- """The translator used for translating Box API JSON responses into `BaseAPIJSONObject` smart objects.
- """
- return self._session.translator
-
- def folder(self, folder_id: str) -> 'Folder':
- """
- Initialize a :class:`Folder` object, whose box id is folder_id.
-
- :param folder_id:
- The box id of the :class:`Folder` object. Can use '0' to get the root folder on Box.
- :return:
- A :class:`Folder` object with the given folder id.
- """
- return self.translator.get('folder')(session=self._session, object_id=folder_id)
-
- def root_folder(self) -> 'Folder':
- """
- Returns a user's root folder object.
- """
- return self.folder('0')
-
- def file(self, file_id: str) -> 'File':
- """
- Initialize a :class:`File` object, whose box id is file_id.
-
- :param file_id:
- The box id of the :class:`File` object.
- :return:
- A :class:`File` object with the given file id.
- """
- return self.translator.get('file')(session=self._session, object_id=file_id)
-
- def file_request(self, request_id: str) -> 'FileRequest':
- """
- Initialize a :class:`FileRequest` object, whose box id is request_id.
-
- :param request_id:
- The box id of the :class:`FileRequest` object.
- :return:
- A :class:`FileRequest` object with the given file request id.
- """
- return self.translator.get('file_request')(session=self._session, object_id=request_id)
-
- def file_version(self, version_id: str) -> 'FileVersion':
- """
- Initialize a :class:`FileVersion` object, whose box id is version_id.
-
- :param version_id:
- The box id of the :class:`FileVersion` object.
- :return:
- A :class:`FileVersion` object with the given file version id.
- """
- return self.translator.get('file_version')(session=self._session, object_id=version_id)
-
- def upload_session(self, session_id: str) -> 'UploadSession':
- """
- Initialize a :class:`UploadSession` object, whose box id is session_id.
-
- :param session_id:
- The box id of the :class:`UploadSession` object.
- :return:
- A :class:`UploadSession` object with the given session id.
- """
- return self.translator.get('upload_session')(session=self._session, object_id=session_id)
-
- def comment(self, comment_id: str) -> 'Comment':
- """
- Initialize a :class:`Comment` object, whose Box ID is comment_id.
-
- :param comment_id:
- The Box ID of the :class:`Comment` object.
- :return:
- A :class:`Comment` object with the given comment ID.
- """
- return self.translator.get('comment')(session=self._session, object_id=comment_id)
-
- def user(self, user_id: str = 'me') -> 'User':
- """
- Initialize a :class:`User` object, whose box id is user_id.
-
- :param user_id:
- The user id of the :class:`User` object. Can use 'me' to get the User for the current/authenticated user.
- :return:
- A :class:`User` object with the given id.
- """
- return self.translator.get('user')(session=self._session, object_id=user_id)
-
- def invite(self, invite_id: str) -> 'Invite':
- """
- Initialize a :class:`Invite` object, whose box id is invite_id.
-
- :param invite_id:
- The invite ID of the :class:`Invite` object.
- :return:
- A :class:`Invite` object with the given entry ID.
- """
- return self.translator.get('invite')(session=self._session, object_id=invite_id)
-
- def email_alias(self, alias_id: str) -> 'EmailAlias':
- """
- Initialize a :class: `EmailAlias` object, whose box id is alias_id.
-
- :param alias_id:
- The aliad id of the :class:`EmailAlias` object.
- :return:
- A :class:`EmailAlias` object with the given entry ID.
- """
- return self.translator.get('email_alias')(session=self._session, object_id=alias_id)
-
- def group(self, group_id: str) -> 'Group':
- """
- Initialize a :class:`Group` object, whose box id is group_id.
-
- :param group_id:
- The box id of the :class:`Group` object.
- :return:
- A :class:`Group` object with the given group id.
- """
- return self.translator.get('group')(session=self._session, object_id=group_id)
-
- def collaboration(self, collab_id: str) -> 'Collaboration':
- """
- Initialize a :class:`Collaboration` object, whose box id is collab_id.
-
- :param collab_id:
- The box id of the :class:`Collaboration` object.
- :return:
- A :class:`Collaboration` object with the given group id.
- """
- return self.translator.get('collaboration')(session=self._session, object_id=collab_id)
-
- def collaboration_allowlist(self):
- """
- Initilializes a :class:`CollaborationAllowlist` object.
-
- :return:
- A :class:`CollaborationAllowlist` object.
- """
- return CollaborationAllowlist(self._session)
-
- def collaboration_allowlist_entry(self, entry_id: str) -> 'CollaborationAllowlistEntry':
- """
- Initialize a :class:`CollaborationAllowlistEntry` object, whose box id is entry_id.
-
- :param entry_id:
- The box id of the :class:`CollaborationAllowlistEntry` object.
- :return:
- A :class:`CollaborationAllowlistEntry` object with the given entry id.
- """
- return self.translator.get('collaboration_whitelist_entry')(session=self._session, object_id=entry_id)
-
- def collaboration_allowlist_exempt_target(self, exemption_id: str) -> 'CollaborationAllowlistExemptTarget':
- """
- Initialize a :class:`CollaborationAllowlistExemptTarget` object, whose box id is target_id.
-
- :param exemption_id:
- The box id of the :class:`CollaborationAllowlistExemptTarget` object.
- :return:
- A :class:`CollaborationAllowlistExemptTarget` object with the given target id.
- """
- return self.translator.get('collaboration_whitelist_exempt_target')(
- session=self._session,
- object_id=exemption_id
- )
-
- def trash(self) -> Trash:
- """
- Initialize a :class:`Trash` object.
-
- :return:
- A :class:`Trash` object.
- """
- return Trash(self._session)
-
- def legal_hold_policy(self, policy_id: str) -> 'LegalHoldPolicy':
- """
- Initialize a :class:`LegalHoldPolicy` object, whose box id is policy_id.
-
- :param policy_id:
- The box ID of the :class:`LegalHoldPolicy` object.
- :return:
- A :class:`LegalHoldPolicy` object with the given entry ID.
- """
- return self.translator.get('legal_hold_policy')(session=self._session, object_id=policy_id)
-
- def legal_hold_policy_assignment(self, policy_assignment_id: str) -> 'LegalHoldPolicyAssignment':
- """
- Initialize a :class:`LegalHoldPolicyAssignment` object, whose box id is policy_assignment_id.
-
- :param policy_assignment_id:
- The assignment ID of the :class:`LegalHoldPolicyAssignment` object.
- :return:
- A :class:`LegalHoldPolicyAssignment` object with the given entry ID.
- """
- return self.translator.get('legal_hold_policy_assignment')(session=self._session, object_id=policy_assignment_id)
-
- def legal_hold(self, hold_id: str) -> 'LegalHold':
- """
- Initialize a :class:`LegalHold` object, whose box id is policy_id.
-
- :param hold_id:
- The legal hold ID of the :class:`LegalHold` object.
- :return:
- A :class:`LegalHold` object with the given entry ID.
- """
- return self.translator.get('legal_hold')(session=self._session, object_id=hold_id)
-
- @api_call
- def create_legal_hold_policy(
- self,
- policy_name: str,
- description: Optional[str] = None,
- filter_started_at: Union[datetime, str] = None,
- filter_ended_at: Union[datetime, str] = None,
- is_ongoing: Optional[bool] = None
- ) -> 'LegalHoldPolicy':
- """
- Create a legal hold policy.
-
- :param policy_name:
- The legal hold policy's display name.
- :param description:
- The description of the legal hold policy.
- :param filter_started_at:
- The start date filter for legal hold policy. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- :param filter_ended_at:
- The end date filter for legal hold policy. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- :param is_ongoing:
- After initialization, Assignments under this Policy will continue applying to
- files based on events, indefinitely.
- :returns:
- A legal hold policy object
- """
- url = self.get_url('legal_hold_policies')
- policy_attributes = {'policy_name': policy_name}
- if description is not None:
- policy_attributes['description'] = description
- if filter_started_at is not None:
- policy_attributes['filter_started_at'] = normalize_date_to_rfc3339_format(filter_started_at)
- if filter_ended_at is not None:
- policy_attributes['filter_ended_at'] = normalize_date_to_rfc3339_format(filter_ended_at)
- if is_ongoing is not None:
- policy_attributes['is_ongoing'] = is_ongoing
- box_response = self._session.post(url, data=json.dumps(policy_attributes))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_legal_hold_policies(
- self,
- policy_name: Optional[str] = None,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the legal hold policy using limit-offset paging.
-
- :param policy_name:
- The name of the legal hold policy case insensitive to search for
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the legal hold policy
- """
- additional_params = {}
- if policy_name is not None:
- additional_params['policy_name'] = policy_name
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('legal_hold_policies'),
- additional_params=additional_params,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- def collection(self, collection_id: str) -> 'Collection':
- """
- Initialize a :class:`Collection` object, whose box ID is collection_id.
-
- :param collection_id:
- The box id of the :class:`Collection` object.
- :return:
- A :class:`Collection` object with the given collection ID.
- """
- return self.translator.get('collection')(session=self._session, object_id=collection_id)
-
- @api_call
- def collections(
- self,
- limit: Optional[int] = None,
- offset: int = 0,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get a list of collections for the current user.
-
- :param limit:
- The maximum number of users to return. If not specified, the Box API will determine an appropriate limit.
- :param offset:
- The user index at which to start the response.
- :param fields:
- List of fields to request.
- """
- return LimitOffsetBasedObjectCollection(
- self.session,
- self._session.get_url('collections'),
- limit=limit,
- fields=fields,
- offset=offset,
- return_full_pages=False,
- )
-
- def enterprise(self, enterprise_id: str) -> 'Enterprise':
- """
- Initialize a :class:`Enterprise` object, whose box ID is enterprise_id.
-
- :param enterprise_id:
- The box id of the :class:`Enterprise` object.
- :return:
- A :class:`Enterprise` object with the given enterprise ID.
- """
- return self.translator.get('enterprise')(session=self._session, object_id=enterprise_id)
-
- @api_call
- def get_current_enterprise(self) -> 'Enterprise':
- """
- Get the enterprise of the current user.
-
- :returns:
- The authenticated user's enterprise
- """
- user = self.user().get(fields=['enterprise'])
- enterprise_object = user['enterprise']
- return self.translator.translate(
- session=self._session,
- response_object=enterprise_object,
- )
-
- @api_call
- def users(
- self,
- limit: Optional[int] = None,
- offset: int = 0,
- filter_term: Optional[str] = None,
- user_type: Optional[str] = None,
- fields: Iterable[str] = None,
- use_marker: bool = False,
- marker: Optional[str] = None
- ) -> Iterable['User']:
- """
- Get a list of all users for the Enterprise along with their user_id, public_name, and login.
-
- :param limit:
- The maximum number of users to return. If not specified, the Box API will determine an appropriate limit.
- :param offset:
- The user index at which to start the response.
- :param filter_term:
- Filters the results to only users starting with the filter_term in either the name or the login.
- :param user_type:
- Filters the results to only users of the given type: 'managed', 'external', or 'all'.
- :param fields:
- List of fields to request on the :class:`User` objects.
- :param use_marker:
- Whether to use marker-based paging instead of offset-based paging, defaults to False.
- :param marker:
- The paging marker to start returning items from when using marker-based paging.
- :return:
- The list of all users in the enterprise.
- """
- url = self.get_url('users')
- additional_params = {}
- if filter_term:
- additional_params['filter_term'] = filter_term
- if user_type:
- additional_params['user_type'] = user_type
-
- if use_marker:
- additional_params['usemarker'] = True
- return MarkerBasedObjectCollection(
- url=url,
- session=self._session,
- limit=limit,
- marker=marker,
- fields=fields,
- additional_params=additional_params,
- return_full_pages=False,
- )
- return LimitOffsetBasedObjectCollection(
- url=url,
- session=self._session,
- additional_params=additional_params,
- limit=limit,
- offset=offset,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def search(self) -> Search:
- """
- Get a Search object that can be used for searching Box content.
-
- :return:
- The Search object
- """
- return Search(self._session)
-
- def events(self) -> Events:
- """
- Get an events object that can get the latest events from Box or set up a long polling event subscription.
- """
- return Events(self._session)
-
- def group_membership(self, group_membership_id: str) -> 'GroupMembership':
- """
- Initialize a :class:`GroupMembership` object, whose box id is group_membership_id.
-
- :param group_membership_id:
- The box id of the :class:`GroupMembership` object.
- :return:
- A :class:`GroupMembership` object with the given membership id.
- """
- return self.translator.get('group_membership')(
- session=self._session,
- object_id=group_membership_id,
- )
-
- @api_call
- def get_groups(
- self,
- name: Optional[str] = None,
- limit: Optional[int] = None,
- offset: Optional[int] = None,
- fields: Iterable[str] = None
- ) -> Iterable['Group']:
- """
- Get a list of all groups for the current user.
-
- :param name:
- Filter on the name of the groups to return.
- :param limit:
- The maximum number of groups to return. If not specified, the Box API will determine an appropriate limit.
- :param offset:
- The group index at which to start the response.
- :param fields:
- List of fields to request on the :class:`Group` objects.
- :return:
- The collection of all groups.
- """
- url = self.get_url('groups')
- additional_params = {}
- if name:
- additional_params['filter_term'] = name
- return LimitOffsetBasedObjectCollection(
- url=url,
- session=self._session,
- additional_params=additional_params,
- limit=limit,
- offset=offset,
- fields=fields,
- return_full_pages=False,
- )
-
- def webhook(self, webhook_id: str) -> 'Webhook':
- """
- Initialize a :class:`Webhook` object, whose box id is webhook_id.
-
- :param webhook_id:
- The box ID of the :class: `Webhook` object.
- :return:
- A :class:`Webhook` object with the given entry ID.
- """
- return self.translator.get('webhook')(session=self._session, object_id=webhook_id)
-
- @api_call
- def create_webhook(self, target: Union['File', 'Folder'], triggers: Union[list, str], address: str) -> 'Webhook':
- """
- Create a webhook on the given file.
-
- :param target:
- Either a :class:`File` or :class:`Folder` to assign a webhook to.
- :param triggers:
- Event types that trigger notifications for the target.
- :param address:
- The url to send the notification to.
- :return:
- A :class:`Webhook` object with the given entry ID.
- """
- url = self.get_url('webhooks')
- webhook_attributes = {
- 'target': {
- 'type': target.object_type,
- 'id': target.object_id,
- },
- 'triggers': triggers,
- 'address': address,
- }
- box_response = self._session.post(url, data=json.dumps(webhook_attributes))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_webhooks(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get all webhooks in an enterprise.
-
- :param limit:
- The maximum number of entries to return.
- :param marker:
- The position marker at which to begin the response.
- :param fields:
- List of fields to request on the file or folder which the `RecentItem` references.
- :returns:
- An iterator of the entries in the webhook
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('webhooks'),
- limit=limit,
- marker=marker,
- fields=fields,
- )
-
- @api_call
- def create_group(
- self,
- name: str,
- provenance: Optional[str] = None,
- external_sync_identifier: Optional[str] = None,
- description: Optional[str] = None,
- invitability_level: str = None,
- member_viewability_level: str = None,
- fields: Iterable[str] = None,
- ) -> 'Group':
- """
- Create a group with the given name.
-
- :param name:
- The name of the group.
- :param provenance:
- Used to track the external source where the group is coming from.
- :param external_sync_identifier:
- Used as a group identifier for groups coming from an external source.
- :param description:
- Description of the group.
- :param invitability_level:
- Specifies who can invite this group to folders.
- :param member_viewability_level:
- Specifies who can view the members of this group.
- :param fields:
- List of fields to request on the :class:`Group` objects.
- :return:
- The newly created Group.
- :raises:
- :class:`BoxAPIException` if current user doesn't have permissions to create a group.
- """
- url = self.get_url('groups')
- additional_params = {}
- body_attributes = {
- 'name': name,
- }
- if provenance is not None:
- body_attributes['provenance'] = provenance
- if external_sync_identifier is not None:
- body_attributes['external_sync_identifier'] = external_sync_identifier
- if description is not None:
- body_attributes['description'] = description
- if invitability_level is not None:
- body_attributes['invitability_level'] = invitability_level
- if member_viewability_level is not None:
- body_attributes['member_viewability_level'] = member_viewability_level
- if fields is not None:
- additional_params['fields'] = ','.join(fields)
- box_response = self._session.post(url, data=json.dumps(body_attributes), params=additional_params)
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- def storage_policy(self, policy_id: str) -> 'StoragePolicy':
- """
- Initialize a :class:`StoragePolicy` object, whose box id is policy_id.
-
- :param policy_id:
- The box ID of the :class:`StoragePolicy` object.
- :return:
- A :class:`StoragePolicy` object with the given entry ID.
- """
- return self.translator.get('storage_policy')(session=self._session, object_id=policy_id)
-
- def storage_policy_assignment(self, assignment_id: str) -> 'StoragePolicyAssignment':
- """
- Initialize a :class:`StoragePolicyAssignment` object, whose box id is assignment_id.
-
- :param assignment_id:
- The box ID of the :class:`StoragePolicyAssignment` object.
- :return:
- A :class:`StoragePolicyAssignment` object with the given entry ID.
- """
- return self.translator.get('storage_policy_assignment')(session=self._session, object_id=assignment_id)
-
- def get_storage_policies(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the storage policy using marker-based paging.
-
- :param limit:
- The maximum number of items to return.
- :param marker:
- The paging marker to start returning items from when using marker-based paging.
- :param fields:
- List of fields to request.
- :returns:
- Returns the storage policies available for the current enterprise.
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('storage_policies'),
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- def terms_of_service(self, tos_id: str) -> 'TermsOfService':
- """
- Initialize a :class:`TermsOfService` object, whose box id is tos_id.
-
- :param tos_id:
- The box id of the :class:`TermsOfService` object.
- :return:
- A :class:`TermsOfService` object with the given terms of service id.
- """
- return self.translator.get('terms_of_service')(session=self._session, object_id=tos_id)
-
- def terms_of_service_user_status(self, tos_user_status_id: str) -> 'TermsOfServiceUserStatus':
- """
- Initialize a :class:`TermsOfServiceUserStatus` object, whose box id is tos_user_status_id.
-
- :param tos_user_status_id:
- The box id of the :class:`TermsOfServiceUserStatus` object.
- :return:
- A :class:`TermsOfServiceUserStatus` object with the given terms of service user status id.
- """
- return self.translator.get('terms_of_service_user_status')(session=self._session, object_id=tos_user_status_id)
-
- def get_terms_of_services(
- self,
- tos_type: 'TermsOfServiceType' = None,
- limit: Optional[int] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the terms of service using limit-offset paging.
- :param tos_type:
- Can be set to `managed` or `external` for the type of terms of service.
- :param limit:
- The maximum number of items to return. If limit is set to None, then the default
- limit (returned by Box in the response) is used.
- :param fields:
- List of fields to request
- :returns:
- An iterator of the entries in the terms of service
- """
- additional_params = {}
- if tos_type is not None:
- additional_params['tos_type'] = tos_type
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self._session.get_url('terms_of_services'),
- additional_params=additional_params,
- limit=limit,
- marker=None,
- fields=fields,
- return_full_pages=False,
- )
-
- def task(self, task_id: str) -> 'Task':
- """
- Initialize a :class:`Task` object, whose box id is task_id.
-
- :param task_id:
- The box ID of the :class:`Task` object.
- :return:
- A :class:`Task` object with the given entry ID.
- """
- return self.translator.get('task')(session=self._session, object_id=task_id)
-
- def task_assignment(self, assignment_id: str) -> 'TaskAssignment':
- """
- Initialize a :class:`TaskAssignment` object, whose box id is assignment_id.
-
- :param assignment_id:
- The box ID of the :class:`TaskAssignment` object.
- :return:
- A :class:`TaskAssignment` object with the given entry ID.
- """
- return self.translator.get('task_assignment')(session=self._session, object_id=assignment_id)
-
- def retention_policy(self, retention_id: str) -> 'RetentionPolicy':
- """
- Initialize a :class:`RetentionPolicy` object, whose box id is retention_id.
-
- :param retention_id:
- The box ID of the :class:`RetentionPolicy` object.
- :return:
- A :class:`RetentionPolicy` object with the given entry ID.
- """
- return self.translator.get('retention_policy')(session=self._session, object_id=retention_id)
-
- def file_version_retention(self, retention_id: str) -> 'FileVersionRetention':
- """
- Initialize a :class:`FileVersionRetention` object, whose box id is retention_id.
-
- :param retention_id:
- The box ID of the :class:`FileVersionRetention` object.
- :return:
- A :class:`FileVersionRetention` object with the given retention ID.
- """
- return self.translator.get('file_version_retention')(session=self._session, object_id=retention_id)
-
- def retention_policy_assignment(self, assignment_id: str) -> 'RetentionPolicyAssignment':
- """
- Initialize a :class:`RetentionPolicyAssignment` object, whose box id is assignment_id.
-
- :param assignment_id:
- The box ID of the :class:`RetentionPolicyAssignment` object.
- :return:
- A :class:`RetentionPolicyAssignment` object with the given assignment ID.
- """
- return self.translator.get('retention_policy_assignment')(session=self._session, object_id=assignment_id)
-
- @api_call
- def create_retention_policy(
- self,
- policy_name: str,
- disposition_action: str,
- retention_length: Union[int, float],
- can_owner_extend_retention: Optional[bool] = None,
- are_owners_notified: Optional[bool] = None,
- custom_notification_recipients: Iterable['User'] = None,
- retention_type: Optional[str] = None,
- description: Optional[str] = None,
- ) -> 'RetentionPolicy':
- """
- Create a retention policy for the given enterprise.
-
- :param policy_name:
- The name of the retention policy.
- :param disposition_action:
- For `finite` policy can be set to `permanently delete` or `remove retention`.
- For `indefinite` policy this must be set to `remove_retention`
- :param retention_length:
- The amount of time in days to apply the retention policy to the selected content.
- The retention_length should be set to float('inf') for indefinite policies.
- :param can_owner_extend_retention:
- The owner of a file will be allowed to extend the retention if set to true.
- :param are_owners_notified:
- The owner or co-owner will get notified when a file is nearing expiration.
- :param custom_notification_recipients:
- A custom list of user mini objects that should be notified when a file is nearing expiration.
- :param retention_type:
- Specifies the retention type. It can be one of the values:
- - `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.
- - `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.
- :param description:
- The additional text description of the retention policy.
- :return:
- The newly created Retention Policy
- """
- url = self.get_url('retention_policies')
- retention_attributes = {
- 'policy_name': policy_name,
- 'disposition_action': disposition_action,
- }
- if retention_length == float('inf'):
- retention_attributes['policy_type'] = 'indefinite'
- else:
- retention_attributes['policy_type'] = 'finite'
- retention_attributes['retention_length'] = retention_length
- if can_owner_extend_retention is not None:
- retention_attributes['can_owner_extend_retention'] = can_owner_extend_retention
- if are_owners_notified is not None:
- retention_attributes['are_owners_notified'] = are_owners_notified
- if custom_notification_recipients is not None:
- user_list = [{'type': user.object_type, 'id': user.object_id} for user in custom_notification_recipients]
- retention_attributes['custom_notification_recipients'] = user_list
- if retention_type is not None:
- retention_attributes['retention_type'] = retention_type
- if description is not None:
- retention_attributes['description'] = description
- box_response = self._session.post(url, data=json.dumps(retention_attributes))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response
- )
-
- @api_call
- def get_retention_policies(
- self,
- policy_name: Optional[str] = None,
- policy_type: Optional[str] = None,
- user: Optional['User'] = None,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None,
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the retention policy using marker-based paging.
-
- :param policy_name:
- The name of the retention policy.
- :param policy_type:
- Set to either `finite` or `indefinite`
- :param user:
- A user to filter the retention policies.
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from
- :param fields:
- List of fields to request
- :returns:
- An iterator of the entries in the retention policy
- """
- additional_params = {}
- if policy_name is not None:
- additional_params['policy_name'] = policy_name
- if policy_type is not None:
- additional_params['policy_type'] = policy_type
- if user is not None:
- additional_params['created_by_user_id'] = user.object_id
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self._session.get_url('retention_policies'),
- additional_params=additional_params,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- def create_terms_of_service(
- self,
- status: 'TermsOfServiceStatus',
- tos_type: 'TermsOfServiceType',
- text: str
- ) -> 'TermsOfService':
- """
- Create a terms of service.
-
- :param status:
- The status of the terms of service.
- :param tos_type:
- The type of the terms of service. Can be set to `managed` or `external`.
- :param text:
- The message of the terms of service.
- :returns:
- A newly created :class:`TermsOfService` object
- """
- url = self.get_url('terms_of_services')
- body = {
- 'status': status,
- 'tos_type': tos_type,
- 'text': text
- }
- box_response = self._session.post(url, data=json.dumps(body))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @deprecated("Use RetentionPolicyAssignment.get_files_under_retention "
- "or RetentionPolicyAssignment.get_file_versions_under_retention instead")
- @api_call
- def get_file_version_retentions(
- self,
- target_file: Optional['File'] = None,
- file_version: Optional['FileVersion'] = None,
- policy: Optional['RetentionPolicy'] = None,
- disposition_action: Optional[str] = None,
- disposition_before: Optional[str] = None,
- disposition_after: Optional[str] = None,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None,
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the file version retention.
-
- :param target_file:
- The file to filter the file version.
- :param file_version:
- A file version to filter the file version retentions by.
- :param policy:
- A policy to filter the file version retentions by.
- :param disposition_action:
- Can be set to `permanently_delete` or `remove_retention`.
- :param disposition_before:
- A date time filter for disposition action.
- :param disposition_after:
- A date time filter for disposition action.
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from
- :param fields:
- List of fields to request
- :returns:
- An iterator of the entries in the file version retention.
- """
- additional_params = {}
- if target_file is not None:
- additional_params['file_id'] = target_file.object_id
- if file_version is not None:
- additional_params['file_version_id'] = file_version.object_id
- if policy is not None:
- additional_params['policy_id'] = policy.object_id
- if disposition_action is not None:
- additional_params['disposition_action'] = disposition_action
- if disposition_before is not None:
- additional_params['disposition_before'] = disposition_before
- if disposition_after is not None:
- additional_params['disposition_after'] = disposition_after
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self._session.get_url('file_version_retentions'),
- additional_params=additional_params,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- def web_link(self, web_link_id: str) -> 'WebLink':
- """
- Initialize a :class: `WebLink` object, whose box id is web_link_id.
- :param web_link_id:
- The box ID of the :class:`WebLink` object.
- :return:
- A :class:`WebLink` object with the given entry ID.
- """
- return self.translator.get('web_link')(session=self._session, object_id=web_link_id)
-
- @api_call
- def get_recent_items(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None,
- **collection_kwargs: Any
- ) -> MarkerBasedObjectCollection:
- """
- Get the user's recently accessed items.
-
- :param limit:
- The maximum number of items to return. If limit is set to None, then the default
- limit (returned by Box in the response) is used. See https://developer.box.com/en/reference/get-recent-items/
- for default.
- :param marker:
- The index at which to start returning items.
- :param fields:
- List of fields to request on the file or folder which the `RecentItem` references.
- :param collection_kwargs:
- Keyword arguments passed to `MarkerBasedObjectCollection`.
- :returns:
- An iterator on the user's recent items
- """
- return MarkerBasedObjectCollection(
- self.session,
- self.get_url('recent_items'),
- limit=limit,
- fields=fields,
- marker=marker,
- **collection_kwargs
- )
-
- @api_call
- def get_shared_item(self, shared_link: str, password: str = None) -> 'Item':
- """
- Get information about a Box shared link. https://developer.box.com/en/reference/get-shared-items/
-
- :param shared_link:
- The shared link.
- :param password:
- The password for the shared link.
- :return:
- The item referred to by the shared link.
- :raises:
- :class:`BoxAPIException` if current user doesn't have permissions to view the shared link.
- """
- response = self.make_request(
- 'GET',
- self.get_url('shared_items'),
- headers=get_shared_link_header(shared_link, password),
- ).json()
- return self.translator.translate(
- session=self._session.with_shared_link(shared_link, password),
- response_object=response,
- )
-
- @api_call
- def make_request(self, method: str, url: str, **kwargs: Any) -> 'BoxResponse':
- """
- Make an authenticated request to the Box API.
-
- :param method:
- The HTTP verb to use for the request.
- :param url:
- The URL for the request.
- :return:
- The network response for the given request.
- :raises:
- :class:`BoxAPIException`
- """
- return self._session.request(method, url, **kwargs)
-
- @api_call
- def create_user(self, name: str, login: Optional[str] = None, **user_attributes: Any) -> 'User':
- """
- Create a new user. Can only be used if the current user is an enterprise admin, or the current authorization
- scope is a Box developer edition instance.
-
- :param name:
- The user's display name.
- :param login:
- The user's email address. Required for an enterprise user, but None for an app user.
- :param user_attributes:
- Additional attributes for the user. See the documentation at
- https://developer.box.com/en/reference/post-users/
- :return
- Newly created user
- """
- url = self.get_url('users')
- user_attributes['name'] = name
- if login is not None:
- user_attributes['login'] = login
- else:
- user_attributes['is_platform_access_only'] = True
- box_response = self._session.post(url, data=json.dumps(user_attributes))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_pending_collaborations(
- self,
- limit: Optional[int] = None,
- offset: Optional[int] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the pending collaborations using limit-offset paging.
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param offset:
- The offset of the item at which to begin the response.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the pending collaborations
- """
- return LimitOffsetBasedObjectCollection(
- session=self._session,
- url=self.get_url('collaborations'),
- additional_params={'status': 'pending'},
- limit=limit,
- offset=offset,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def downscope_token(
- self,
- scopes: Iterable['TokenScope'],
- item: 'Item' = None,
- additional_data: dict = None,
- shared_link: str = None
- ) -> TokenResponse:
- """
- Generate a downscoped token for the provided file or folder with the provided scopes.
- There is no way of refreshing this token. You will need to add you own logic to
- generate new token if this one expires.
-
- :param scopes:
- The scope(s) to apply to the resulting token.
- :param item:
- (Optional) The file or folder to get a downscoped token for. If None and shared_link None, the resulting
- token will not be scoped down to just a single item.
- :param additional_data:
- (Optional) Key value pairs which can be used to add/update the default data values in the request.
- :param shared_link:
- (Optional) The shared link to get a downscoped token for. If None and item None, the resulting token
- will not be scoped down to just a single item.
- :return:
- The response for the downscope token request.
- """
- url = f'{self._session.api_config.OAUTH2_API_URL}/token'
- access_token = self.auth.access_token or self.auth.refresh(None)
- data = {
- 'subject_token': access_token,
- 'subject_token_type': 'urn:ietf:params:oauth:token-type:access_token',
- 'scope': ' '.join(scopes),
- 'grant_type': 'urn:ietf:params:oauth:grant-type:token-exchange',
- }
-
- if item:
- data['resource'] = item.get_url()
- if shared_link:
- data['box_shared_link'] = shared_link
- if additional_data:
- data.update(additional_data)
-
- box_response = self._session.post(url, data=data)
-
- return TokenResponse(box_response.json())
-
- def clone(self, session: 'Session' = None) -> 'Client':
- """Base class override."""
- return self.__class__(oauth=self._oauth, session=(session or self._session))
-
- def get_url(self, endpoint: str, *args: Any) -> str:
- """
- Return the URL for the given Box API endpoint.
-
- :param endpoint:
- The name of the endpoint.
- :param args:
- Additional parts of the endpoint URL.
- """
- # pylint:disable=no-self-use
- return self._session.get_url(endpoint, *args)
-
- def device_pinner(self, device_pin_id: str) -> 'DevicePinner':
- """
- Initialize a :class:`DevicePinner` object, whose box id is device_pin_id.
-
- :param device_pin_id:
- The assignment ID of the :class:`DevicePin` object.
- :return:
- A :class:`DevicePinner` object with the given entry ID.
- """
- return self.translator.get('device_pinner')(session=self._session, object_id=device_pin_id)
-
- def device_pinners(
- self,
- enterprise: Optional['Enterprise'] = None,
- direction: Optional[str] = None,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Returns all of the device pins for the given enterprise.
-
- :param enterprise:
- The enterprise to retrieve device pinners for, defaulting to the current enterprise.
- :param direction:
- The sorting direction. Set to `ASC` or `DESC`
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the device pins.
- """
- enterprise_id = enterprise.object_id if enterprise is not None else self.get_current_enterprise().id
- additional_params = {}
- if direction is not None:
- additional_params['direction'] = direction
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('enterprises', enterprise_id, 'device_pinners'),
- additional_params=additional_params,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- def metadata_cascade_policy(self, policy_id: str) -> 'MetadataCascadePolicy':
- """
- Initializes a :class:`MetadataCascadePolicy` object with the given policy ID.
-
- :param policy_id:
- The ID of the cascade policy object
- :returns:
- The cascade policy object
- """
- return self.translator.get('metadata_cascade_policy')(
- session=self._session,
- object_id=policy_id,
- )
-
- def metadata_template(self, scope: str, template_key: str) -> 'MetadataTemplate':
- """
- Initialize a :class:`MetadataTemplate` object with the given scope and template key.
-
- :param scope:
- The scope of the metadata template, e.g. 'enterprise' or 'global'
- :param template_key:
- The key of the metadata template
- :returns:
- The metadata template object
- """
- return self.translator.get('metadata_template')(
- session=self._session,
- object_id=None,
- response_object={
- 'type': 'metadata_template',
- 'scope': scope,
- 'templateKey': template_key,
- },
- )
-
- def metadata_template_by_id(self, template_id: str) -> 'MetadataTemplate':
- """
- Retrieves a metadata template by ID
-
- :param template_id:
- The ID of the template object
- :returns:
- The metadata template with data populated from the API
- """
- return self.translator.get('metadata_template')(
- session=self._session,
- object_id=template_id,
- )
-
- @api_call
- def get_metadata_templates(
- self,
- scope: str = 'enterprise',
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get all metadata templates for a given scope. By default, retrieves all metadata templates for the current
- enterprise.
-
- :param scope:
- The scope to retrieve templates for
- :param limit:
- The maximum number of entries to return per page.
- :param marker:
- The paging marker to start paging from.
- :param fields:
- List of fields to request.
- :returns:
- The collection of metadata templates for the given scope
- """
- return MarkerBasedObjectCollection(
- url=self._session.get_url('metadata_templates', scope),
- session=self._session,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def create_metadata_template(
- self,
- display_name: str,
- fields: Iterable['MetadataField'],
- template_key: str = None,
- hidden: bool = False,
- scope: str = 'enterprise',
- copy_instance_on_item_copy: bool = False
- ) -> 'MetadataTemplate':
- """
- Create a new metadata template. By default, only the display name and fields are required; the template key
- will be automatically generated based on the display name and the template will be created in the enterprise
- scope.
-
- :param display_name:
- The human-readable name of the template
- :param fields:
- The metadata fields for the template.
- :param template_key:
- An optional key for the template. If one is not provided, it will be derived from the display name.
- :param hidden:
- Whether the template should be hidden in the UI
- :param scope:
- The scope the template should be created in
- :param copy_instance_on_item_copy:
- Whether or not to include the metadata when a file or folder is copied.
- """
- url = self._session.get_url('metadata_templates', 'schema')
- body = {
- 'scope': scope,
- 'displayName': display_name,
- 'hidden': hidden,
- 'fields': [field.json() for field in fields],
- 'copyInstanceOnItemCopy': copy_instance_on_item_copy
- }
-
- if template_key is not None:
- body['templateKey'] = template_key
-
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def __create_zip(self, name: str, items: Iterable) -> dict:
- """
- Creates a zip file containing multiple files and/or folders for later download.
-
- :param name:
- The name of the zip file to be created.
- :param items:
- List of files and/or folders to be contained in the zip file.
- :returns:
- A dictionary representing a created zip
- """
- # pylint: disable=protected-access
- url = self._session.get_url('zip_downloads')
- zip_file_items = []
- for item in items:
- zip_file_items.append({'type': item._item_type, 'id': item.object_id})
- data = {
- 'download_file_name': name,
- 'items': zip_file_items
- }
- return self._session.post(url, data=json.dumps(data), skip_retry_codes={202}).json()
-
- @api_call
- def download_zip(self, name: str, items: Iterable, writeable_stream: IO) -> dict:
- """
- Downloads a zip file containing multiple files and/or folders.
-
- :param name:
- The name of the zip file to be created.
- :param items:
- List of files or folders to be part of the created zip.
- :param writeable_stream:
- Stream to pipe the readable stream of the zip file.
- :returns:
- A status response object
- """
- created_zip = self.__create_zip(name, items)
- response = self._session.get(created_zip['download_url'], expect_json_response=False, stream=True)
- for chunk in response.network_response.response_as_stream.stream(decode_content=True):
- writeable_stream.write(chunk)
- status = self._session.get(created_zip['status_url']).json()
- status.update(created_zip)
- return self.translator.translate(
- session=self._session,
- response_object=status,
- )
-
- def folder_lock(self, folder_lock_id: str) -> 'FolderLock':
- """
- Initialize a :class:`FolderLock` object, whose box id is folder_lock_id.
-
- :param folder_lock_id:
- The ID of the :class:`FolderLock` object.
- :return:
- A :class:`FolderLock` object with the given entry ID.
- """
- return self.translator.get('folder_lock')(session=self._session, object_id=folder_lock_id)
-
- def sign_request(self, sign_request_id: str) -> 'SignRequest':
- """
- Initialize a :class:`SignRequest` object, whose box id is sign_request_id.
-
- :param sign_request_id:
- The box id of the :class:`SignRequest` object.
- :return:
- A :class:`SignRequest` object with the given file id.
- """
- return self.translator.get('sign_request')(session=self._session, object_id=sign_request_id)
-
- # pylint: disable=too-many-branches
- def __create_sign_request(
- self,
- signers: Iterable,
- files: Optional[Iterable] = None,
- parent_folder_id: Optional[str] = None,
- prefill_tags: Optional[Iterable] = None,
- are_reminders_enabled: Optional[bool] = None,
- are_text_signatures_enabled: Optional[bool] = None,
- days_valid: Optional[str] = None,
- email_message: Optional[Iterable] = None,
- email_subject: Optional[str] = None,
- external_id: Optional[str] = None,
- is_document_preparation_needed: Optional[bool] = None,
- redirect_url: Optional[str] = None,
- declined_redirect_url: Optional[str] = None,
- template_id: Optional[str] = None) -> 'SignRequest':
- url = self._session.get_url('sign_requests')
-
- body = {
- 'signers': signers,
- }
-
- if files:
- body['source_files'] = files
- if parent_folder_id:
- body['parent_folder'] = {
- 'id': parent_folder_id,
- 'type': 'folder'
- }
- if prefill_tags:
- body['prefill_tags'] = prefill_tags
- if are_reminders_enabled:
- body['are_reminders_enabled'] = are_reminders_enabled
- if are_text_signatures_enabled:
- body['are_text_signatures_enabled'] = are_text_signatures_enabled
- if days_valid:
- body['days_valid'] = days_valid
- if email_message:
- body['email_message'] = email_message
- if email_subject:
- body['email_subject'] = email_subject
- if external_id:
- body['external_id'] = external_id
- if is_document_preparation_needed:
- body['is_document_preparation_needed'] = is_document_preparation_needed
- if redirect_url:
- body['redirect_url'] = redirect_url
- if declined_redirect_url:
- body['declined_redirect_url'] = declined_redirect_url
- if template_id:
- body['template_id'] = template_id
-
- box_response = self._session.post(url, data=json.dumps(body))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- @deprecated('Use create_sign_request_v2 instead')
- def create_sign_request(
- self,
- files: Iterable,
- signers: Iterable,
- parent_folder_id: str,
- prefill_tags: Optional[Iterable] = None,
- are_reminders_enabled: Optional[bool] = None,
- are_text_signatures_enabled: Optional[bool] = None,
- days_valid: Optional[str] = None,
- email_message: Optional[Iterable] = None,
- email_subject: Optional[str] = None,
- external_id: Optional[str] = None,
- is_document_preparation_needed: Optional[bool] = None,
- redirect_url: Optional[str] = None,
- declined_redirect_url: Optional[str] = None,
- template_id: Optional[str] = None,
- ) -> 'SignRequest':
- """
- Used to create a new sign request.
-
- :param files:
- List of files to create a signing document from.
- :param signers:
- List of signers for the sign request. 35 is the max number of signers permitted.
- :param parent_folder_id:
- The id of the destination folder to place sign request specific data in.
- :param prefill_tags:
- When a document contains sign related tags in the content,
- you can prefill them using this prefill_tags by referencing the 'id' of the tag as the external_id field of the prefill tag.
- :param are_reminders_enabled:
- Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to outstanding signers.
- :param are_text_signatures_enabled:
- Disables the usage of signatures generated by typing (text).
- :param days_valid:
- Number of days after which this request will automatically expire if not completed.
- :param email_message:
- Message to include in sign request email. The field is cleaned through sanitization of specific characters.
- However, some html tags are allowed. Links included in the message are also converted to hyperlinks in the email.
- The message may contain the following html tags including a, abbr, acronym, b, blockquote, code, em, i, ul, li, ol, and strong.
- Be aware that when the text to html ratio is too high, the email may end up in spam filters. Custom styles on these tags are not allowed.
- If this field is not passed, a default message will be used.
- :param email_subject:
- Subject of sign request email. This is cleaned by sign request. If this field is not passed, a default subject will be used.
- :param external_id:
- This can be used to reference an ID in an external system that the sign request is related to.
- :param is_document_preparation_needed:
- Indicates if the sender should receive a prepare_url in the response to complete document preparation via UI.
- :param redirect_url:
- The URL that a signer will be redirected to after signing a document.
- If no declined redirect URL is specified, this URL will be used for decline actions as well.
- :param declined_redirect_url:
- The URL that a signer will be redirected to after declining to sign a document.
- :param template_id:
- The ID of the sign template to use for the sign request.
- :returns:
- A dictionary representing a created SignRequest
- """
- return self.__create_sign_request(
- signers, files, parent_folder_id, prefill_tags, are_reminders_enabled, are_text_signatures_enabled, days_valid, email_message,
- email_subject, external_id, is_document_preparation_needed, redirect_url, declined_redirect_url, template_id)
-
- @api_call
- def create_sign_request_v2(
- self,
- signers: Iterable,
- files: Optional[Iterable] = None,
- parent_folder_id: Optional[str] = None,
- prefill_tags: Optional[Iterable] = None,
- are_reminders_enabled: Optional[bool] = None,
- are_text_signatures_enabled: Optional[bool] = None,
- days_valid: Optional[str] = None,
- email_message: Optional[Iterable] = None,
- email_subject: Optional[str] = None,
- external_id: Optional[str] = None,
- is_document_preparation_needed: Optional[bool] = None,
- redirect_url: Optional[str] = None,
- declined_redirect_url: Optional[str] = None,
- template_id: Optional[str] = None,
- ) -> 'SignRequest':
- """
- Used to create a new sign request.
-
- :param signers:
- List of signers for the sign request. 35 is the max number of signers permitted.
- :param files:
- List of files to create a signing document from.
- :param parent_folder_id:
- The id of the destination folder to place sign request specific data in.
- :param prefill_tags:
- When a document contains sign related tags in the content,
- you can prefill them using this prefill_tags by referencing the 'id' of the tag as the external_id field of the prefill tag.
- :param are_reminders_enabled:
- Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to outstanding signers.
- :param are_text_signatures_enabled:
- Disables the usage of signatures generated by typing (text).
- :param days_valid:
- Number of days after which this request will automatically expire if not completed.
- :param email_message:
- Message to include in sign request email. The field is cleaned through sanitization of specific characters.
- However, some html tags are allowed. Links included in the message are also converted to hyperlinks in the email.
- The message may contain the following html tags including a, abbr, acronym, b, blockquote, code, em, i, ul, li, ol, and strong.
- Be aware that when the text to html ratio is too high, the email may end up in spam filters. Custom styles on these tags are not allowed.
- If this field is not passed, a default message will be used.
- :param email_subject:
- Subject of sign request email. This is cleaned by sign request. If this field is not passed, a default subject will be used.
- :param external_id:
- This can be used to reference an ID in an external system that the sign request is related to.
- :param is_document_preparation_needed:
- Indicates if the sender should receive a prepare_url in the response to complete document preparation via UI.
- :param redirect_url:
- The URL that a signer will be redirected to after signing a document.
- If no declined redirect URL is specified, this URL will be used for decline actions as well.
- :param declined_redirect_url:
- The URL that a signer will be redirected to after declining to sign a document.
- :param template_id:
- The ID of the sign template to use for the sign request.
- :returns:
- A dictionary representing a created SignRequest
- """
- return self.__create_sign_request(
- signers, files, parent_folder_id, prefill_tags, are_reminders_enabled, are_text_signatures_enabled, days_valid, email_message,
- email_subject, external_id, is_document_preparation_needed, redirect_url, declined_redirect_url, template_id)
-
- @api_call
- def get_sign_requests(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Returns all the sign requests.
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the device pins.
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('sign_requests'),
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- def sign_template(self, sign_template_id: str) -> 'SignTemplate':
- """
- Initialize a :class:`SignTemplate` object, whose box id is sign_template_id.
-
- :param sign_template_id:
- The box id of the :class:`SignTemplate` object.
- :return:
- A :class:`SignTemplate` object with the given sign_template_id.
- """
- return self.translator.get('sign_template')(session=self._session, object_id=sign_template_id)
-
- @api_call
- def get_sign_templates(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- ) -> 'BoxObjectCollection':
- """
- Returns all sign templates
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from.
- :returns:
- Sign templates
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url("sign_templates"),
- limit=limit,
- marker=marker,
- return_full_pages=False,
- )
-
- @api_call
- def get_sign_template(
- self,
- sign_template_id: str,
- ) -> Any:
- """
- Returns a sign template
-
- :param sign_template_id:
- ID of Sign template to fetch
- :returns:
- Sign template
- """
- response = self._session.get(f"{self._session.get_url('sign_templates')}/{sign_template_id}")
- return self.translator.translate(
- session=self._session,
- response_object=response.json(),
- )
-
- @api_call
- def send_ai_question(
- self,
- items: Iterable,
- prompt: str,
- mode: Optional[str] = None,
- ai_agent: Optional[dict] = None
- ) -> Any:
- """
- Sends an AI request to supported LLMs and returns an answer specifically focused on the user's
- question given the provided context.
-
- :param items:
- The items to be processed by the LLM, often files.
- :param prompt:
- The prompt provided by the client to be answered by the LLM.
- The prompt's length is limited to 10000 characters.
- :param mode:
- The mode specifies if this request is for a single or multiple items.
- If you select single_item_qa the items array can have one element only.
- Selecting multiple_item_qa allows you to provide up to 25 items.
-
- Value is one of `multiple_item_qa`, `single_item_qa`
- :param ai_agent:
- The AI agent used to handle queries.
- :returns:
- A response including the answer from the LLM.
- """
- url = self._session.get_url('ai/ask')
- if mode is None:
- mode = ('single_item_qa' if len(items) == 1 else 'multiple_item_qa')
- body = {
- 'items': items,
- 'prompt': prompt,
- 'mode': mode
- }
-
- if ai_agent is not None:
- body['ai_agent'] = ai_agent
-
- box_response = self._session.post(url, data=json.dumps(body))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def send_ai_text_gen(
- self,
- dialogue_history: Iterable,
- items: Iterable,
- prompt: str,
- ai_agent: Optional[dict] = None
- ):
- """
- Sends an AI request to supported LLMs and returns an answer specifically focused on the creation of new text.
-
- :param dialogue_history:
- The history of prompts and answers previously passed to the LLM.
- This provides additional context to the LLM in generating the response.
- :param items:
- The items to be processed by the LLM, often files. The array can include exactly one element.
- :param prompt:
- The prompt provided by the client to be answered by the LLM.
- The prompt's length is limited to 10000 characters.
- :param ai_agent:
- The AI agent used for generating text.
- :returns:
- A response including the generated text from the LLM.
- """
- url = self._session.get_url('ai/text_gen')
- body = {
- 'dialogue_history': dialogue_history,
- 'items': items,
- 'prompt': prompt
- }
-
- if ai_agent is not None:
- body['ai_agent'] = ai_agent
-
- box_response = self._session.post(url, data=json.dumps(body))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_ai_agent_default_config(
- self,
- mode: str,
- language: Optional[str] = None,
- model: Optional[str] = None,
- ):
- """
- Get the AI agent default configuration.
-
- :param mode:
- The mode to filter the agent config to return.
- :param language:
- The ISO language code to return the agent config for.
- If the language is not supported the default agent configuration is returned.
- :param model:
- The model to return the default agent config for.
- :returns:
- A default agent configuration.
- This can be one of the following two objects:
- AI agent for questions and AI agent for text generation.
- The response depends on the agent configuration requested in this endpoint.
- """
- url = self._session.get_url('ai_agent_default')
- params = {'mode': mode}
- if language is not None:
- params['language'] = language
- if model is not None:
- params['model'] = model
-
- box_response = self._session.get(url, params=params)
- return self.translator.translate(
- session=self._session,
- response_object=box_response.json(),
- )
diff --git a/boxsdk/client/developer_token_client.py b/boxsdk/client/developer_token_client.py
deleted file mode 100644
index 6d3d5a861..000000000
--- a/boxsdk/client/developer_token_client.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from typing import TYPE_CHECKING
-
-from ..auth import DeveloperTokenAuth
-from .client import Client
-
-if TYPE_CHECKING:
- from boxsdk import OAuth2
- from boxsdk.session.session import Session
-
-
-class DeveloperTokenClient(Client):
- """
- Box client subclass which authorizes with a developer token.
- """
- def __init__(self, oauth: 'OAuth2' = None, session: 'Session' = None):
- super().__init__(oauth=oauth or DeveloperTokenAuth(), session=session)
diff --git a/boxsdk/client/development_client.py b/boxsdk/client/development_client.py
deleted file mode 100644
index f7f273061..000000000
--- a/boxsdk/client/development_client.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from .developer_token_client import DeveloperTokenClient
-from .logging_client import LoggingClient
-
-
-class DevelopmentClient(LoggingClient, DeveloperTokenClient):
- """
- Client subclass that uses developer token auth and logs requests and responses.
- Great for use in development!
- """
diff --git a/boxsdk/client/logging_client.py b/boxsdk/client/logging_client.py
deleted file mode 100644
index bb7859691..000000000
--- a/boxsdk/client/logging_client.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from typing import Any
-
-from .client import Client
-from ..util.log import setup_logging
-
-
-class LoggingClient(Client):
- """
- Box client subclass which logs requests and responses.
- """
- def __init__(self, *args: Any, **kwargs: Any):
- setup_logging(None)
- super().__init__(*args, **kwargs)
diff --git a/boxsdk/config.py b/boxsdk/config.py
deleted file mode 100644
index c58290d61..000000000
--- a/boxsdk/config.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from sys import version_info as py_version
-
-from . import version
-
-
-class API:
- """Configuration object containing the URLs for the Box API."""
- BASE_API_URL = 'https://api.box.com/2.0'
- UPLOAD_URL = 'https://upload.box.com/api/2.0'
- OAUTH2_API_URL = 'https://api.box.com/oauth2' #
- OAUTH2_AUTHORIZE_URL = 'https://account.box.com/api/oauth2/authorize' #
- MAX_RETRY_ATTEMPTS = 5
- CHUNK_UPLOAD_THREADS = 5
-
-
-class Client:
- """Configuration object containing the user agent string."""
- VERSION = version.__version__
- USER_AGENT_STRING = f'box-python-sdk-{VERSION}'
- BOX_UA_STRING = f'agent=box-python-sdk/{VERSION}; ' \
- f'env=python/{py_version.major}.{py_version.minor}.{py_version.micro}'
-
-
-class Proxy:
- URL = None
- AUTH = None
diff --git a/boxsdk/exception.py b/boxsdk/exception.py
deleted file mode 100644
index 31e138cc0..000000000
--- a/boxsdk/exception.py
+++ /dev/null
@@ -1,115 +0,0 @@
-from typing import Optional
-
-import attr
-
-from .network.network_interface import NetworkResponse
-from .util.log import sanitize_dictionary
-
-
-class BoxException(Exception):
- """
- Base class exception for all errors raised from the SDK.
- """
- def __str__(self):
- return self.__class__.__name__
-
- def __repr__(self):
- return f'<{self.__class__.__name__}>'
-
-
-class BoxValueError(ValueError):
- """
- Exception raise by SDK value errors
- """
-
-
-class BoxNetworkException(BoxException):
- """
- Exception raised from the network layer.
- """
-
-
-@attr.s(repr=True, slots=True, frozen=True)
-class BoxAPIException(BoxException):
- """
- Exception raised from the box session layer.
-
- :param status:
- HTTP status code of the failed response
- :param code:
- The 'code' field of the failed response
- :param message:
- A message to associate with the exception, e.g. 'message' field of the json in the failed response
- :param request_id:
- The 'request_id' field of the json in the failed response
- :param headers:
- The HTTP headers in the failed response
- :param url:
- The url which raised the exception
- :param method:
- The HTTP verb used to make the request.
- :param context_info:
- The context_info returned in the failed response.
- :param network_response:
- The failed response
- """
- status: int = attr.ib()
- code: Optional[str] = attr.ib(default=None)
- message: Optional[str] = attr.ib(default=None)
- request_id: Optional[str] = attr.ib(default=None)
- headers: dict = attr.ib(default=None, hash=False)
- url: str = attr.ib(default=None)
- method: str = attr.ib(default=None)
- context_info: Optional[dict] = attr.ib(default=None)
- network_response: 'NetworkResponse' = attr.ib(default=None, repr=False)
-
- 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: {sanitize_dictionary(self.headers)}',
- f'URL: {self.url}',
- f'Method: {self.method}',
- f'Context Info: {self.context_info}',
- ))
-
-
-@attr.s(repr=True, slots=True, frozen=True)
-class BoxOAuthException(BoxException):
- """
- Exception raised during auth.
-
- :param status:
- HTTP status code of the auth response
- :param message:
- A message to associate with the exception, e.g. HTTP content of the auth response
- :param url:
- The url which raised the exception
- :param method:
- The HTTP verb used to make the request.
- :param network_response:
- The network response for the request.
- :param code:
- The 'code' field of the failed response
- """
- status: int = attr.ib()
- message: str = attr.ib(default=None)
- url: str = attr.ib(default=None)
- method: str = attr.ib(default=None)
- network_response: NetworkResponse = attr.ib(default=None, repr=False)
- code: Optional[str] = attr.ib(default=None)
-
- def __str__(self):
- # pylint:disable=no-member
- if self.network_response:
- headers = sanitize_dictionary(self.network_response.headers)
- # pylint:enable=no-member
- else:
- headers = 'N/A'
- return f'\nMessage: {self.message}\nStatus: {self.status}\nURL: {self.url}\nMethod: {self.method}' \
- f'\nHeaders: {headers}'
-
-
-__all__ = ['BoxException', 'BoxAPIException', 'BoxOAuthException', 'BoxNetworkException']
diff --git a/boxsdk/network/__init__.py b/boxsdk/network/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/boxsdk/network/default_network.py b/boxsdk/network/default_network.py
deleted file mode 100644
index f71c484f2..000000000
--- a/boxsdk/network/default_network.py
+++ /dev/null
@@ -1,255 +0,0 @@
-import logging
-from logging import getLogger
-from pprint import pformat
-import sys
-import time
-from typing import Any, Callable, Type, Optional
-
-import requests
-from requests import Response
-from requests.structures import CaseInsensitiveDict
-from urllib3 import HTTPResponse
-
-from .network_interface import Network, NetworkResponse
-from ..util.log import sanitize_dictionary
-
-
-class DefaultNetwork(Network):
- """Implements the network interface using the requests library."""
-
- LOGGER_NAME = 'boxsdk.network'
- REQUEST_FORMAT = '\x1b[36m%(method)s %(url)s %(request_kwargs)s\x1b[0m'
- EXCEPTION_FORMAT = '\x1b[31mRequest "%(method)s %(url)s" failed with %(exc_type_name)s exception: %(exc_value)r\x1b[0m'
-
- def __init__(self):
- super().__init__()
- self._session = requests.Session()
- self._logger = getLogger(__name__)
-
- def request(self, method: str, url: str, access_token: str, **kwargs: Any) -> NetworkResponse:
- """Base class override.
-
- Make a network request using a requests.Session. Logs information about an API request and response.
-
- Also logs exceptions before re-raising them.
-
- The logging of the response is deferred to :class:`DefaultNetworkResponse`.
- See that class's docstring for more info.
- """
- log_response_content = kwargs.pop('log_response_content', True)
- self._log_request(method, url, **kwargs)
- # pylint:disable=abstract-class-instantiated
- try:
- return self.network_response_constructor(
- request_response=self._session.request(method, url, **kwargs),
- access_token_used=access_token,
- log_response_content=log_response_content
- )
- except Exception:
- self._log_exception(method, url, sys.exc_info())
- raise
-
- def retry_after(self, delay: float, request_method: Callable, *args: Any, **kwargs: Any) -> Any:
- """Base class override.
- Retry after sleeping for delay seconds.
- """
- time.sleep(delay)
- return request_method(*args, **kwargs)
-
- @property
- def network_response_constructor(self) -> Type['DefaultNetworkResponse']:
- """Baseclass override.
-
- A callable that accepts `request_response` and `access_token_used`
- keyword arguments for the :class:`DefaultNetworkResponse` constructor,
- and returns an instance of :class:`DefaultNetworkResponse`.
- """
- return DefaultNetworkResponse
-
- def _log_request(self, method: str, url: str, **kwargs: Any) -> None:
- """
- Logs information about the Box API request.
-
- :param method:
- The HTTP verb that should be used to make the request.
- :param url:
- The URL for the request.
- """
- if self._logger.isEnabledFor(logging.INFO):
- self._logger.info(
- self.REQUEST_FORMAT,
- {'method': method, 'url': url, 'request_kwargs': pformat(sanitize_dictionary(kwargs))},
- )
-
- def _log_exception(self, method: str, url: str, exc_info: Any) -> None:
- """Log information at WARNING level about the exception that was raised when trying to make the request.
-
- :param method: The HTTP verb that was used to make the request.
- :param url: The URL for the request.
- :param exc_info: The exception info returned from `sys.exc_info()`.
- """
- if self._logger.isEnabledFor(logging.WARNING):
- exc_type, exc_value, _ = exc_info
- self._logger.warning(
- self.EXCEPTION_FORMAT,
- {'method': method, 'url': url, 'exc_type_name': exc_type.__name__, 'exc_value': exc_value},
- )
-
-
-class DefaultNetworkResponse(NetworkResponse):
- """Implementation of the network interface using the requests library.
-
- :class:`requests.Response` has a few mutually-exclusive ways to read the
- content of the response:
-
- - With the `Response.raw` attribute, an `io.IOBase` instance returned
- from the `urllib3` library, that can be read once in chunks from
- beginning to end.
- - With `Response.iter_content()` and other iter_* generators, which
- also can only be read once and advance the `Response.raw` IO stream.
- - With the `Response.content` property (and other attributes such as
- `Response.text` and `Response.json()`), which reads and caches the
- remaining response content in memory. Can be accessed multiple times,
- but cannot be safely accessed if any of the previous mechanisms have
- been used at all. And if this property has already been accessed,
- then the other mechanisms will have been exhausted, and attempting to
- read from them will make it appear like the response content is
- empty.
-
- Any of these mechanisms may be used to read any response, regardless of
- whether `stream=True` or `stream=False` on the request.
-
- If the caller uses `Response.content`, then it is safe for
- :class:`DefaultNetwork` to also access it. But if the caller uses any of
- the streaming mechanisms, then it is not safe for :class:`DefaultNetwork`
- to ever read any of the content.
-
- The SDK logs only the response content of type JSON. Non-JSON responses, e.g.
- the content of the downloaded file should not be logged by the SDK at any time.
- In that case the response will be logged with a placeholder for the actual content.
-
- :param: `log_response_content` specifies wheather the response content should be logged or not.
- Its value is determined by `BoxRequest.expect_json_response` field, which is set to False,
- only if explicitly specified inside SDK method, e.g. self._session.get(url, expect_json_response=False).
- So the contenet of the response will be read by the logger only when the call inside an SDK method
- expects a JSON response. In this case we can be sure that the SDK method will read the content
- of the response using non-streaming mechanism and accessing content of the response by logger
- with `response.json()` or 'response.content` is safe.
- """
-
- _COMMON_RESPONSE_FORMAT = '"%(method)s %(url)s" %(status_code)s %(content_length)s\n%(headers)s\n%(content)s\n'
- SUCCESSFUL_RESPONSE_FORMAT = f'\x1b[32m{_COMMON_RESPONSE_FORMAT}\x1b[0m'
- ERROR_RESPONSE_FORMAT = f'\x1b[31m{_COMMON_RESPONSE_FORMAT}\x1b[0m'
- CONTENT_NOT_LOGGED = ''
-
- def __init__(self, request_response: 'Response', access_token_used: str, log_response_content: bool = True):
- self._logger = getLogger(__name__)
- self._request_response = request_response
- self._access_token_used = access_token_used
- self._did_log = False
- self._json = None
- self.log(can_safely_log_content=log_response_content)
-
- def json(self) -> dict:
- """Base class override."""
- if self._json is None:
- self._json = self._request_response.json()
- return self._json
-
- @property
- def content(self) -> Optional[bytes]:
- """Base class override."""
- return self._request_response.content
-
- @property
- def status_code(self) -> int:
- """Base class override."""
- return self._request_response.status_code
-
- @property
- def ok(self) -> bool:
- """Base class override."""
- # pylint:disable=invalid-name
- return self._request_response.ok
-
- @property
- def headers(self) -> CaseInsensitiveDict:
- """Base class override."""
- return self._request_response.headers
-
- @property
- def response_as_stream(self) -> HTTPResponse:
- """Base class override."""
- return self._request_response.raw
-
- @property
- def access_token_used(self) -> str:
- """Base class override."""
- return self._access_token_used
-
- @property
- def request_response(self) -> Response:
- """
- The response returned from the Requests library.
- """
- return self._request_response
-
- def log(self, can_safely_log_content: bool = False) -> None:
- """Logs information about the Box API response.
-
- Will only execute once. Subsequent calls will be no-ops. This is
- partially because we only want to log responses once, and partially
- because this is necessary to prevent this method from infinite
- recursing with its use of the `content` property.
-
- :param can_safely_log_content:
- (optional) `True` if the caller is accessing the `content`
- property, `False` otherwise.
-
- As stated in the class docstring, it is unsafe for this logging
- method to access `content` unless the caller is also accessing it.
-
- Defaults to `False`.
- """
- if self._did_log:
- return
- self._did_log = True
-
- if self.ok:
- logger_method, logger_level, response_format = self._logger.info, logging.INFO, self.SUCCESSFUL_RESPONSE_FORMAT
- else:
- logger_method, logger_level, response_format = self._logger.warning, logging.WARNING, self.ERROR_RESPONSE_FORMAT
-
- if not self._logger.isEnabledFor(logger_level):
- return
-
- content_length = self.headers.get('Content-Length', None)
- content = self.CONTENT_NOT_LOGGED
- if can_safely_log_content:
- if content_length is None:
- content_length = str(len(self.content))
-
- # If possible, get the content as a JSON `dict`, that way
- # `pformat(content)` will return pretty-printed JSON.
- try:
- content = self.json()
- except ValueError:
- content = self.content
- content = pformat(sanitize_dictionary(content))
- if content_length is None:
- content_length = '?'
- logger_method(
- response_format,
- {
- 'method': self.request_response.request.method,
- 'url': self.request_response.request.url,
- 'status_code': self.status_code,
- 'content_length': content_length,
- 'headers': pformat(self.headers),
- 'content': content,
- },
- )
-
- def __repr__(self) -> str:
- return f''
diff --git a/boxsdk/network/network_interface.py b/boxsdk/network/network_interface.py
deleted file mode 100644
index bc4531060..000000000
--- a/boxsdk/network/network_interface.py
+++ /dev/null
@@ -1,113 +0,0 @@
-from abc import ABC, abstractmethod
-from typing import Any, Callable, Union
-
-
-class Network(ABC):
- """
- Abstract base class specifying the interface of the network layer.
- """
-
- @abstractmethod
- def request(self, method: str, url: str, access_token: str, **kwargs: Any) -> 'NetworkResponse':
- """
- Make a network request to the given url with the given method.
-
- :param method:
- The HTTP verb that should be used to make the request.
- :param url:
- The URL for the request.
- :param access_token:
- The OAuth2 access token used to authorize the request.
- """
- raise NotImplementedError # pragma: no cover
-
- @abstractmethod
- def retry_after(self, delay: float, request_method: Callable, *args: Any, **kwargs: Any) -> 'NetworkResponse':
- """
- Make a network request after a given delay.
-
- :param delay:
- How long until the request should be executed.
- :param request_method:
- A callable that will execute the request.
- """
- raise NotImplementedError # pragma: no cover
-
- @property
- def network_response_constructor(self) -> Union[type, Callable]:
- """The constructor to use for creating NetworkResponse instances.
-
- This is not implemented by default, and is not a required part of the
- interface.
-
- It is recommended that implementations of `request()` call this to
- construct their responses, rather than hard-coding the construction.
- That way, subclasses of the implementation can easily extend the
- construction of :class:`NetworkResponse` instances, by overriding this
- property, instead of needing to override `request()`.
-
- :return:
- A callable that returns an instance of :class:`NetworkResponse`.
- Most commonly, this will be a subclass of :class:`NetworkResponse`.
- """
- return NetworkResponse
-
-
-class NetworkResponse(ABC):
- """Abstract base class specifying the interface for a network response."""
-
- @abstractmethod
- def json(self) -> Union[dict, list, str, int, float]:
- """
- Return the parsed JSON response.
- """
- raise NotImplementedError # pragma: no cover
-
- @property
- @abstractmethod
- def content(self) -> Any:
- """
- Return the content of the response body.
- """
- raise NotImplementedError # pragma: no cover
-
- @property
- @abstractmethod
- def status_code(self) -> int:
- """
- Return the HTTP status code of the response.
- """
- raise NotImplementedError # pragma: no cover
-
- @property
- @abstractmethod
- def ok(self) -> bool:
- """
- Return whether or not the request was successful.
- """
- # pylint:disable=invalid-name
- raise NotImplementedError # pragma: no cover
-
- @property
- @abstractmethod
- def headers(self) -> dict:
- """
- Return the response headers.
- """
- raise NotImplementedError # pragma: no cover
-
- @property
- @abstractmethod
- def response_as_stream(self) -> Any:
- """
- Return a stream containing the raw network response.
- """
- raise NotImplementedError # pragma: no cover
-
- @property
- @abstractmethod
- def access_token_used(self) -> str:
- """
- Return the access token used to make the request.
- """
- raise NotImplementedError # pragma: no cover
diff --git a/boxsdk/object/__init__.py b/boxsdk/object/__init__.py
deleted file mode 100644
index d41b3ecd8..000000000
--- a/boxsdk/object/__init__.py
+++ /dev/null
@@ -1,43 +0,0 @@
-__all__ = [
- 'collaboration',
- 'collaboration_allowlist',
- 'collaboration_allowlist_entry',
- 'collaboration_allowlist_exempt_target',
- 'collection',
- 'comment',
- 'device_pinner',
- 'enterprise',
- 'events',
- 'event',
- 'file',
- 'file_request',
- 'file_version',
- 'file_version_retention',
- 'folder',
- 'folder_lock',
- 'group',
- 'group_membership',
- 'invite',
- 'legal_hold',
- 'legal_hold_policy',
- 'legal_hold_policy_assignment',
- 'metadata_cascade_policy',
- 'metadata_template',
- 'recent_item',
- 'retention_policy',
- 'retention_policy_assignment',
- 'search',
- 'sign_request',
- 'storage_policy',
- 'storage_policy_assignment',
- 'terms_of_service',
- 'terms_of_service_user_status',
- 'trash',
- 'task',
- 'task_assignment',
- 'user',
- 'upload_session',
- 'webhook',
- 'watermark',
- 'web_link'
-]
diff --git a/boxsdk/object/api_json_object.py b/boxsdk/object/api_json_object.py
deleted file mode 100644
index ef1689a60..000000000
--- a/boxsdk/object/api_json_object.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from abc import ABCMeta
-from collections.abc import Mapping
-
-from .base_api_json_object import BaseAPIJSONObject, BaseAPIJSONObjectMeta
-
-
-class APIJSONObjectMeta(BaseAPIJSONObjectMeta, ABCMeta):
- """
- Avoid conflicting metaclass definitions for APIJSONObject.
- http://code.activestate.com/recipes/204197-solving-the-metaclass-conflict/
- """
-
-
-class APIJSONObject(BaseAPIJSONObject, Mapping, metaclass=APIJSONObjectMeta):
- """Class representing objects that are not part of the REST API."""
-
- def __len__(self) -> int:
- return len(self._response_object)
diff --git a/boxsdk/object/base_api_json_object.py b/boxsdk/object/base_api_json_object.py
deleted file mode 100644
index bc9903a2c..000000000
--- a/boxsdk/object/base_api_json_object.py
+++ /dev/null
@@ -1,157 +0,0 @@
-import copy
-from typing import Any, Iterator, Iterable, Optional
-
-from ..util.translator import Translator
-
-
-class BaseAPIJSONObjectMeta(type):
- """
- Metaclass for Box API objects.
-
- Registers classes with the default translator, so that API responses can be
- translated to the correct type. This relies on the _item_type field, which
- must be defined in the class's namespace dict (and must be re-defined, in
- order to register a custom subclass), to match the 'type' field of the
- response json. But the type-class mapping will only be registered if the
- module of the class is imported.
-
- For example, events returned from the API look like
-
- .. code-block:: json
-
- {'type': 'event', ...}
-
- so a class for that type could be created and registered with the default
- translator like this:
-
- .. code-block:: python
-
- class Event(BaseAPIJSONObject):
- _item_type = 'event'
- ...
-
- NOTE: The default translator registration functionality is a private
- implementation detail of the SDK, to make it easy to register the default
- API object classes with the default translator. For convenience and
- backwards-compatability, developers are allowed to re-define the _item_type
- field in their own custom subclasses in order to take advantage of this
- functionality, but are encouraged not to. Since this is a private
- implementation detail, it may change or be removed in any major or minor
- release. Additionally, it has the usual hazards of mutable global state.
- The supported and recommended ways for registering custom subclasses are:
-
- - Constructing a new :class:`Translator`, calling `Translator.register()`
- as necessary, and passing it to the :class:`BoxSession` constructor.
- - Calling `session.translator.register()` on an existing
- :class:`BoxSession`.
- - Calling `client.translator.register()` on an existing :class:`Client`.
- """
-
- def __init__(cls, name, bases, attrs):
- super().__init__(name, bases, attrs)
- item_type = attrs.get('_item_type', None)
- if item_type is not None:
- Translator._default_translator.register(item_type, cls) # pylint:disable=protected-access,no-member
- # Some types have - in them instead of _ in the API.
- if "-" in item_type:
- Translator._default_translator.register(item_type.replace("-", "_"), cls) # pylint:disable=protected-access,no-member
-
-
-class BaseAPIJSONObject(metaclass=BaseAPIJSONObjectMeta):
- """Base class containing basic logic shared between true REST objects and other objects (such as an Event)"""
-
- # :attr _item_type:
- # (protected) The Box resource type that this class represents.
- # For API object/resource classes this should equal the expected value
- # of the 'type' field in API JSON responses. Otherwise, this should be
- # `None`.
- #
- # NOTE: When defining a leaf class with an _item_type in this SDK, it's
- # also important to add the module name to __all__ in object/__init__.py,
- # so that it will be imported and registered with the default translator.
- _item_type: Optional[str] = None
- _untranslated_fields = ()
-
- def __init__(self, response_object: dict = None, **kwargs: Any):
- """
- :param response_object:
- A JSON object representing the object returned from a Box API request.
- """
- super().__init__(**kwargs)
- self._response_object = response_object or {}
- self.__dict__.update(self._response_object)
-
- def __getitem__(self, item: str) -> Any:
- """
- Try to get the attribute from the API response object.
-
- :param item:
- The attribute to retrieve from the API response object.
- """
- return self._response_object[item]
-
- def __contains__(self, item: str) -> bool:
- """
- Does the response object contains this item attribute?
-
- :param item:
- The attribute to check for in the API response object.
-
- """
- return item in self._response_object
-
- def __iter__(self) -> Iterator:
- """
- Get all of the keys of the API response object.
- """
- return iter(self._response_object)
-
- def __repr__(self) -> str:
- """Base class override. Return a human-readable representation using the Box ID or name of the object."""
- extra_description = f' - {self._description}' if self._description else ''
- description = f''
- return description
-
- @property
- def _description(self) -> str:
- """Return a description of the object if one exists."""
- return ""
-
- @property
- def object_type(self) -> str:
- """Return the Box type for the object.
- """
- return self._item_type
-
- @classmethod
- def untranslated_fields(cls) -> tuple:
- """
- The fields that should not be translated on this object.
- """
- return cls._untranslated_fields
-
- @classmethod
- def _untranslate(cls, value: Any) -> Iterable:
- """
- Untranslates a given object into a dictionary.
-
- :param value:
- The object to untranslate.
- :return:
- A dictionary containing the untranslated object.
- """
- if isinstance(value, BaseAPIJSONObject):
- return cls._untranslate(value._response_object) # pylint:disable=protected-access
- if isinstance(value, dict):
- return {k: cls._untranslate(v) for (k, v) in value.items()}
- if isinstance(value, list):
- return [cls._untranslate(entry) for entry in value]
-
- return copy.copy(value)
-
- @property
- def response_object(self) -> Iterable:
- """
- Return the JSON object representing the object returned from a Box API request.
- """
- return self._untranslate(self)
diff --git a/boxsdk/object/base_endpoint.py b/boxsdk/object/base_endpoint.py
deleted file mode 100644
index 251dd7930..000000000
--- a/boxsdk/object/base_endpoint.py
+++ /dev/null
@@ -1,52 +0,0 @@
-from typing import TYPE_CHECKING, Any
-from .cloneable import Cloneable
-
-if TYPE_CHECKING:
- from boxsdk.session.session import Session
- from boxsdk.util.translator import Translator
-
-
-class BaseEndpoint(Cloneable):
- """A Box API endpoint."""
-
- def __init__(self, session: 'Session', **kwargs: Any):
- """
- :param session:
- The Box session used to make requests.
- :param kwargs:
- Keyword arguments for base class constructors.
- """
- super().__init__(**kwargs)
- self._session = session
-
- @property
- def session(self) -> 'Session':
- """
- Get the :class:`BoxSession` instance the object is using.
- """
- return self._session
-
- @property
- def translator(self) -> 'Translator':
- """
- The translator used for translating Box API JSON responses into `BaseAPIJSONObject` smart objects.
- """
- return self._session.translator
-
- def get_url(self, *args: Any) -> str:
- """
- Return the URL used to access the endpoint.
-
- :param args:
- Parts of the endpoint URL.
- """
- return self._session.get_url(*args)
-
- def clone(self, session: 'Session' = None) -> 'BaseEndpoint':
- """
- Returns a copy of this cloneable object using the specified session.
-
- :param session:
- The Box session used to make requests.
- """
- return self.__class__(session or self._session)
diff --git a/boxsdk/object/base_item.py b/boxsdk/object/base_item.py
deleted file mode 100644
index 05592066a..000000000
--- a/boxsdk/object/base_item.py
+++ /dev/null
@@ -1,186 +0,0 @@
-import json
-
-from typing import TYPE_CHECKING, Any, Union
-
-from .base_object import BaseObject
-from ..exception import BoxValueError
-from ..util.api_call_decorator import api_call
-from ..util.datetime_formatter import normalize_date_to_rfc3339_format
-from ..util.default_arg_value import SDK_VALUE_NOT_SET
-
-if TYPE_CHECKING:
- from boxsdk.object.folder import Folder
- from boxsdk.object.collection import Collection
-
-
-class BaseItem(BaseObject):
-
- @api_call
- def copy(self, *, parent_folder: 'Folder', name: str = None, **_kwargs) -> 'BaseItem':
- """Copy the item to the given folder.
-
- :param parent_folder:
- The folder to which the item should be copied.
- :param name:
- A new name for the item, in case there is already another item in the new parent folder with the same name.
- """
- self.validate_item_id(self._object_id)
- url = self.get_url('copy')
- data = {
- 'parent': {'id': parent_folder.object_id}
- }
- if name is not None:
- data['name'] = name
- box_response = self._session.post(url, data=json.dumps(data))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def move(self, parent_folder: 'Folder', name: str = None) -> 'BaseItem':
- """
- Move the item to the given folder.
-
- :param parent_folder:
- The parent `Folder` object, where the item will be moved to.
- :param name:
- A new name for the item, in case there is already another item in the new parent folder with the same name.
- """
- data = {
- 'parent': {'id': parent_folder.object_id}
- }
- if name is not None:
- data['name'] = name
- return self.update_info(data=data)
-
- @api_call
- def rename(self, name: str) -> 'BaseItem':
- """
- Rename the item to a new name.
-
- :param name:
- The new name, you want the item to be renamed to.
- """
- data = {
- 'name': name,
- }
- return self.update_info(data=data)
-
- @api_call
- def create_shared_link(self, **kwargs: Any) -> Any:
- """
- Create a shared link for the item with the given access permissions.
-
- :param kwargs:
- Keyword arguments passed from overriding method used to build request properties.
- :return:
- The updated object with shared link.
- Returns a new object of the same type, without modifying the original object passed as self.
- """
- shared_link = {}
-
- if kwargs.get('access') is not None:
- shared_link['access'] = kwargs.get('access')
-
- if kwargs.get('unshared_at') is not SDK_VALUE_NOT_SET:
- shared_link['unshared_at'] = normalize_date_to_rfc3339_format(kwargs.get('unshared_at'))
-
- permissions = {}
- if kwargs.get('allow_download') is not None:
- permissions['can_download'] = kwargs.get('allow_download')
- if kwargs.get('allow_preview') is not None:
- permissions['can_preview'] = kwargs.get('allow_preview')
- if kwargs.get('allow_edit') is not None:
- permissions['can_edit'] = kwargs.get('allow_edit')
- if permissions:
- shared_link['permissions'] = permissions
-
- if kwargs.get('password') is not None:
- shared_link['password'] = kwargs.get('password')
-
- if kwargs.get('vanity_name') is not None:
- shared_link['vanity_name'] = kwargs.get('vanity_name')
-
- data = {'shared_link': shared_link}
- update_info_kwargs = {'etag': kwargs.get('etag')} if kwargs.get('etag') is not None else {}
-
- return self.update_info(data=data, **update_info_kwargs)
-
- @api_call
- def get_shared_link(self, **kwargs: Any) -> str:
- """
- Get a shared link for the item with the given access permissions.
- This url leads to a Box.com shared link page, where the item can be previewed, downloaded, etc.
-
- :param kwargs:
- Keyword arguments passed from overriding method used to create a new shared link.
- :returns:
- The URL of the shared link.
- """
- item = self.create_shared_link(**kwargs)
- return item.shared_link['url'] # pylint:disable=no-member
-
- @api_call
- def remove_shared_link(self, **kwargs: Any) -> bool:
- """
- Delete the shared link for the item.
-
- :param kwargs:
- Keyword arguments passed from overriding method used to build request properties.
- :returns:
- Whether or not the update was successful.
- """
- data = {'shared_link': None}
- update_info_kwargs = {'etag': kwargs.get('etag')} if kwargs.get('etag') is not None else {}
-
- item = self.update_info(data=data, **update_info_kwargs)
- return item.shared_link is None # pylint:disable=no-member
-
- @api_call
- def add_to_collection(self, collection: 'Collection') -> 'BaseItem':
- """
- Add the item to a collection. This method is not currently safe from race conditions.
-
- :param collection:
- The collection to add the item to.
- :return:
- This item.
- """
- collections = self.get(fields=['collections']).collections # pylint:disable=no-member
- collections.append({'id': collection.object_id})
- data = {
- 'collections': collections
- }
- return self.update_info(data=data)
-
- @api_call
- def remove_from_collection(self, collection: 'Collection') -> 'BaseItem':
- """
- Remove the item from a collection. This method is not currently safe from race conditions.
-
- :param collection:
- The collection to remove the item from.
- :return:
- This item.
- """
- collections = self.get(fields=['collections']).collections # pylint:disable=no-member
- updated_collections = [c for c in collections if c['id'] != collection.object_id]
- data = {
- 'collections': updated_collections
- }
- return self.update_info(data=data)
-
- @staticmethod
- def validate_item_id(item_id: Union[str, int]) -> None:
- """
- Validates an item ID is numeric
-
- :param item_id
- :raises:
- BoxException: if item_id is not numeric
- :returns:
- """
- if not isinstance(item_id, int) and not item_id.isdigit():
- raise BoxValueError("Invalid item ID")
diff --git a/boxsdk/object/base_object.py b/boxsdk/object/base_object.py
deleted file mode 100644
index 6cd51bb49..000000000
--- a/boxsdk/object/base_object.py
+++ /dev/null
@@ -1,159 +0,0 @@
-import json
-from typing import TYPE_CHECKING, Any, Iterable, Optional, Union, List
-
-from .base_endpoint import BaseEndpoint
-from .base_api_json_object import BaseAPIJSONObject
-from ..util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.session.session import Session
-
-
-class BaseObject(BaseEndpoint, BaseAPIJSONObject):
- """A Box API endpoint for interacting with a Box object."""
-
- def __init__(self, session: 'Session', object_id: str, response_object: dict = None):
- """
- :param session:
- The Box session used to make requests.
- :param object_id:
- The Box ID for the object.
- :param response_object:
- A JSON object representing the object returned from a Box API request.
- """
- super().__init__(session=session, response_object=response_object)
- self._object_id = object_id
-
- @property
- def _description(self) -> str:
- """
- Base class override. Return a description for the object.
- """
- if 'name' in self._response_object:
- return f'{self._object_id} ({self.name})' # pylint:disable=no-member
- return self._object_id
-
- def get_url(self, *args: Any) -> str:
- """
- Base class override.
- Return the given object's URL, appending any optional parts as specified by args.
- """
- return super().get_url(f'{self._item_type}s', self._object_id, *args)
-
- def get_type_url(self) -> str:
- """
- Return the URL for type of the given resource.
- """
- return super().get_url(f'{self._item_type}s')
-
- @property
- def object_id(self) -> str:
- """
- Return the Box ID for the object.
- """
- return self._object_id
-
- @api_call
- def get(self, *, fields: Iterable[str] = None, headers: dict = None, **_kwargs) -> Any:
- """
- Get information about the object, specified by fields. If fields is None, return the default fields.
-
- :param fields:
- List of fields to request.
- :param headers:
- Additional headers to send with the request.
- :return:
- An object of the same type that has the requested information.
- """
- url = self.get_url()
- params = {'fields': ','.join(fields)} if fields else None
- box_response = self._session.get(url, params=params, headers=headers)
- return self.translator.translate(
- session=self._session,
- response_object=box_response.json(),
- )
-
- @api_call
- def update_info(
- self,
- *,
- data: Union[dict, List[dict]],
- params: Optional[dict] = None,
- headers: Optional[dict] = None,
- **kwargs: Any
- ) -> Any:
- """Update information about this object.
-
- Send a PUT to the object's base endpoint to modify the provided
- attributes.
-
- :param data:
- The updated information about this object.
- Must be JSON serializable.
- Update the object attributes in data.keys(). The semantics of the
- values depends on the type and attributes of the object being
- updated. For details on particular semantics, refer to the Box
- developer API documentation .
- :param params:
- (optional) Query string parameters for the request.
- :param headers:
- (optional) Extra HTTP headers for the request.
- :param kwargs:
- Optional arguments that ``put`` takes.
- :return:
- The updated object.
- Return a new object of the same type, without modifying the
- original object passed as self.
- Construct the new object with all the default attributes that are
- returned from the endpoint.
- """
- url = self.get_url()
- box_response = self._session.put(url, data=json.dumps(data), params=params, headers=headers, **kwargs)
- if 'expect_json_response' in kwargs and not kwargs['expect_json_response']:
- return box_response.ok
-
- return self.translator.translate(
- session=self._session,
- response_object=box_response.json(),
- )
-
- @api_call
- def delete(self, *, params: Optional[dict] = None, headers: Optional[dict] = None, **_kwargs) -> bool:
- """ Delete the object.
-
- :param params:
- Additional parameters to send with the request. Can be None
- :param headers:
- Any customer headers to send with the request. Can be None
- :returns:
- Whether or not the delete was successful.
- :raises:
- :class:`BoxAPIException` in case of unexpected errors.
- """
- url = self.get_url()
-
- box_response = self._session.delete(url, expect_json_response=False, params=params or {}, headers=headers)
- return box_response.ok
-
- def __eq__(self, other: Any) -> bool:
- """Equality as determined by object id and type"""
- if isinstance(other, BaseObject):
- # Two objects are considered the same if they have the same address in the API
- return self.get_url() == other.get_url()
-
- return NotImplemented
-
- def __ne__(self, other: Any) -> bool:
- """Equality as determined by object id and type"""
- return not self == other
-
- def __hash__(self) -> int:
- return hash((self._object_id, self._item_type))
-
- def clone(self, session: 'Session' = None) -> 'BaseObject':
- """Base class override."""
- return self.__class__(
- session or self._session,
- self._object_id,
- self._response_object,
- )
diff --git a/boxsdk/object/cloneable.py b/boxsdk/object/cloneable.py
deleted file mode 100644
index 29711e903..000000000
--- a/boxsdk/object/cloneable.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from typing import TYPE_CHECKING, NoReturn
-
-if TYPE_CHECKING:
- from boxsdk.object.user import User
- from boxsdk.session.session import Session
-
-
-class Cloneable:
- """
- Cloneable interface to be implemented by endpoint objects that should have ability to be cloned, but with a
- different session member if desired.
- """
-
- def as_user(self, user: 'User') -> 'Cloneable':
- """
- Returns a new endpoint object with default headers set up to make requests as the specified user.
-
- :param user:
- The user to impersonate when making API requests.
- """
- return self.clone(self.session.as_user(user))
-
- def with_shared_link(self, shared_link: str, shared_link_password: str) -> 'Cloneable':
- """
- Returns a new endpoint object with default headers set up to make requests using the shared link for auth.
-
- :param shared_link:
- The shared link.
- :param shared_link_password:
- The password for the shared link.
- """
- return self.clone(self.session.with_shared_link(shared_link, shared_link_password))
-
- def clone(self, session: 'Session' = None) -> NoReturn:
- """
- Returns a copy of this cloneable object using the specified session.
-
- :param session:
- The Box session used to make requests.
- """
- raise NotImplementedError
-
- @property
- def session(self) -> NoReturn:
- """
- Return the Box session being used to make requests.
- """
- raise NotImplementedError
diff --git a/boxsdk/object/collaboration.py b/boxsdk/object/collaboration.py
deleted file mode 100644
index 6588e666d..000000000
--- a/boxsdk/object/collaboration.py
+++ /dev/null
@@ -1,75 +0,0 @@
-from typing import Optional, Any
-
-from boxsdk.object.base_object import BaseObject
-from boxsdk.util.text_enum import TextEnum
-from ..util.api_call_decorator import api_call
-
-
-class CollaborationRole(TextEnum):
- """An enum of possible collaboration roles"""
- EDITOR = 'editor'
- VIEWER = 'viewer'
-
- # Available to enterprise accounts:
- PREVIEWER = 'previewer'
- UPLOADER = 'uploader'
- PREVIEWER_UPLOADER = 'previewer uploader'
- VIEWER_UPLOADER = 'viewer uploader'
- CO_OWNER = 'co-owner'
- OWNER = 'owner'
-
-
-class CollaborationStatus(TextEnum):
- """An enum of possible statuses of a collaboration"""
- PENDING = 'pending'
- ACCEPTED = 'accepted'
- REJECTED = 'rejected'
-
-
-class Collaboration(BaseObject):
- """An object that represents a collaboration between a folder and an individual or group"""
- _item_type = 'collaboration'
-
- @api_call
- def update_info(
- self,
- *,
- data: dict = None,
- role: Optional[CollaborationRole] = None,
- status: Optional[CollaborationStatus] = None,
- **kwargs: Any
- ) -> 'BaseObject':
- """Edit an existing collaboration on Box
- :param data:
- The updated information about this object.
- :param role:
- The new role for this collaboration or None to leave unchanged
- :param status:
- The new status for this collaboration or None to leave unchanged. A pending collaboration can be set to
- accepted or rejected if permissions allow it.
- :returns:
- Whether or not the edit was successful.
- :raises:
- :class:`BoxAPIException` if current user doesn't have permissions to edit the collaboration.
- """
- # pylint:disable=arguments-differ
- if data is None:
- data = {}
- if role:
- data['role'] = role
- if status:
- data['status'] = status
- if data.get('role', None) == CollaborationRole.OWNER:
- return super().update_info(data=data, expect_json_response=False, **kwargs)
-
- return super().update_info(data=data, **kwargs)
-
- @api_call
- def accept(self) -> 'BaseObject':
- """Accepts a pending collaboration"""
- return self.update_info(status=CollaborationStatus.ACCEPTED)
-
- @api_call
- def reject(self) -> 'BaseObject':
- """Rejects a pending collaboration"""
- return self.update_info(status=CollaborationStatus.REJECTED)
diff --git a/boxsdk/object/collaboration_allowlist.py b/boxsdk/object/collaboration_allowlist.py
deleted file mode 100644
index a5cf31c04..000000000
--- a/boxsdk/object/collaboration_allowlist.py
+++ /dev/null
@@ -1,127 +0,0 @@
-import json
-from typing import Optional, Iterable, TYPE_CHECKING
-
-from .base_endpoint import BaseEndpoint
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..util.api_call_decorator import api_call
-from ..util.text_enum import TextEnum
-
-if TYPE_CHECKING:
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
- from boxsdk.object.collaboration_allowlist_entry import CollaborationAllowlistEntry
- from boxsdk.object.user import User
- from boxsdk.object.collaboration_allowlist_exempt_target import CollaborationAllowlistExemptTarget
-
-
-class AllowlistDirection(TextEnum):
- """
- Used to determine the direction of the allowlist.
- """
- INBOUND = 'inbound'
- OUTBOUNT = 'outbound'
- BOTH = 'both'
-
-
-class CollaborationAllowlist(BaseEndpoint):
- """Represents the allowlist of email domains that users in an enterprise may collaborate with."""
-
- @api_call
- def get_entries(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the collaboration allowlist using limit-offset paging.
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the allowlist.
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('collaboration_whitelist_entries'),
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def add_domain(self, domain: str, direction: str) -> 'CollaborationAllowlistEntry':
- """
- Add a new domain to the collaboration allowlist.
-
- :param domain:
- The email domain to add to the allowlist.
- :param direction:
- The direction in which collaboration should be allowed: 'inbound', 'outbound', or 'both'.
- :returns:
- The created allowlist entry for the domain.
- """
- url = self.get_url('collaboration_whitelist_entries')
- data = {
- 'domain': domain,
- 'direction': direction
- }
- response = self._session.post(url, data=json.dumps(data)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_exemptions(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the list of exempted users who are not subject to the collaboration allowlist rules.
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the exemptions to the allowlist.
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('collaboration_whitelist_exempt_targets'),
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def add_exemption(self, user: 'User') -> 'CollaborationAllowlistExemptTarget':
- """
- Exempt a user from the collaboration allowlist.
-
- :param user:
- The user to exempt from the allowlist.
- :returns:
- The created allowlist exemption.
- """
- url = self.get_url('collaboration_whitelist_exempt_targets')
- data = {
- 'user': {
- 'id': user.object_id # pylint:disable=protected-access
- }
- }
- response = self._session.post(url, data=json.dumps(data)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
diff --git a/boxsdk/object/collaboration_allowlist_entry.py b/boxsdk/object/collaboration_allowlist_entry.py
deleted file mode 100644
index 71eb45909..000000000
--- a/boxsdk/object/collaboration_allowlist_entry.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from typing import Any
-
-from .base_object import BaseObject
-
-
-class CollaborationAllowlistEntry(BaseObject):
- """Represents a allowlisted email domain for enterprise collaboration."""
-
- _item_type = 'collaboration_whitelist_entry'
-
- def get_url(self, *args: Any) -> str:
- """
- Gets the collaboration allowlist entries endpoint URL.
-
- :return:
- The collaboration allowlist entries endpoint URL.
- """
- return self._session.get_url('collaboration_whitelist_entries', self._object_id, *args)
diff --git a/boxsdk/object/collaboration_allowlist_exempt_target.py b/boxsdk/object/collaboration_allowlist_exempt_target.py
deleted file mode 100644
index 58c96ee64..000000000
--- a/boxsdk/object/collaboration_allowlist_exempt_target.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_object import BaseObject
-
-
-class CollaborationAllowlistExemptTarget(BaseObject):
- """Represents a user who is exempted from the collaboration allowlist."""
-
- _item_type = 'collaboration_whitelist_exempt_target'
diff --git a/boxsdk/object/collection.py b/boxsdk/object/collection.py
deleted file mode 100644
index 7146f14a3..000000000
--- a/boxsdk/object/collection.py
+++ /dev/null
@@ -1,42 +0,0 @@
-from typing import Optional, Iterable, TYPE_CHECKING
-
-from boxsdk.object.base_object import BaseObject
-from boxsdk.pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-from boxsdk.util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class Collection(BaseObject):
- """Box API endpoint for interacting with collections."""
-
- _item_type = 'collection'
-
- @api_call
- def get_items(
- self,
- limit: Optional[int] = None,
- offset: int = 0,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the items in a collection using limit-offset paging.
-
- :param limit:
- The maximum number of items to return per page. If not specified, then will use the server-side default.
- :param offset:
- The index at which to start returning items.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the items in the folder.
- """
- return LimitOffsetBasedObjectCollection(
- self.session,
- self.get_url('items'),
- limit=limit,
- fields=fields,
- offset=offset,
- return_full_pages=False,
- )
diff --git a/boxsdk/object/comment.py b/boxsdk/object/comment.py
deleted file mode 100644
index 53102f4c3..000000000
--- a/boxsdk/object/comment.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import json
-
-from boxsdk.object.base_object import BaseObject
-from ..util.api_call_decorator import api_call
-
-
-class Comment(BaseObject):
- """An object that represents a comment on an item"""
- _item_type = 'comment'
-
- @staticmethod
- def construct_params_from_message(message: str) -> dict:
- message_type = 'tagged_message' if '@[' in message else 'message'
- return {
- message_type: message
- }
-
- @api_call
- def reply(self, message: str) -> 'Comment':
- """
- Add a reply to the comment.
-
- :param message:
- The content of the reply comment.
- """
- url = self.get_type_url()
- data = self.construct_params_from_message(message)
- data['item'] = {
- 'type': 'comment',
- 'id': self.object_id
- }
- box_response = self._session.post(url, data=json.dumps(data))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def edit(self, message: str) -> 'Comment':
- """
- Edit the message of the comment.
-
- :param message:
- The content of the reply comment.
- """
- data = self.construct_params_from_message(message)
- return self.update_info(data=data)
diff --git a/boxsdk/object/device_pinner.py b/boxsdk/object/device_pinner.py
deleted file mode 100644
index 43b59547f..000000000
--- a/boxsdk/object/device_pinner.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_object import BaseObject
-
-
-class DevicePinner(BaseObject):
- """Represents the device pinner"""
-
- _item_type = 'device_pinner'
diff --git a/boxsdk/object/email_alias.py b/boxsdk/object/email_alias.py
deleted file mode 100644
index 5585edf9c..000000000
--- a/boxsdk/object/email_alias.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_object import BaseObject
-
-
-class EmailAlias(BaseObject):
- """Represents a Box email alias."""
-
- _item_type = 'email_alias'
diff --git a/boxsdk/object/enterprise.py b/boxsdk/object/enterprise.py
deleted file mode 100644
index f0717a509..000000000
--- a/boxsdk/object/enterprise.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import json
-from typing import TYPE_CHECKING
-
-from .base_object import BaseObject
-from ..util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.object.invite import Invite
-
-
-class Enterprise(BaseObject):
-
- """Represents a single enterprise."""
- _item_type = 'enterprise'
-
- @api_call
- def invite_user(self, user_email: str) -> 'Invite':
- """
- Invites an existing user to an Enterprise. The user must already have a Box account.
-
- :param user_email:
- The login email address of the user that will receive the invitation.
- :returns:
- The invitation record for the user
- """
- url = self._session.get_url('invites')
- body = {
- 'enterprise': {
- 'id': self.object_id,
- },
- 'actionable_by': {
- 'login': user_email,
- },
- }
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
diff --git a/boxsdk/object/event.py b/boxsdk/object/event.py
deleted file mode 100644
index c18424c2a..000000000
--- a/boxsdk/object/event.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .api_json_object import APIJSONObject
-
-
-class Event(APIJSONObject):
- """Represents a single Box event."""
-
- _item_type = 'event'
diff --git a/boxsdk/object/events.py b/boxsdk/object/events.py
deleted file mode 100644
index 302097703..000000000
--- a/boxsdk/object/events.py
+++ /dev/null
@@ -1,304 +0,0 @@
-from datetime import datetime
-from typing import Any, Optional, Iterable, Generator, Union, TYPE_CHECKING
-
-from requests.exceptions import Timeout
-
-from .base_endpoint import BaseEndpoint
-from ..util.api_call_decorator import api_call
-from ..util.datetime_formatter import normalize_date_to_rfc3339_format
-from ..util.enum import ExtendableEnumMeta
-from ..util.lru_cache import LRUCache
-from ..util.text_enum import TextEnum
-
-if TYPE_CHECKING:
- from boxsdk.object.event import Event
- from boxsdk.session.box_response import BoxResponse
-
-
-# pylint:disable=too-many-ancestors
-class EventsStreamType(TextEnum, metaclass=ExtendableEnumMeta):
- """An enum of all possible values of the `stream_type` parameter for user events.
-
- The value of the `stream_type` parameter determines the type of events
- returned by the endpoint.
-
-
- """
-
-
-class UserEventsStreamType(EventsStreamType):
- """An enum of all possible values of the `stream_type` parameter for user events.
-
- - ALL: Returns all user events.
- - CHANGES: Returns tree changes.
- - SYNC: Returns tree changes only for sync folders.
-
-
- """
- ALL = 'all'
- CHANGES = 'changes'
- SYNC = 'sync'
-
-
-class EnterpriseEventsStreamType(EventsStreamType):
- """An enum of all possible values of the `stream_type` parameter for enterprise events.
-
- - ADMIN_LOGS: Retrieves up to a year's events for all users in the enterprise. High latency.
- - ADMIN_LOGS_STREAMING: Retrieves up to a two weeks's events for all users in the enterprise. Low latency.
-
- NOTE: Requires Admin: These stream types will only work with an auth token
- from an enterprise admin account.
-
-
- """
- ADMIN_LOGS = 'admin_logs'
- ADMIN_LOGS_STREAMING = 'admin_logs_streaming'
-# pylint:enable=too-many-ancestors
-
-
-class Events(BaseEndpoint):
- """Box API endpoint for subscribing to changes in a Box account."""
-
- def get_url(self, *args: Any) -> str:
- """Base class override."""
- return super().get_url('events', *args)
-
- @api_call
- def get_events(
- self,
- limit: int = 100,
- stream_position: Union[str, int] = 0,
- stream_type: EventsStreamType = UserEventsStreamType.ALL
- ) -> dict:
- """
- Get Box events from a given stream position for a given stream type.
-
- :param limit:
- Maximum number of events to return.
- :param stream_position:
- The location in the stream from which to start getting events. 0 is the beginning of time. 'now' will
- return no events and just current stream position.
- :param stream_type:
- (optional) Which type of events to return.
- Defaults to `UserEventsStreamType.ALL`.
- :returns:
- Dictionary containing the next stream position along with a list of some number of events.
- """
- url = self.get_url()
- params = {
- 'limit': limit,
- 'stream_position': stream_position,
- 'stream_type': stream_type,
- }
- box_response = self._session.get(url, params=params)
- response = box_response.json().copy()
- return self.translator.translate(self._session, response_object=response)
-
- @api_call
- def get_admin_events(
- self,
- limit: Optional[int] = None,
- stream_position: Union[str, int] = 0,
- created_after: Union[datetime, str] = None,
- created_before: Union[datetime, str] = None,
- event_types: Iterable[str] = None
- ) -> dict:
- """
- Get Box Admin events from a datetime, to a datetime, or between datetimes with a given event type for a enterprise
- stream type. Used for historical querying (up to one year). Works for Enterprise admin_logs type.
-
- :param limit:
- (optional) Maximum number of events to return. If None, default API value limit=100 will be used.
- :param stream_position:
- The location in the stream from which to start getting events. 0 is the beginning of time.
- :param created_after:
- (optional) Start date in datetime format to pull events from
- :param created_before:
- (optional) End date in datetime format to pull events to
- :param event_types:
- (optional) Which events to return (ie. LOGIN)
- :returns:
- Dictionary containing the next stream position along with a list of some number of events.
- """
- url = self.get_url()
- params = {
- 'created_after': normalize_date_to_rfc3339_format(created_after),
- 'created_before': normalize_date_to_rfc3339_format(created_before),
- 'stream_type': 'admin_logs',
- }
- if limit is not None:
- params['limit'] = limit
- if event_types is not None:
- params['event_type'] = ','.join(event_types)
- if stream_position is not None:
- params['stream_position'] = stream_position
- box_response = self._session.get(url, params=params)
- response = box_response.json()
- return self.translator.translate(self._session, response_object=response)
-
- @api_call
- def get_admin_events_streaming(
- self,
- limit: Optional[int] = None,
- stream_position: Union[str, int] = 0,
- event_types: Iterable[str] = None
- ) -> dict:
- """
- Get Box Admin events with a given event type for a enterprise stream type. Used for live monitoring (up to two weeks).
- Works for Enterprise admin_logs_streaming type.
-
- :param limit:
- (optional) Maximum number of events to return.
- :param stream_position:
- The location in the stream from which to start getting events. 0 is the beginning of time. 'now' will
- return no events and just current stream position.
- :param event_types:
- (optional) Which events to return (ie. LOGIN)
- :returns:
- Dictionary containing the next stream position along with a list of some number of events.
- """
- url = self.get_url()
- params = {
- 'stream_type': 'admin_logs_streaming',
- }
- if limit is not None:
- params['limit'] = limit
- if stream_position is not None:
- params['stream_position'] = stream_position
- if event_types is not None:
- params['event_type'] = ','.join(event_types)
- box_response = self._session.get(url, params=params)
- response = box_response.json()
- return self.translator.translate(self._session, response_object=response)
-
- @api_call
- def get_latest_stream_position(self, stream_type: UserEventsStreamType = UserEventsStreamType.ALL) -> int:
- """
- Get the latest stream position. The return value can be used with :meth:`get_events` or
- :meth:`generate_events_with_long_polling`.
-
- :param stream_type:
- (optional) Which events stream to query.
-
- NOTE: Currently, the Box API requires this to be one of the user
- events stream types. The request will fail if an enterprise events
- stream type is passed.
- :returns:
- The latest stream position.
- """
- return self.get_events(limit=0, stream_position='now', stream_type=stream_type)['next_stream_position']
-
- def _get_all_events_since(
- self,
- stream_position: Union[str, int],
- stream_type: EventsStreamType = UserEventsStreamType.ALL
- ) -> Generator[tuple, None, None]:
- """
- :param stream_position:
- The location in the stream from which to start getting events. 0 is the beginning of time. 'now' will
- return no events and just current stream position.
- :param stream_type:
- (optional) Which type of events to return.
- """
- next_stream_position = stream_position
- while True:
- events = self.get_events(stream_position=next_stream_position, limit=100, stream_type=stream_type)
- next_stream_position = events['next_stream_position']
- events = events['entries']
- if not events:
- return
- for event in events:
- yield event, next_stream_position
- if len(events) < 100:
- return
-
- @api_call
- def long_poll(self, options: dict, stream_position: Union[str, int]) -> 'BoxResponse':
- """
- Set up a long poll connection at the specified url.
-
- :param options:
- The long poll options which include a long pull url, retry timeout, etc.
- :param stream_position:
- The location in the stream from which to start getting events. 0 is the beginning of time.
- 'now' will return no events and just current stream position.
- :returns:
- {"message": "new_change"}, which means there're new changes on Box or {"version": 1, "message": "reconnect"}
- if nothing happens on Box during the long poll.
- """
- url = options['url']
- long_poll_response = self._session.get(
- url,
- timeout=options['retry_timeout'],
- params={'stream_position': stream_position}
- )
- return long_poll_response
-
- @api_call
- def generate_events_with_long_polling(
- self,
- stream_position: Union[str, int] = None,
- stream_type: UserEventsStreamType = UserEventsStreamType.ALL
- ) -> Generator['Event', None, None]:
- """
- Subscribe to events from the given stream position.
-
- :param stream_position:
- The location in the stream from which to start getting events. 0 is the beginning of time. 'now' will
- return no events and just current stream position.
- :param stream_type:
- (optional) Which type of events to return.
-
- NOTE: Currently, the Box API requires this to be one of the user
- events stream types. The request will fail if an enterprise events
- stream type is passed.
- :returns:
- Events corresponding to changes on Box in realtime, as they come in.
- """
- event_ids = LRUCache()
- stream_position = stream_position if stream_position is not None else self.get_latest_stream_position(stream_type=stream_type)
- while True:
- options = self.get_long_poll_options(stream_type=stream_type)
- while True:
- try:
- long_poll_response = self.long_poll(options, stream_position)
- except Timeout:
- break
-
- message = long_poll_response.json()['message']
- if message == 'new_change':
- next_stream_position = stream_position
- for event, next_stream_position in self._get_all_events_since(stream_position, stream_type=stream_type):
- try:
- event_ids.get(event['event_id'])
- except KeyError:
- yield event
- event_ids.set(event['event_id'])
- stream_position = next_stream_position
- break
- if message == 'reconnect':
- continue
- break
-
- @api_call
- def get_long_poll_options(self, stream_type: EventsStreamType = UserEventsStreamType.ALL) -> dict:
- """
- Get the url and retry timeout for setting up a long polling connection.
-
- :param stream_type:
- (optional) Which type of events to return.
- :returns:
- A `dict` including a long poll url, retry timeout, etc.
- E.g.
- {
- "type": "realtime_server",
- "url": "http://2.realtime.services.box.net/subscribe?channel=cc807c9c4869ffb1c81a&stream_type=all",
- "ttl": "10",
- "max_retries": "10",
- "retry_timeout": 610,
- }
- """
- url = self.get_url()
- params = {'stream_type': stream_type}
- box_response = self._session.options(url, params=params)
- return box_response.json()['entries'][0]
diff --git a/boxsdk/object/file.py b/boxsdk/object/file.py
deleted file mode 100644
index c9128a056..000000000
--- a/boxsdk/object/file.py
+++ /dev/null
@@ -1,893 +0,0 @@
-import json
-import os
-from datetime import datetime
-from typing import TYPE_CHECKING, Optional, Tuple, Union, IO, Iterable, List, Any
-from boxsdk.exception import BoxAPIException
-
-from boxsdk.util.datetime_formatter import normalize_date_to_rfc3339_format
-from .item import Item
-from ..util.api_call_decorator import api_call
-from ..util.default_arg_value import SDK_VALUE_NOT_SET
-from ..util.deprecation_decorator import deprecated
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-
-if TYPE_CHECKING:
- from boxsdk.object.upload_session import UploadSession
- from boxsdk.util.chunked_uploader import ChunkedUploader
- from boxsdk.object.file_version import FileVersion
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
- from boxsdk.object.comment import Comment
- from boxsdk.object.task import Task
- from boxsdk.object.folder import Folder
-
-
-class File(Item):
- """Box API endpoint for interacting with files."""
-
- _item_type = 'file'
-
- @api_call
- def preflight_check(self, size: int, name: Optional[str] = None) -> Optional[str]:
- """
- Make an API call to check if the file can be updated with the new name and size of the file.
- Returns an accelerator URL if one is available.
-
- :param size:
- The size of the file in bytes. Specify 0 for unknown file-sizes.
- :param name:
- The name of the file to be updated. It's optional, if the name is not being changed.
- :return:
- The Accelerator upload url or None if cannot get the Accelerator upload url.
- :raises:
- :class:`BoxAPIException` when preflight check fails.
- """
- return self._preflight_check(
- size=size,
- name=name,
- file_id=self._object_id,
- )
-
- @api_call
- def create_upload_session(
- self, file_size: int, file_name: Optional[str] = None, use_upload_session_urls: bool = True
- ) -> 'UploadSession':
- """
- Create a new chunked upload session for uploading a new version of the file.
-
- :param file_size:
- The size of the file in bytes that will be uploaded.
- :param file_name:
- The new name of the file version that will be uploaded.
- :param use_upload_session_urls:
- The parameter detrermining what urls to use to perform chunked upload.
- If True, the urls returned by create_upload_session() endpoint response will be used,
- unless a custom API.UPLOAD_URL was set in the config.
- If False, the base upload url will be used.
- :returns:
- A :class:`UploadSession` object.
- """
- body_params = {
- 'file_id': self.object_id,
- 'file_size': file_size,
- }
- if file_name is not None:
- body_params['file_name'] = file_name
- url = self.get_url('upload_sessions').replace(self.session.api_config.BASE_API_URL, self.session.api_config.UPLOAD_URL)
- response = self._session.post(url, data=json.dumps(body_params)).json()
- upload_session = self.translator.translate(
- session=self._session,
- response_object=response,
- )
- # pylint:disable=protected-access
- upload_session._use_upload_session_urls = use_upload_session_urls
- return upload_session
-
- @api_call
- def get_chunked_uploader(
- self, file_path: str, rename_file: bool = False, use_upload_session_urls: bool = True
- ) -> 'ChunkedUploader':
- # pylint: disable=consider-using-with
- """
- Instantiate the chunked upload instance and create upload session with path to file.
-
- :param file_path:
- The local path to the file you wish to upload.
- :param rename_file:
- Indicates whether the file should be renamed or not.
- :param use_upload_session_urls:
- The parameter detrermining what urls to use to perform chunked upload.
- If True, the urls returned by create_upload_session() endpoint response will be used,
- unless a custom API.UPLOAD_URL was set in the config.
- If False, the base upload url will be used.
- :returns:
- A :class:`ChunkedUploader` object.
- """
- total_size = os.stat(file_path).st_size
- content_stream = open(file_path, 'rb')
- file_name = os.path.basename(file_path) if rename_file else None
- upload_session = self.create_upload_session(total_size, file_name, use_upload_session_urls)
- return upload_session.get_chunked_uploader_for_stream(content_stream, total_size)
-
- def _get_accelerator_upload_url_for_update(self) -> Optional[str]:
- """
- Get Accelerator upload url for updating the file.
-
- :return:
- The Accelerator upload url for updating the file or None if cannot get one
- """
- return self._get_accelerator_upload_url(file_id=self._object_id)
-
- @staticmethod
- def _construct_range_header(boundaries: Union[Tuple[int], Tuple[int, int]]) -> str:
- """
- Construct the correct value for the Range header, given a closed or open-ended range.
-
- :param boundaries:
- The range of bytes (inclusive)
- :returns:
- The value for the Range header
- :raises ValueError:
- """
- if len(boundaries) == 1:
- return f'bytes={boundaries[0]}-'
- if len(boundaries) == 2:
- return f'bytes={boundaries[0]}-{boundaries[1]}'
-
- raise ValueError('Expected a 1-tuple or 2-tuple for byte range')
-
- @api_call
- def content(self, file_version: Optional['FileVersion'] = None, byte_range: Tuple[int, int] = None) -> bytes:
- """
- Get the content of a file on Box.
-
- :param file_version:
- The specific version of the file to retrieve the contents of.
- :param byte_range:
- A tuple of inclusive byte offsets to download, e.g. (100, 199) to download the second 100 bytes of a file
- :returns:
- File content as bytes.
- """
- url = self.get_url('content')
- params = {'version': file_version.object_id} if file_version is not None else None
- headers = {'Range': self._construct_range_header(byte_range)} if byte_range is not None else None
- box_response = self._session.get(url, expect_json_response=False, params=params, headers=headers)
- return box_response.content
-
- @api_call
- def download_to(
- self,
- writeable_stream: IO[bytes],
- file_version: Optional['FileVersion'] = None,
- byte_range: Tuple[int, int] = None
- ) -> None:
- """
- Download the file; write it to the given stream.
-
- :param writeable_stream:
- A file-like object where bytes can be written into.
- :param file_version:
- The specific version of the file to retrieve the contents of.
- :param byte_range:
- A tuple of inclusive byte offsets to download, e.g. (100, 199) to download the second 100 bytes of a file
- """
- url = self.get_url('content')
- params = {'version': file_version.object_id} if file_version is not None else None
- headers = {'Range': self._construct_range_header(byte_range)} if byte_range is not None else None
- box_response = self._session.get(url, expect_json_response=False, stream=True, params=params, headers=headers)
- for chunk in box_response.network_response.response_as_stream.stream(decode_content=True):
- writeable_stream.write(chunk)
-
- @api_call
- def get_download_url(self, file_version: Optional['FileVersion'] = None) -> str:
- """
- Get the url to download the file.
-
- :param file_version:
- The specific version of the file to retrieve the contents of.
- :return: Url to download the file
- """
- url = self.get_url('content')
- params = {'version': file_version.object_id} if file_version is not None else None
- box_response = self._session.get(
- url,
- params=params,
- expect_json_response=False,
- allow_redirects=False,
- )
- network_response = box_response.network_response
- if 'location' not in box_response.headers:
- raise BoxAPIException(
- status=network_response.status_code,
- headers=network_response.headers,
- message='Download URL is not present in the response.',
- url=url,
- method='GET',
- network_response=network_response,
- )
-
- return box_response.headers['location']
-
- @api_call
- def update_contents_with_stream(
- self,
- file_stream: IO[bytes],
- etag: Optional[str] = None,
- preflight_check: bool = False,
- preflight_expected_size: int = 0,
- upload_using_accelerator: bool = False,
- file_name: Optional[str] = None,
- content_modified_at: Union[datetime, str] = None,
- additional_attributes: Optional[dict] = None,
- sha1: Optional[str] = None,
- ) -> 'File':
- """
- Upload a new version of a file, taking the contents from the given file stream.
-
- :param file_stream:
- The file-like object containing the bytes
- :param etag:
- If specified, instruct the Box API to update the item only if the current version's etag matches.
- :param preflight_check:
- If specified, preflight check will be performed before actually uploading the file.
- :param preflight_expected_size:
- The size of the file to be uploaded in bytes, which is used for preflight check. The default value is '0',
- which means the file size is unknown.
- :param upload_using_accelerator:
- If specified, the upload will try to use Box Accelerator to speed up the uploads for big files.
- It will make an extra API call before the actual upload to get the Accelerator upload url, and then make
- a POST request to that url instead of the default Box upload url. It falls back to normal upload endpoint,
- if cannot get the Accelerator upload url.
-
- Please notice that this is a premium feature, which might not be available to your app.
- :param file_name:
- The new name to give the file on Box.
- :param content_modified_at:
- The A datetime string in a format supported by the dateutil library or datetime object,
- which specifies when the file content was last modified.
- If no timezone info provided, local timezone will be applied.
- :param additional_attributes:
- A dictionary containing attributes to add to the file that are not covered by other parameters.
- :param sha1:
- A sha1 checksum for the new content.
- :returns:
- A new file object
- :raises:
- :class:`BoxAPIException` if the specified etag doesn't match the latest version of the file or preflight
- check fails.
- """
- accelerator_upload_url = None
- if preflight_check:
- # Preflight check does double duty, returning the accelerator URL if one is available in the response.
- accelerator_upload_url = self.preflight_check(size=preflight_expected_size)
- elif upload_using_accelerator:
- accelerator_upload_url = self._get_accelerator_upload_url_for_update()
-
- url = self.get_url('content').replace(
- self._session.api_config.BASE_API_URL,
- self._session.api_config.UPLOAD_URL,
- )
- if upload_using_accelerator and accelerator_upload_url:
- url = accelerator_upload_url
-
- attributes = {
- 'name': file_name,
- 'content_modified_at': normalize_date_to_rfc3339_format(content_modified_at),
- }
- if additional_attributes:
- attributes.update(additional_attributes)
-
- data = {'attributes': json.dumps(attributes)}
- files = {'file': ('unused', file_stream)}
- headers = {}
- if etag is not None:
- headers['If-Match'] = etag
- if sha1 is not None:
- # The Content-MD5 field accepts sha1
- headers['Content-MD5'] = sha1
- if not headers:
- headers = None
- file_response = self._session.post(
- url,
- expect_json_response=False,
- data=data,
- files=files,
- headers=headers,
- ).json()
- if 'entries' in file_response:
- file_response = file_response['entries'][0]
- return self.translator.translate(
- session=self._session,
- response_object=file_response,
- )
-
- @api_call
- def update_contents(
- self,
- file_path: str,
- etag: Optional[str] = None,
- preflight_check: bool = False,
- preflight_expected_size: int = 0,
- upload_using_accelerator: bool = False,
- file_name: Optional[str] = None,
- content_modified_at: Union[datetime, str] = None,
- additional_attributes: Optional[dict] = None,
- sha1: Optional[str] = None,
- ) -> 'File':
- """Upload a new version of a file. The contents are taken from the given file path.
-
- :param file_path:
- The path of the file that should be uploaded.
- :param etag:
- If specified, instruct the Box API to update the item only if the current version's etag matches.
- :param preflight_check:
- If specified, preflight check will be performed before actually uploading the file.
- :param preflight_expected_size:
- The size of the file to be uploaded in bytes, which is used for preflight check. The default value is '0',
- which means the file size is unknown.
- :param upload_using_accelerator:
- If specified, the upload will try to use Box Accelerator to speed up the uploads for big files.
- It will make an extra API call before the actual upload to get the Accelerator upload url, and then make
- a POST request to that url instead of the default Box upload url. It falls back to normal upload endpoint,
- if cannot get the Accelerator upload url.
-
- Please notice that this is a premium feature, which might not be available to your app.
- :param file_name:
- The new name to give the file on Box.
- :param content_modified_at:
- A datetime string in a format supported by the dateutil library or a datetime.datetime object,
- which specifies when the file content was last modified.
- If no timezone info provided, local timezone will be applied.
- :param additional_attributes:
- A dictionary containing attributes to add to the file that are not covered by other parameters.
- :param sha1:
- A sha1 checksum for the new content.
- :returns:
- A new file object
- :raises:
- :class:`BoxAPIException` if the specified etag doesn't match the latest version of the file or preflight
- check fails.
- """
- with open(file_path, 'rb') as file_stream:
- return self.update_contents_with_stream(
- file_stream,
- etag,
- preflight_check,
- preflight_expected_size=preflight_expected_size,
- upload_using_accelerator=upload_using_accelerator,
- file_name=file_name,
- content_modified_at=content_modified_at,
- additional_attributes=additional_attributes,
- sha1=sha1,
- )
-
- @api_call
- def lock(self, prevent_download: bool = False, expire_time: Union[datetime, str] = None) -> 'File':
- """
- Lock a file, preventing others from modifying (or possibly even downloading) it.
-
- :param prevent_download:
- Whether or not the lock should prevent other users from downloading the file.
- :param expire_time:
- A datetime string in a format supported by the dateutil library or a datetime.datetime object,
- which specifies when the lock should automatically expire, unlocking the file.
- If no timezone info provided, local timezone will be applied.
- :return:
- A new :class:`File` instance reflecting that the file has been locked.
- """
- data = {
- 'lock': {
- 'type': 'lock',
- 'is_download_prevented': prevent_download,
- }
- }
- if expire_time is not None:
- data['lock']['expires_at'] = normalize_date_to_rfc3339_format(expire_time)
- return self.update_info(data=data)
-
- @api_call
- def unlock(self) -> 'File':
- """
- Unlock a file, releasing any restrictions that the lock maintained.
-
- :return:
- A new :class:`File` instance reflecting that the file has been unlocked.
- """
- data = {'lock': None}
- return self.update_info(data=data)
-
- @api_call
- def create_shared_link(
- self,
- *,
- access: Optional[str] = None,
- etag: Optional[str] = None,
- unshared_at: Union[datetime, str, None] = SDK_VALUE_NOT_SET,
- allow_download: Optional[bool] = None,
- allow_preview: Optional[bool] = None,
- allow_edit: Optional[bool] = None,
- password: Optional[str] = None,
- vanity_name: Optional[str] = None,
- **kwargs: Any
- ) -> 'File':
- """
- Baseclass override.
-
- :param access:
- Determines who can access the shared link. May be open, company, or collaborators. If no access is
- specified, the default access will be used.
- :param etag:
- If specified, instruct the Box API to create the link only if the current version's etag matches.
- :param unshared_at:
- The date on which this link should be disabled. May only be set if the current user is not a free user
- and has permission to set expiration dates. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- The time portion can be omitted, which defaults to midnight (00:00:00) on that date.
- :param allow_download:
- Whether the file being shared can be downloaded when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param allow_preview:
- Whether the file being shared can be previewed when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param allow_edit:
- Whether the file being shared can be edited when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param password:
- The password required to view this link. If no password is specified then no password will be set.
- Please notice that this is a premium feature, which might not be available to your app.
- :param vanity_name:
- Defines a custom vanity name to use in the shared link URL, eg. https://app.box.com/v/my-custom-vanity-name.
- If this parameter is None, the standard shared link URL will be used.
- :param kwargs:
- Used to fulfill the contract of overriden method
- :return:
- The updated object with shared link.
- Returns a new object of the same type, without modifying the original object passed as self.
- :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the file.
- """
- # pylint:disable=arguments-differ
- return super().create_shared_link(
- access=access,
- etag=etag,
- unshared_at=unshared_at,
- allow_download=allow_download,
- allow_preview=allow_preview,
- allow_edit=allow_edit,
- password=password,
- vanity_name=vanity_name
- )
-
- @api_call
- def get_shared_link(
- self,
- *,
- access: Optional[str] = None,
- etag: Optional[str] = None,
- unshared_at: Union[datetime, str, None] = SDK_VALUE_NOT_SET,
- allow_download: Optional[bool] = None,
- allow_preview: Optional[bool] = None,
- allow_edit: Optional[bool] = None,
- password: Optional[str] = None,
- vanity_name: Optional[str] = None,
- **kwargs: Any
- ) -> 'str':
- """
- Baseclass override.
-
- :param access:
- Determines who can access the shared link. May be open, company, or collaborators. If no access is
- specified, the default access will be used.
- :param etag:
- If specified, instruct the Box API to create the link only if the current version's etag matches.
- :param unshared_at:
- The date on which this link should be disabled. May only be set if the current user is not a free user
- and has permission to set expiration dates. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- The time portion can be omitted, which defaults to midnight (00:00:00) on that date.
- :param allow_download:
- Whether the file being shared can be downloaded when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param allow_preview:
- Whether the file being shared can be previewed when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param allow_edit:
- Whether the file being shared can be edited when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param password:
- The password required to view this link. If no password is specified then no password will be set.
- Please notice that this is a premium feature, which might not be available to your app.
- :param vanity_name:
- Defines a custom vanity name to use in the shared link URL, eg. https://app.box.com/v/my-custom-vanity-name.
- If this parameter is None, the standard shared link URL will be used.
- :param kwargs:
- Used to fulfill the contract of overriden method
- :returns:
- The URL of the shared link.
- :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the file.
- """
- # pylint:disable=arguments-differ
- return super().get_shared_link(
- access=access,
- etag=etag,
- unshared_at=unshared_at,
- allow_download=allow_download,
- allow_preview=allow_preview,
- allow_edit=allow_edit,
- password=password,
- vanity_name=vanity_name
- )
-
- @api_call
- def get_shared_link_download_url(
- self,
- access: Optional[str] = None,
- etag: Optional[str] = None,
- unshared_at: Union[datetime, str, None] = SDK_VALUE_NOT_SET,
- allow_preview: Optional[bool] = None,
- password: Optional[str] = None,
- vanity_name: Optional[str] = None
- ) -> str:
- """
- Get a shared link download url for the file with the given access permissions.
- This url is a direct download url for the file.
-
- :param access:
- Determines who can access the shared link. May be open, company, or collaborators. If no access is
- specified, the default access will be used.
- :param etag:
- If specified, instruct the Box API to create the link only if the current version's etag matches.
- :param unshared_at:
- The date on which this link should be disabled. May only be set if the current user is not a free user
- and has permission to set expiration dates. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- The time portion can be omitted, which defaults to midnight (00:00:00) on that date.
- :param allow_preview:
- Whether or not the item being shared can be previewed when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param password:
- The password required to view this link. If no password is specified then no password will be set.
- Please notice that this is a premium feature, which might not be available to your app.
- :param vanity_name:
- Defines a custom vanity name to use in the shared link URL, eg. https://app.box.com/v/my-custom-vanity-name.
- If this parameter is None, the standard shared link URL will be used.
- :returns:
- The URL of the shared link that allows direct download.
- :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
- """
- item = self.create_shared_link(
- access=access,
- etag=etag,
- unshared_at=unshared_at,
- allow_preview=allow_preview,
- password=password,
- vanity_name=vanity_name
- )
- return item.shared_link['download_url'] # pylint:disable=no-member
-
- @api_call
- def get_comments(
- self,
- limit: Optional[int] = None,
- offset: int = 0,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the comments on the file.
-
- :param limit:
- The maximum number of items to return per page. If not specified, then will use the server-side default.
- :param offset:
- The index at which to start returning items.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the items in the folder.
- """
- return LimitOffsetBasedObjectCollection(
- self.session,
- self.get_url('comments'),
- limit=limit,
- fields=fields,
- offset=offset,
- return_full_pages=False,
- )
-
- @api_call
- def add_comment(self, message: str) -> 'Comment':
- """
- Add a comment to the file.
-
- :param message:
- The content of the reply comment.
- :return: Added comment
- """
- url = self._session.get_url('comments')
- comment_class = self._session.translator.get('comment')
- data = comment_class.construct_params_from_message(message)
- data['item'] = {
- 'type': 'file',
- 'id': self.object_id
- }
- box_response = self._session.post(url, data=json.dumps(data))
- response = box_response.json()
- return self._session.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def create_task(
- self,
- message: Optional[str] = None,
- due_at: Union[datetime, str] = None,
- action: str = 'review',
- completion_rule: Optional[str] = None
- ) -> 'Task':
- """
- Create a task on the given file.
-
- :param message:
- An optional message to include in the task.
- :param due_at:
- When this task is due. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied
- :param action:
- The type of task the task assignee will be prompted to perform.
- Value is one of review,complete
- :param completion_rule:
- Defines which assignees need to complete this task before the task
- is considered completed.
- Value is one of all_assignees,any_assignee
- :return:
- The newly created task
- """
- url = self._session.get_url('tasks')
- task_attributes = {
- 'item': {
- 'type': 'file',
- 'id': self.object_id
- },
- 'action': action,
- }
- if message is not None:
- task_attributes['message'] = message
- if due_at is not None:
- task_attributes['due_at'] = normalize_date_to_rfc3339_format(due_at)
- if completion_rule is not None:
- task_attributes['completion_rule'] = completion_rule
- box_response = self._session.post(url, data=json.dumps(task_attributes))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_tasks(self, fields: Iterable[str] = None) -> 'BoxObjectCollection':
- """
- Get the entries in the file tasks.
-
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the file tasks
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('tasks'),
- limit=None,
- marker=None,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def get_previous_versions(
- self,
- limit: Optional[int] = None,
- offset: int = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get previous versions of the file.
-
- :param limit:
- The maximum number of items to return per page. If not specified, then will use the server-side default.
- :param offset:
- The index at which to start returning items.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the previous versions of the file.
- """
- return LimitOffsetBasedObjectCollection(
- session=self.session,
- url=self.get_url('versions'),
- limit=limit,
- fields=fields,
- offset=offset,
- return_full_pages=False,
- )
-
- @api_call
- def promote_version(self, file_version: 'FileVersion') -> 'FileVersion':
- """
- Promote a file version to become the current version of this file. This will create a new file version
- identical to the previous version as the new current version.
-
- :param file_version:
- The file version to promote.
- :returns:
- The new file version created as the current.
- """
- url = self.get_url('versions', 'current')
- body = {
- 'type': 'file_version',
- 'id': file_version.object_id,
- }
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def delete_version(self, file_version: 'FileVersion', etag: Optional[str] = None) -> bool:
- """
- Delete a specific version of a file.
-
- :param file_version:
- The file version to delete.
- :param etag:
- If specified, instruct the Box API to update the item only if the current version's etag matches.
- :returns:
- Whether the operation succeeded.
- """
- url = self.get_url('versions', file_version.object_id)
- headers = {'If-Match': etag} if etag is not None else None
- response = self._session.delete(url, expect_json_response=False, headers=headers)
- return response.ok
-
- @api_call
- def get_embed_url(self) -> str:
- """
- Get a URL suitable for embedding the file in an iframe in a web application.
-
- :returns:
- The embed URL.
- """
- url = self.get_url()
- params = {'fields': 'expiring_embed_link'}
- response = self._session.get(url, params=params).json()
- return response['expiring_embed_link']['url']
-
- @api_call
- def get_representation_info(self, rep_hints: Optional[str] = None) -> List[dict]:
- """
- Get information about the representations available for a file.
-
- :param rep_hints:
- A formatted string describing which representations are desired.
- :returns:
- The representation information
- """
- url = self.get_url()
- params = {'fields': 'representations'}
- headers = {'X-Rep-Hints': rep_hints} if rep_hints is not None else None
- response = self._session.get(url, params=params, headers=headers).json()
- return response['representations']['entries']
-
- @deprecated('Use get_thumbnail_representation')
- @api_call
- def get_thumbnail(
- self,
- extension: str = 'png',
- min_width: Optional[int] = None,
- min_height: Optional[int] = None,
- max_width: Optional[int] = None,
- max_height: Optional[int] = None
- ) -> bytes:
- """
- Retrieve a thumbnail image for the file.
-
- :param extension:
- The file extension for the thumbnail, e.g. 'png' or 'jpg'
- :param min_width:
- The minimum width required for the thumbnail image
- :param min_height:
- The minimum height required for the thumbnail image
- :param max_width:
- The maximum width required for the thumbnail image
- :param max_height:
- The maximum height required for the thumbnail image
- :returns:
- The file contents of the thumbnail image
- """
- url = self.get_url('thumbnail.' + extension)
- params = {}
- if min_width is not None:
- params['min_width'] = min_width
- if min_height is not None:
- params['min_height'] = min_height
- if max_width is not None:
- params['max_width'] = max_width
- if max_height is not None:
- params['max_height'] = max_height
-
- response = self._session.get(url, params=params, expect_json_response=False)
- return response.content
-
- @api_call
- def get_thumbnail_representation(self, dimensions: str, extension: str = 'png') -> bytes:
- """
- Retrieve a thumbnail image for the file.
-
- :param dimensions:
- The width by height size of this representation in pixels (e.g. '92x92')
- :param extension:
- The file extension for the thumbnail, e.g. 'png' or 'jpg'
- :returns:
- The file contents of the thumbnail image
- """
- rep_hints = f'[{extension}?dimensions={dimensions}]'
- representations = self.get_representation_info(rep_hints)
- if representations:
- representation = representations[0]
- if representation['status'].get('code') in ('error_conversion_failed', 'error_password_protected'):
- return b''
- url = representation['content']['url_template']
- url = url.replace('{+asset_path}', '')
- response = self._session.get(url, expect_json_response=False)
- return response.content
- return b''
-
- @api_call
- def copy(
- self,
- *,
- parent_folder: 'Folder',
- name: Optional[str] = None,
- file_version: 'FileVersion' = None,
- **_kwargs
- ) -> 'File':
- # pylint: disable=arguments-differ
- """Copy the item to the given folder.
-
- :param parent_folder:
- The folder to which the item should be copied.
- :param name:
- A new name for the item, in case there is already another item in the new parent folder with the same name.
- :param file_version:
- A specific version of the file to copy
- :returns:
- The copy of the file
- """
- # pylint: disable=arguments-differ
- url = self.get_url('copy')
- data = {
- 'parent': {'id': parent_folder.object_id}
- }
- if name is not None:
- data['name'] = name
- if file_version is not None:
- data['version'] = file_version.object_id
- box_response = self._session.post(url, data=json.dumps(data))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def set_disposition_at(self, date_time: Union[datetime, str]) -> 'File':
- """
- Modifies the retention expiration timestamp for the given file. This date can't be shortened once set on a file.
-
- :param date_time:
- A datetime string in a format supported by the dateutil library or a datetime.datetime object.
- If no timezone info provided, local timezone will be applied.
- :return:
- Updated 'File' object
- """
- data = {'disposition_at': normalize_date_to_rfc3339_format(date_time)}
- return self.update_info(data=data)
diff --git a/boxsdk/object/file_request.py b/boxsdk/object/file_request.py
deleted file mode 100644
index 1ae4c90ff..000000000
--- a/boxsdk/object/file_request.py
+++ /dev/null
@@ -1,78 +0,0 @@
-import json
-from datetime import datetime
-from typing import TYPE_CHECKING, Optional, Union
-
-from boxsdk.util.datetime_formatter import normalize_date_to_rfc3339_format
-from boxsdk.util.text_enum import TextEnum
-
-from ..util.api_call_decorator import api_call
-from .base_object import BaseObject
-
-if TYPE_CHECKING:
- from boxsdk.object.folder import Folder
-
-
-class StatusState(TextEnum):
- """An enum of possible status states"""
- ACTIVE = 'active'
- INACTIVE = 'inactive'
-
-
-class FileRequest(BaseObject):
- """Represents the file request."""
- _item_type = 'file_request'
-
- @api_call
- def copy(
- self,
- *,
- folder: 'Folder',
- description: Optional[str] = None,
- expires_at: Union[datetime, str] = None,
- require_description: Optional[bool] = None,
- require_email: Optional[bool] = None,
- status: Optional[str] = None,
- title: Optional[str] = None,
- **_kwargs
- ) -> 'FileRequest':
- """Copy an existing file request already present on one folder, and applies it to another folder.
-
- :param description:
- A new description for the file request.
- :param title:
- A new title for the file request.
- :param expires_at:
- A expiration time for file request which no longer accepts new files.
- :param folder:
- The folder to which the file request will be saved.
- :param require_description:
- A flag indicating whether the file submitted must have a description.
- :param require_email:
- A flag indicating whether the file submitted must have sender email.
- :param status:
- The status of the file request.
- :returns:
- The copy of the file request
- """
- url = self.get_url('copy')
- data = {
- 'folder': {'id': folder.object_id, 'type': folder.object_type},
- }
- if description is not None:
- data['description'] = description
- if title is not None:
- data['title'] = title
- if expires_at is not None:
- data['expires_at'] = normalize_date_to_rfc3339_format(expires_at)
- if require_description is not None:
- data['is_description_required'] = require_description
- if require_email is not None:
- data['is_email_required'] = require_email
- if status is not None:
- data['status'] = status
- box_response = self._session.post(url, data=json.dumps(data))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
diff --git a/boxsdk/object/file_version.py b/boxsdk/object/file_version.py
deleted file mode 100644
index 7299d99df..000000000
--- a/boxsdk/object/file_version.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from .base_object import BaseObject
-
-
-class FileVersion(BaseObject):
- """Represents a Box file version."""
- _item_type = 'file_version'
diff --git a/boxsdk/object/file_version_retention.py b/boxsdk/object/file_version_retention.py
deleted file mode 100644
index 08f0473fe..000000000
--- a/boxsdk/object/file_version_retention.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from .base_object import BaseObject
-
-
-class FileVersionRetention(BaseObject):
- """Represents a Box file version retention."""
- _item_type = 'file_version_retention'
diff --git a/boxsdk/object/folder.py b/boxsdk/object/folder.py
deleted file mode 100644
index d20f5b008..000000000
--- a/boxsdk/object/folder.py
+++ /dev/null
@@ -1,783 +0,0 @@
-import json
-import os
-from datetime import datetime
-from typing import TYPE_CHECKING, Any, Tuple, Optional, Iterable, IO, Union
-
-from boxsdk.object.group import Group
-from boxsdk.object.item import Item
-from boxsdk.object.user import User
-from boxsdk.pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-from boxsdk.pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from boxsdk.util.api_call_decorator import api_call
-from boxsdk.util.datetime_formatter import normalize_date_to_rfc3339_format
-from boxsdk.util.default_arg_value import SDK_VALUE_NOT_SET
-from boxsdk.util.text_enum import TextEnum
-
-if TYPE_CHECKING:
- from boxsdk.object.upload_session import UploadSession
- from boxsdk.util.chunked_uploader import ChunkedUploader
- from boxsdk.object.file import File
- from boxsdk.object.collaboration import CollaborationRole, Collaboration
- from boxsdk.object.web_link import WebLink
- from boxsdk.object.enterprise import Enterprise
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
- from boxsdk.object.metadata_template import MetadataTemplate
- from boxsdk.object.metadata_cascade_policy import MetadataCascadePolicy
- from boxsdk.object.folder_lock import FolderLock
-
-
-class FolderSyncState(TextEnum):
- """An enum of all possible values of a folder's ``sync_state`` attribute.
-
- The value of the ``sync_state`` attribute determines whether the folder
- will be synced by sync clients.
- """
- IS_SYNCED = 'synced'
- NOT_SYNCED = 'not_synced'
- PARTIALLY_SYNCED = 'partially_synced'
-
-
-class _CollaborationType(TextEnum):
- """The type of a collaboration"""
- USER = 'user'
- GROUP = 'group'
-
-
-class _Collaborator:
- """This helper class represents a collaborator on Box. A Collaborator can be a User, Group, or an email address"""
-
- def __init__(self, collaborator: Any):
- if isinstance(collaborator, User):
- self._setup(user=collaborator)
- elif isinstance(collaborator, Group):
- self._setup(group=collaborator)
- elif isinstance(collaborator, str):
- self._setup(email_address=collaborator)
- else:
- raise TypeError('Collaborator must be User, Group, or unicode string')
-
- def _setup(self, user: User = None, group: Group = None, email_address: str = None) -> None:
- """
- :param user:
- The Box user if applicable
- :param group:
- The Box group if applicable
- :param email_address:
- The email address of the user if not a user of Box
- """
- self._type = _CollaborationType.GROUP if group else _CollaborationType.USER
- id_object = user or group
- if id_object:
- self._key = 'id'
- self._identifier = id_object.object_id
- else:
- self._key = 'login'
- self._identifier = email_address
-
- @property
- def access(self) -> Tuple[str, str]:
- """Return a tuple for how to access collaborator
-
- The first element is the key for access, the second is the value
- """
- return self._key, self._identifier
-
- @property
- def type(self) -> str:
- """Return the type of collaborator (user or group)"""
- return self._type
-
-
-class Folder(Item):
- """Box API endpoint for interacting with folders."""
-
- _item_type = 'folder'
-
- @api_call
- def preflight_check(self, size: int, name: str) -> Optional[str]:
- """
- Make an API call to check if a new file with given name and size can be uploaded to this folder.
- Returns an accelerator URL if one is available.
-
- :param size:
- The size of the file in bytes. Specify 0 for unknown file-sizes.
- :param name:
- The name of the file to be uploaded.
- :return:
- The Accelerator upload url or None if cannot get the Accelerator upload url.
- :raises:
- :class:`BoxAPIException` when preflight check fails.
- """
- return self._preflight_check(
- size=size,
- name=name,
- parent_id=self._object_id,
- )
-
- @api_call
- def create_upload_session(self, file_size: int, file_name: str, use_upload_session_urls: bool = True) -> 'UploadSession':
- """
- Creates a new chunked upload session for upload a new file.
-
- :param file_size:
- The size of the file in bytes that will be uploaded.
- :param file_name:
- The name of the file that will be uploaded.
- :param use_upload_session_urls:
- The parameter detrermining what urls to use to perform chunked upload.
- If True, the urls returned by create_upload_session() endpoint response will be used,
- unless a custom API.UPLOAD_URL was set in the config.
- If False, the base upload url will be used.
- :returns:
- A :class:`UploadSession` object.
- """
- url = f'{self.session.api_config.UPLOAD_URL}/files/upload_sessions'
- body_params = {
- 'folder_id': self.object_id,
- 'file_size': file_size,
- 'file_name': file_name,
- }
- response = self._session.post(url, data=json.dumps(body_params)).json()
- upload_session = self.translator.translate(
- session=self._session,
- response_object=response,
- )
- # pylint:disable=protected-access
- upload_session._use_upload_session_urls = use_upload_session_urls
- return upload_session
-
- @api_call
- def get_chunked_uploader(
- self, file_path: str, file_name: Optional[str] = None, use_upload_session_urls: bool = True
- ) -> 'ChunkedUploader':
- # pylint: disable=consider-using-with
- """
- Instantiate the chunked upload instance and create upload session with path to file.
-
- :param file_path:
- The local path to the file you wish to upload.
- :param file_name:
- The name with extention of the file that will be uploaded, e.g. new_file_name.zip.
- If not specified, the name from the local system is used.
- :param use_upload_session_urls:
- The parameter detrermining what urls to use to perform chunked upload.
- If True, the urls returned by create_upload_session() endpoint response will be used,
- unless a custom API.UPLOAD_URL was set in the config.
- If False, the base upload url will be used.
- :returns:
- A :class:`ChunkedUploader` object.
- """
- total_size = os.stat(file_path).st_size
- upload_file_name = file_name if file_name else os.path.basename(file_path)
- content_stream = open(file_path, 'rb')
-
- try:
- upload_session = self.create_upload_session(total_size, upload_file_name, use_upload_session_urls)
- return upload_session.get_chunked_uploader_for_stream(content_stream, total_size)
- except Exception:
- content_stream.close()
- raise
-
- def _get_accelerator_upload_url_fow_new_uploads(self) -> Optional[str]:
- """
- Get Accelerator upload url for uploading new files.
-
- :return:
- The Accelerator upload url or None if cannot get one
- """
- return self._get_accelerator_upload_url()
-
- @api_call
- def get_items(
- self,
- limit: Optional[int] = None,
- offset: int = 0,
- marker: Optional[str] = None,
- use_marker: bool = False,
- sort: Optional[str] = None,
- direction: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> Iterable[Item]:
- """
- Get the items in a folder.
-
- :param limit:
- The maximum number of items to return per page. If not specified, then will use the server-side default.
- :param offset:
- The index at which to start returning items when using offset-based pagin.
- :param marker:
- The paging marker to start returning items from when using marker-based paging.
- :param use_marker:
- Whether to use marker-based paging instead of offset-based paging, defaults to False.
- :param sort:
- Item field to sort results on: 'id', 'name', or 'date'.
- :param direction:
- Sort direction for the items returned.
- :param fields:
- List of fields to request.
- :returns:
- The collection of items in the folder.
- """
- url = self.get_url('items')
- additional_params = {}
- if limit is not None:
- additional_params['limit'] = limit
- if sort:
- additional_params['sort'] = sort
- if direction:
- additional_params['direction'] = direction
-
- if use_marker:
- additional_params['usemarker'] = True
- return MarkerBasedObjectCollection(
- url=url,
- session=self._session,
- limit=limit,
- marker=marker,
- fields=fields,
- additional_params=additional_params,
- return_full_pages=False,
- )
-
- return LimitOffsetBasedObjectCollection(
- url=url,
- session=self._session,
- limit=limit,
- offset=offset,
- fields=fields,
- additional_params=additional_params,
- return_full_pages=False,
- )
-
- @api_call
- def upload_stream(
- self,
- file_stream: IO[bytes],
- file_name: str,
- file_description: Optional[str] = None,
- preflight_check: bool = False,
- preflight_expected_size: int = 0,
- upload_using_accelerator: bool = False,
- content_created_at: Union[datetime, str] = None,
- content_modified_at: Union[datetime, str] = None,
- additional_attributes: Optional[dict] = None,
- sha1: Optional[str] = None,
- etag: Optional[str] = None,
- stream_file_content: bool = True,
- ) -> 'File':
- """
- Upload a file to the folder.
- The contents are taken from the given file stream, and it will have the given name.
-
- :param file_stream:
- The file-like object containing the bytes
- :param file_name:
- The name to give the file on Box.
- :param file_description:
- The description to give the file on Box.
- :param preflight_check:
- If specified, preflight check will be performed before actually uploading the file.
- :param preflight_expected_size:
- The size of the file to be uploaded in bytes, which is used for preflight check. The default value is '0',
- which means the file size is unknown.
- :param upload_using_accelerator:
- If specified, the upload will try to use Box Accelerator to speed up the uploads for big files.
- It will make an extra API call before the actual upload to get the Accelerator upload url, and then make
- a POST request to that url instead of the default Box upload url. It falls back to normal upload endpoint,
- if cannot get the Accelerator upload url.
-
- Please notice that this is a premium feature, which might not be available to your app.
- :param content_created_at:
- A datetime string in a format supported by the dateutil library or a datetime.datetime object,
- which specifies when the file was created. If no timezone info provided, local timezone will be applied.
- :param content_modified_at:
- A datetime string in a format supported by the dateutil library or a datetime.datetime object, which
- specifies when the file was last modified. If no timezone info provided, local timezone will be applied.
- :param additional_attributes:
- A dictionary containing attributes to add to the file that are not covered by other parameters.
- :param sha1:
- A sha1 checksum for the file.
- :param etag:
- If specified, instruct the Box API to update the item only if the current version's etag matches.
- :param stream_file_content:
- If True, the upload will be performed as a stream request. If False, the file will be read into memory
- before being uploaded, but this may be required if using some proxy servers to handle redirects correctly.
- :returns:
- The newly uploaded file.
- """
- accelerator_upload_url = None
- if preflight_check:
- # Preflight check does double duty, returning the accelerator URL if one is available in the response.
- accelerator_upload_url = self.preflight_check(size=preflight_expected_size, name=file_name)
- elif upload_using_accelerator:
- accelerator_upload_url = self._get_accelerator_upload_url_fow_new_uploads()
-
- url = f'{self._session.api_config.UPLOAD_URL}/files/content'
- if upload_using_accelerator and accelerator_upload_url:
- url = accelerator_upload_url
-
- attributes = {
- 'name': file_name,
- 'parent': {'id': self._object_id},
- 'description': file_description,
- 'content_created_at': normalize_date_to_rfc3339_format(content_created_at),
- 'content_modified_at': normalize_date_to_rfc3339_format(content_modified_at),
- }
- if additional_attributes:
- attributes.update(additional_attributes)
-
- data = {'attributes': json.dumps(attributes)}
- files = {
- 'file': ('unused', file_stream),
- }
- headers = {}
- if etag is not None:
- headers['If-Match'] = etag
- if sha1 is not None:
- # The Content-MD5 field accepts sha1
- headers['Content-MD5'] = sha1
- if not headers:
- headers = None
- file_response = self._session.post(
- url, data=data, files=files, expect_json_response=False, headers=headers, stream_file_content=stream_file_content,
- ).json()
- if 'entries' in file_response:
- file_response = file_response['entries'][0]
- return self.translator.translate(
- session=self._session,
- response_object=file_response,
- )
-
- @api_call
- def upload(
- self,
- file_path: str = None,
- file_name: str = None,
- file_description: Optional[str] = None,
- preflight_check: bool = False,
- preflight_expected_size: int = 0,
- upload_using_accelerator: bool = False,
- content_created_at: Union[datetime, str] = None,
- content_modified_at: Union[datetime, str] = None,
- additional_attributes: Optional[dict] = None,
- sha1: Optional[str] = None,
- etag: Optional[str] = None,
- stream_file_content: bool = True,
- ) -> 'File':
- """
- Upload a file to the folder.
- The contents are taken from the given file path, and it will have the given name.
- If file_name is not specified, the uploaded file will take its name from file_path.
-
- :param file_path:
- The file path of the file to upload to Box.
- :param file_name:
- The name to give the file on Box. If None, then use the leaf name of file_path
- :param file_description:
- The description to give the file on Box. If None, then no description will be set.
- :param preflight_check:
- If specified, preflight check will be performed before actually uploading the file.
- :param preflight_expected_size:
- The size of the file to be uploaded in bytes, which is used for preflight check. The default value is '0',
- which means the file size is unknown.
- :param upload_using_accelerator:
- If specified, the upload will try to use Box Accelerator to speed up the uploads for big files.
- It will make an extra API call before the actual upload to get the Accelerator upload url, and then make
- a POST request to that url instead of the default Box upload url. It falls back to normal upload endpoint,
- if cannot get the Accelerator upload url.
-
- Please notice that this is a premium feature, which might not be available to your app.
- :param content_created_at:
- A datetime string in a format supported by the dateutil library or a datetime.datetime object,
- which specifies when the file was created. If no timezone info provided, local timezone will be applied.
- :param content_modified_at:
- A datetime string in a format supported by the dateutil library or a datetime.datetime object, which
- specifies when the file was last modified.If no timezone info provided, local timezone will be applied.
- :param additional_attributes:
- A dictionary containing attributes to add to the file that are not covered by other parameters.
- :param sha1:
- A sha1 checksum for the new content.
- :param etag:
- If specified, instruct the Box API to update the item only if the current version's etag matches.
- :param stream_file_content:
- If True, the upload will be performed as a stream request. If False, the file will be read into memory
- before being uploaded, but this may be required if using some proxy servers to handle redirects correctly.
- :returns:
- The newly uploaded file.
- """
- if file_name is None:
- file_name = os.path.basename(file_path)
- with open(file_path, 'rb') as file_stream:
- return self.upload_stream(
- file_stream,
- file_name,
- file_description,
- preflight_check,
- preflight_expected_size=preflight_expected_size,
- upload_using_accelerator=upload_using_accelerator,
- content_created_at=content_created_at,
- content_modified_at=content_modified_at,
- additional_attributes=additional_attributes,
- sha1=sha1,
- etag=etag,
- stream_file_content=stream_file_content,
- )
-
- @api_call
- def create_subfolder(self, name: str) -> 'Folder':
- """
- Create a subfolder with the given name in the folder.
-
- :param name:
- The name of the new folder
- """
- url = self.get_type_url()
- data = {
- 'name': name,
- 'parent': {
- 'id': self._object_id,
- }
- }
- box_response = self._session.post(url, data=json.dumps(data))
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def update_sync_state(self, sync_state: FolderSyncState) -> 'Folder':
- """Update the ``sync_state`` attribute of this folder.
-
- Change whether this folder will be synced by sync clients.
-
- :param sync_state:
- The desired sync state of this folder.
- Must be a member of the `FolderSyncState` enum.
- :return:
- A new :class:`Folder` instance with updated information reflecting the new sync state.
- """
- data = {
- 'sync_state': sync_state,
- }
- return self.update_info(data=data)
-
- @api_call
- def create_shared_link(
- self,
- *,
- access: Optional[str] = None,
- etag: Optional[str] = None,
- unshared_at: Union[datetime, str, None] = SDK_VALUE_NOT_SET,
- allow_download: Optional[bool] = None,
- allow_preview: Optional[bool] = None,
- password: Optional[str] = None,
- vanity_name: Optional[str] = None,
- **kwargs: Any
- ) -> 'Folder':
- """
- Baseclass override.
-
- :param access:
- Determines who can access the shared link. May be open, company, or collaborators. If no access is
- specified, the default access will be used.
- :param etag:
- If specified, instruct the Box API to create the link only if the current version's etag matches.
- :param unshared_at:
- The date on which this link should be disabled. May only be set if the current user is not a free user
- and has permission to set expiration dates. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- The time portion can be omitted, which defaults to midnight (00:00:00) on that date.
- :param allow_download:
- Whether the folder being shared can be downloaded when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param allow_preview:
- Whether the folder being shared can be previewed when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param password:
- The password required to view this link. If no password is specified then no password will be set.
- Please notice that this is a premium feature, which might not be available to your app.
- :param vanity_name:
- Defines a custom vanity name to use in the shared link URL, eg. https://app.box.com/v/my-custom-vanity-name.
- If this parameter is None, the standard shared link URL will be used.
- :param kwargs:
- Used to fulfill the contract of overriden method
- :return:
- The updated object with shared link.
- Returns a new object of the same type, without modifying the original object passed as self.
- :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the folder.
- """
- # pylint:disable=arguments-differ
- return super().create_shared_link(
- access=access,
- etag=etag,
- unshared_at=unshared_at,
- allow_download=allow_download,
- allow_preview=allow_preview,
- password=password,
- vanity_name=vanity_name
- )
-
- @api_call
- def get_shared_link(
- self,
- *,
- access: Optional[str] = None,
- etag: Optional[str] = None,
- unshared_at: Union[datetime, str, None] = SDK_VALUE_NOT_SET,
- allow_download: Optional[bool] = None,
- allow_preview: Optional[bool] = None,
- password: Optional[str] = None,
- vanity_name: Optional[str] = None,
- **kwargs: Any
- ) -> 'str':
- """
- Baseclass override.
-
- :param access:
- Determines who can access the shared link. May be open, company, or collaborators. If no access is
- specified, the default access will be used.
- :param etag:
- If specified, instruct the Box API to create the link only if the current version's etag matches.
- :param unshared_at:
- The date on which this link should be disabled. May only be set if the current user is not a free user
- and has permission to set expiration dates. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- The time portion can be omitted, which defaults to midnight (00:00:00) on that date.
- :param allow_download:
- Whether the folder being shared can be downloaded when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param allow_preview:
- Whether the folder being shared can be previewed when accessed via the shared link.
- If this parameter is None, the default setting will be used.
- :param password:
- The password required to view this link. If no password is specified then no password will be set.
- Please notice that this is a premium feature, which might not be available to your app.
- :param vanity_name:
- Defines a custom vanity name to use in the shared link URL, eg. https://app.box.com/v/my-custom-vanity-name.
- If this parameter is None, the standard shared link URL will be used.
- :param kwargs:
- Used to fulfill the contract of overriden method
- :returns:
- The URL of the shared link.
- :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the folder.
- """
- # pylint:disable=arguments-differ
- return super().get_shared_link(
- access=access,
- etag=etag,
- unshared_at=unshared_at,
- allow_download=allow_download,
- allow_preview=allow_preview,
- password=password,
- vanity_name=vanity_name
- )
-
- @api_call
- def add_collaborator(
- self,
- collaborator: Union[User, Group, str],
- role: 'CollaborationRole',
- notify: bool = False,
- can_view_path: bool = False
- ) -> 'Collaboration':
- """Add a collaborator to the folder
-
- :param collaborator:
- collaborator to add. It may be a User, Group, or email address (unicode string)
- :param role:
- The collaboration role
- :param notify:
- Whether to send a notification email to the collaborator
- :param can_view_path:
- Whether view path collaboration feature is enabled or not. Note - only
- folder owners can create collaborations with can_view_path.
- :return:
- The new collaboration
- """
- collaborator_helper = _Collaborator(collaborator)
- url = self._session.get_url('collaborations')
- item = {'id': self._object_id, 'type': 'folder'}
- access_key, access_value = collaborator_helper.access
- accessible_by = {
- access_key: access_value,
- 'type': collaborator_helper.type,
- }
- body_params = {
- 'item': item,
- 'accessible_by': accessible_by,
- 'role': role,
- }
- if can_view_path:
- body_params['can_view_path'] = True
- data = json.dumps(body_params)
- params = {'notify': notify}
- box_response = self._session.post(url, expect_json_response=True, data=data, params=params)
- collaboration_response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=collaboration_response,
- )
-
- @api_call
- def create_web_link(
- self,
- target_url: str,
- name: Optional[str] = None,
- description: Optional[str] = None
- ) -> 'WebLink':
- """
- Create a WebLink with a given url.
-
- :param target_url:
- The url the web link points to.
- :param name:
- The name of the web link. Optional, the API will give it a default if not specified.
- :param description:
- Description of the web link
- :return:
- A :class:`WebLink` object.
- """
- url = self._session.get_url('web_links')
- web_link_attributes = {
- 'url': target_url,
- 'parent': {
- 'id': self.object_id
- }
- }
- if name is not None:
- web_link_attributes['name'] = name
- if description is not None:
- web_link_attributes['description'] = description
- response = self._session.post(url, data=json.dumps(web_link_attributes)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response
- )
-
- @api_call
- def delete(
- self,
- *,
- recursive: bool = True,
- etag: Optional[str] = None,
- **kwargs
- ) -> bool:
- """Base class override. Delete the folder.
-
- :param recursive:
- Whether or not the folder should be deleted if it isn't empty.
- :param etag:
- If specified, instruct the Box API to delete the folder only if the current version's etag matches.
- :returns:
- Whether or not the update was successful.
- :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the folder.
- """
- # pylint:disable=arguments-differ,arguments-renamed
- return super().delete(params={'recursive': recursive}, etag=etag, **kwargs)
-
- @api_call
- def get_metadata_cascade_policies(
- self,
- owner_enterprise: 'Enterprise' = None,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the metadata cascade policies current applied to the folder.
-
- :param owner_enterprise:
- Which enterprise's metadata templates to get cascade policies for. This defauls to the current
- enterprise.
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the cascade policies attached on the folder.
- """
- additional_params = {
- 'folder_id': self.object_id,
- }
- if owner_enterprise is not None:
- additional_params['owner_enterprise_id'] = owner_enterprise.object_id
-
- return MarkerBasedObjectCollection(
- url=self._session.get_url('metadata_cascade_policies'),
- session=self._session,
- additional_params=additional_params,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def cascade_metadata(self, metadata_template: 'MetadataTemplate') -> 'MetadataCascadePolicy':
- """
- Create a metadata cascade policy to apply the metadata instance values on the folder for the given metadata
- template to all files within the folder.
-
- :param metadata_template:
- The metadata template to cascade values for
- :returns:
- The created metadata cascade policy
- """
- url = self._session.get_url('metadata_cascade_policies')
-
- body = {
- 'folder_id': self.object_id,
- 'scope': metadata_template.scope,
- 'templateKey': metadata_template.template_key,
- }
-
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(self._session, response)
-
- @api_call
- def create_lock(self) -> 'FolderLock':
- """
- Creates a folder lock on a folder, preventing it from being moved and/or deleted.
-
- :returns:
- The created folder lock
- """
- url = self._session.get_url('folder_locks')
-
- body = {
- 'folder': {
- 'type': 'folder',
- 'id': self.object_id
- },
- 'locked_operations': {
- 'move': True,
- 'delete': True
- }
- }
-
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(self._session, response)
-
- @api_call
- def get_locks(self) -> 'BoxObjectCollection':
- """
- Lists all folder locks for a given folder.
-
- :returns:
- The collection of locks for a folder.
- """
- url = self._session.get_url('folder_locks')
-
- additional_params = {
- 'folder_id': self.object_id,
- }
-
- return MarkerBasedObjectCollection(
- url=url,
- session=self._session,
- additional_params=additional_params,
- return_full_pages=False,
- )
diff --git a/boxsdk/object/folder_lock.py b/boxsdk/object/folder_lock.py
deleted file mode 100644
index dd646a888..000000000
--- a/boxsdk/object/folder_lock.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_object import BaseObject
-
-
-class FolderLock(BaseObject):
- """Represents the folder lock"""
-
- _item_type = 'folder_lock'
diff --git a/boxsdk/object/group.py b/boxsdk/object/group.py
deleted file mode 100644
index 93d3d689a..000000000
--- a/boxsdk/object/group.py
+++ /dev/null
@@ -1,116 +0,0 @@
-import json
-from typing import Optional, Iterable, TYPE_CHECKING
-
-from boxsdk.util.text_enum import TextEnum
-from .base_object import BaseObject
-from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-from ..util.api_call_decorator import api_call
-from ..util.default_arg_value import SDK_VALUE_NOT_SET
-
-if TYPE_CHECKING:
- from boxsdk.object.group_membership import GroupMembership
- from boxsdk.object.user import User
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class GroupRole(TextEnum):
- """The role in the group."""
- ADMIN = 'admin'
- MEMBER = 'member'
-
-
-class Group(BaseObject):
- """Represents a Box group."""
-
- _item_type = 'group'
-
- @api_call
- def get_memberships(
- self,
- limit: Optional[int] = None,
- offset: Optional[int] = None,
- fields: Optional[Iterable[str]] = None
- ) -> Iterable['GroupMembership']:
- """
- Get the membership records for the group, which indicate which users are included in the group.
-
- :param limit:
- The maximum number of items to return in a page.
- :param offset:
- The index at which to begin.
- :param fields:
- List of fields to request. If None, will return the default fields for the object.
- :returns:
- The collection of membership objects for the group.
- """
- return LimitOffsetBasedObjectCollection(
- self._session,
- url=self.get_url('memberships'),
- limit=limit,
- offset=offset,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def add_member(
- self,
- user: 'User',
- role: GroupRole = GroupRole.MEMBER,
- configurable_permissions: Optional[str] = SDK_VALUE_NOT_SET
- ) -> 'GroupMembership':
- """
- Add the given user to this group under the given role
-
- :param user:
- The User to add to the group.
- :param role:
- The role for the user.
- :param configurable_permissions:
- This is a group level permission that is configured for Group members with
- admin role only.
- :returns:
- The new GroupMembership instance.
- """
- url = self._session.get_url('group_memberships')
- body_attributes = {
- 'user': {'id': user.object_id},
- 'group': {'id': self.object_id},
- 'role': role,
- }
- if configurable_permissions is not SDK_VALUE_NOT_SET:
- body_attributes['configurable_permissions'] = configurable_permissions
- box_response = self._session.post(url, data=json.dumps(body_attributes))
- response = box_response.json()
- return self.translator.translate(self._session, response)
-
- @api_call
- def get_collaborations(
- self,
- limit: Optional[int] = None,
- offset: Optional[int] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the collaboration for the group using limit-offset paging.
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param offset:
- The offset of the item at which to begin the response.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the collaboration for the group.
- """
- additional_params = {}
- if fields is not None:
- additional_params['fields'] = ','.join(fields)
- return LimitOffsetBasedObjectCollection(
- session=self._session,
- url=self.get_url('collaborations'),
- additional_params=additional_params,
- limit=limit,
- offset=offset,
- return_full_pages=False,
- )
diff --git a/boxsdk/object/group_membership.py b/boxsdk/object/group_membership.py
deleted file mode 100644
index b439851cb..000000000
--- a/boxsdk/object/group_membership.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_object import BaseObject
-
-
-class GroupMembership(BaseObject):
- """Represents a Box group_membership, which relates a user & group under a specific role."""
-
- _item_type = 'group_membership'
diff --git a/boxsdk/object/invite.py b/boxsdk/object/invite.py
deleted file mode 100644
index 4f9a701be..000000000
--- a/boxsdk/object/invite.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_object import BaseObject
-
-
-class Invite(BaseObject):
- """Represents the invite"""
-
- _item_type = 'invite'
diff --git a/boxsdk/object/item.py b/boxsdk/object/item.py
deleted file mode 100644
index e79aad1c0..000000000
--- a/boxsdk/object/item.py
+++ /dev/null
@@ -1,450 +0,0 @@
-import json
-from typing import TYPE_CHECKING, Optional, Iterable, Any, Union
-
-from boxsdk.util.text_enum import TextEnum
-from .base_item import BaseItem
-from ..exception import BoxAPIException
-from .metadata import Metadata
-from ..util.api_call_decorator import api_call
-from ..pagination.marker_based_dict_collection import MarkerBasedDictCollection
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-
-if TYPE_CHECKING:
- from boxsdk.object.watermark import Watermark
- from boxsdk.object.group import Group
- from boxsdk.object.user import User
- from boxsdk.object.collaboration import Collaboration
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class ClassificationType(TextEnum):
- """An enum of possible classification types"""
- PUBLIC = 'Public'
- INTERNAL = 'Internal'
- CONFIDENTIAL = 'Confidential'
- NONE = 'None'
-
-
-class Item(BaseItem):
- """Box API endpoint for interacting with files and folders."""
-
- _classification_template_key = 'securityClassification-6VMVochwUWo'
-
- def _get_accelerator_upload_url(self, file_id: Optional[str] = None) -> Optional[str]:
- """
- Make an API call to get the Accelerator upload url for either upload a new file or updating an existing file.
-
- :param file_id:
- Box id of the file to be uploaded. Not required for new file uploads.
- :return:
- The Accelerator upload url or None if cannot get the Accelerator upload url.
- """
- if file_id:
- self.validate_item_id(file_id)
- endpoint = f'{file_id}/content' if file_id else 'content'
- url = f'{self._session.api_config.BASE_API_URL}/files/{endpoint}'
- try:
- response_json = self._session.options(
- url=url,
- expect_json_response=True,
- ).json()
- return response_json.get('upload_url', None)
- except BoxAPIException:
- return None
-
- def _preflight_check(
- self, size: int,
- name: str = None,
- file_id: str = None,
- parent_id: str = None
- ) -> Optional[str]:
- """
- Make an API call to check if certain file can be uploaded to Box or not.
- (https://developer.box.com/en/guides/uploads/check/)
-
- Returns an accelerator URL if available, which comes for free in the response.
-
- :param size:
- The size of the file to be uploaded in bytes. Specify 0 for unknown file sizes.
- :param name:
- The name of the file to be uploaded. This is optional if `file_id` is specified,
- but required for new file uploads.
- :param file_id:
- Box id of the file to be uploaded. Not required for new file uploads.
- :param parent_id:
- The ID of the parent folder. Required only for new file uploads.
- :return:
- The Accelerator upload url or None if cannot get the Accelerator upload url.
- :raises:
- :class:`BoxAPIException` when preflight check fails.
- """
- if file_id:
- self.validate_item_id(file_id)
- endpoint = f'{file_id}/content' if file_id else 'content'
- url = f'{self._session.api_config.BASE_API_URL}/files/{endpoint}'
- data = {'size': size}
- if name:
- data['name'] = name
- if parent_id:
- data['parent'] = {'id': parent_id}
-
- response_json = self._session.options(
- url=url,
- expect_json_response=True,
- data=json.dumps(data),
- ).json()
- return response_json.get('upload_url', None)
-
- @api_call
- def update_info(self, *, data: dict, etag: Optional[str] = None, **kwargs: Any) -> 'Item':
- """
- Baseclass override.
- :param data:
- The updated information about this object.
- Must be JSON serializable.
- Update the object attributes in data.keys(). The semantics of the
- values depends on the the type and attributes of the object being
- updated. For details on particular semantics, refer to the Box
- developer API documentation .
- :param etag:
- If specified, instruct the Box API to perform the update only if
- the current version's etag matches.
- :return:
- The updated object.
- Return a new object of the same type, without modifying the original object passed as self.
- Construct the new object with all the default attributes that are returned from the endpoint.
- """
- # pylint:disable=arguments-differ
- self.validate_item_id(self._object_id)
- headers = {'If-Match': etag} if etag is not None else None
- return super().update_info(data=data, headers=headers, **kwargs)
-
- @api_call
- def get(self, *, fields: Iterable[str] = None, etag: Optional[str] = None, **kwargs) -> 'Item':
- """
- Base class override.
-
- :param fields:
- List of fields to request.
- :param etag:
- If specified, instruct the Box API to get the info only if the current version's etag doesn't match.
- :returns:
- Information about the file or folder.
- :raises: :class:`BoxAPIException` if the specified etag matches the latest version of the item.
- """
- # pylint:disable=arguments-differ,arguments-renamed
- self.validate_item_id(self._object_id)
- headers = {'If-None-Match': etag} if etag is not None else None
- return super().get(fields=fields, headers=headers, **kwargs)
-
- @api_call
- def remove_shared_link(self, *, etag: Optional[str] = None, **kwargs: Any) -> bool:
- """
- Baseclass override.
-
- :param etag:
- If specified, instruct the Box API to delete the link only if the current version's etag matches.
- :param kwargs:
- Used to fulfill the contract of overriden method
- :returns:
- Whether or not the update was successful.
- :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
- """
- # pylint:disable=arguments-differ
- return super().remove_shared_link(etag=etag)
-
- @api_call
- def delete(self, *, params: dict = None, etag: Optional[str] = None, **kwargs) -> bool:
- """Delete the item.
-
- :param params:
- Additional parameters to send with the request.
- :param etag:
- If specified, instruct the Box API to delete the item only if the current version's etag matches.
- :returns:
- Whether or not the delete was successful.
- :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
- """
- # pylint:disable=arguments-differ,arguments-renamed
- self.validate_item_id(self._object_id)
- headers = {'If-Match': etag} if etag is not None else None
- return super().delete(params=params, headers=headers, **kwargs)
-
- def metadata(self, scope: str = 'global', template: str = 'properties') -> Metadata:
- """
- Instantiate a :class:`Metadata` object associated with this item.
-
- :param scope:
- Scope of the metadata. Must be either 'global' or 'enterprise'.
- :param template:
- The name of the metadata template.
- See https://developer.box.com/en/reference/resources/metadata/ for more details.
- :return:
- A new metadata instance associated with this item.
- """
- self.validate_item_id(self._object_id)
- return Metadata(self._session, self, scope, template)
-
- def get_all_metadata(self) -> MarkerBasedDictCollection:
- """
- Get all metadata attached to the item.
- """
- self.validate_item_id(self._object_id)
- return MarkerBasedDictCollection(
- session=self._session,
- url=self.get_url('metadata'),
- limit=None,
- marker=None,
- return_full_pages=False,
- )
-
- @api_call
- def get_watermark(self) -> 'Watermark':
- """
- Return the watermark info for a Box file
-
- :return:
- Watermark object.
- """
- self.validate_item_id(self._object_id)
- url = self.get_url('watermark')
- box_response = self._session.get(url)
- response = box_response.json()
- return self.translator.get('watermark')(response['watermark'])
-
- @api_call
- def apply_watermark(self) -> 'Watermark':
- """
- Apply watermark on a Box file
-
- :return:
- Watermark object.
- """
- self.validate_item_id(self._object_id)
- url = self.get_url('watermark')
- body_attributes = {
- 'watermark': {
- 'imprint': 'default'
- }
- }
- box_response = self._session.put(url, data=json.dumps(body_attributes))
- response = box_response.json()
- return self.translator.get('watermark')(response['watermark'])
-
- @api_call
- def delete_watermark(self) -> bool:
- """
- Deletes the watermark info for a Box file
-
- :return:
- Whether or not the delete succeeded.
- """
- self.validate_item_id(self._object_id)
- url = self.get_url('watermark')
- box_response = self._session.delete(url, expect_json_response=False)
- return box_response.ok
-
- @api_call
- def collaborate(
- self,
- accessible_by: Union['User', 'Group'],
- role: str,
- can_view_path: Optional[bool] = None,
- notify: Optional[bool] = None,
- fields: Iterable[str] = None
- ) -> 'Collaboration':
- """Collaborate user or group onto a Box item.
-
- :param accessible_by:
- An object containing the collaborator.
- :param role:
- The permission level to grant the collaborator.
- :param can_view_path:
- Indicates whether the user can view the path of the item collaborated into. This can only be set for
- collaborations on folders.
- :param notify:
- Determines if the collaborator should receive a notification for the collaboration.
- :param fields:
- List of fields to request.
- :return:
- The new collaboration
- """
- self.validate_item_id(self._object_id)
- url = self._session.get_url('collaborations')
- body = {
- 'item': {
- 'type': self.object_type,
- 'id': self.object_id,
- },
- 'accessible_by': {
- 'type': accessible_by.object_type,
- 'id': accessible_by.object_id,
- },
- 'role': role,
- }
- if can_view_path is not None:
- body['can_view_path'] = can_view_path
- params = {}
- if fields is not None:
- params['fields'] = ','.join(fields)
- if notify is not None:
- params['notify'] = notify
- response = self._session.post(url, data=json.dumps(body), params=params).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def collaborate_with_login(
- self,
- login: str,
- role: str,
- can_view_path: Optional[bool] = None,
- notify: Optional[bool] = None,
- fields: Iterable[str] = None
- ) -> 'Collaboration':
- """Collaborate user onto a Box item with the user login.
-
- :param login:
- The email address of the person to grant access to.
- :param role:
- The permission level to grant the collaborator.
- :param can_view_path:
- Indicates whether the user can view the path of the folder collaborated into.
- :param notify:
- Determines if the collaborator should receive a notification for the collaboration.
- :param fields:
- List of fields to request.
- :return:
- The new collaboration with the user login
- """
- self.validate_item_id(self._object_id)
- url = self._session.get_url('collaborations')
- body = {
- 'item': {
- 'type': self.object_type,
- 'id': self.object_id,
- },
- 'accessible_by': {
- 'type': 'user',
- 'login': login,
- },
- 'role': role,
- }
- if can_view_path is not None:
- body['can_view_path'] = can_view_path
- params = {}
- if fields is not None:
- params['fields'] = ','.join(fields)
- if notify is not None:
- params['notify'] = notify
- response = self._session.post(url, data=json.dumps(body), params=params).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_collaborations(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the collaboration.
-
- :param limit:
- The maximum number of items to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start returning items from when using marker-based paging.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the collaboration.
- """
- self.validate_item_id(self._object_id)
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('collaborations'),
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- def add_classification(self, classification: str) -> str:
- """
- Applies metadata classification for the specified :class:`File` or :class:`Folder` object.
-
- :param classification:
- The classification to add to the :class:`File` or :class:`Folder`
- :return:
- The classification added to the :class:`File` or :class:`Folder.
- """
- classification_metadata = {
- 'Box__Security__Classification__Key': classification,
- }
- metadata_classification = self.metadata(
- scope='enterprise',
- template=self._classification_template_key
- ).create(classification_metadata)
- return metadata_classification['Box__Security__Classification__Key']
-
- def update_classification(self, classification: str) -> str:
- """
- Updates metadata classification for the specified :class:`File` or :class:`Folder` object.
-
- :param classification:
- The classification to add to the :class:`File` or :class:`Folder`
- :return:
- The classification updated on the :class:`File` or :class:`Folder.
- """
- classification_metadata = self.metadata('enterprise', self._classification_template_key)
- updates = classification_metadata.start_update()
- updates.add('/Box__Security__Classification__Key', classification)
- metadata_classification = classification_metadata.update(updates)
- return metadata_classification['Box__Security__Classification__Key']
-
- def set_classification(self, classification: str) -> str:
- """
- Attempts to add a metadata classification to a :class:`File` or :class:`Folder`, if classification exists, then
- do update.
-
- :param classification:
- The classification to add to the :class:`File` or :class:`Folder`
- :return:
- The classification set on the :class:`File` or :class:`Folder.
- """
- classification_metadata = {
- 'Box__Security__Classification__Key': classification,
- }
- return self.metadata(
- scope='enterprise',
- template=self._classification_template_key
- ).set(metadata=classification_metadata)['Box__Security__Classification__Key']
-
- def get_classification(self) -> Optional[str]:
- """
- Retrieves the classification specified for the :class:`File` or :class:`Folder`
-
- :return:
- The classification on the :class:`File` or :class:`Folder.
- """
- try:
- classification = self.metadata('enterprise', self._classification_template_key).get()
- except BoxAPIException as err:
- if err.status == 404 and err.code == "instance_not_found":
- return None
- raise
- return classification.get('Box__Security__Classification__Key', None)
-
- def remove_classification(self) -> bool:
- """
- Removes a metadata classification from a :class:`File` or :class:`Folder`.
-
- :returns:
- Whether or not the delete was successful.
- """
- return self.metadata('enterprise', self._classification_template_key).delete()
diff --git a/boxsdk/object/legal_hold.py b/boxsdk/object/legal_hold.py
deleted file mode 100644
index cd1f917d1..000000000
--- a/boxsdk/object/legal_hold.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from typing import Any
-
-from .base_object import BaseObject
-
-
-class LegalHold(BaseObject):
-
- """Represents the legal hold policy for a file version"""
- _item_type = 'legal_hold'
-
- def get_url(self, *args: Any) -> str:
- return self._session.get_url('file_version_legal_holds', self._object_id, *args)
diff --git a/boxsdk/object/legal_hold_policy.py b/boxsdk/object/legal_hold_policy.py
deleted file mode 100644
index 90d863c90..000000000
--- a/boxsdk/object/legal_hold_policy.py
+++ /dev/null
@@ -1,120 +0,0 @@
-import json
-from typing import Any, Union, TYPE_CHECKING, Optional, Iterable
-
-from .base_object import BaseObject
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.object.user import User
- from boxsdk.object.folder import Folder
- from boxsdk.object.file import File
- from boxsdk.object.file_version import FileVersion
- from boxsdk.object.legal_hold_policy_assignment import LegalHoldPolicyAssignment
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class LegalHoldPolicy(BaseObject):
- """Represents a Box legal_hold_policy"""
-
- _item_type = 'legal_hold_policy'
-
- def get_url(self, *args: Any) -> str:
- return self._session.get_url('legal_hold_policies', self._object_id, *args)
-
- @api_call
- def assign(self, assignee: Union['FileVersion', 'File', 'Folder', 'User']) -> 'LegalHoldPolicyAssignment':
- """Assign legal hold policy
-
- :param assignee:
- The `file_version`, `file`, `folder`, or `user` to assign the legal hold policy to.
- :returns:
- A legal hold policy assignment object
- """
- url = self._session.get_url('legal_hold_policy_assignments')
- body = {
- 'policy_id': self.object_id,
- 'assign_to': {
- 'type': assignee.object_type,
- 'id': assignee.object_id
- }
- }
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(
- self._session,
- response,
- )
-
- @api_call
- def get_assignments(
- self,
- assign_to_type: Optional[str] = None,
- assign_to_id: Optional[str] = None,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the legal hold policy assignment using limit-offset paging.
-
- :param assign_to_type:
- Filter assignments of this type only. Can be `file_version`, `file`, `folder`, or `user`
- :param assign_to_id:
- Filter assignments to this ID only
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from
- :param fields:
- List of fields to request
- :returns:
- An iterator of the entries in the legal hold policy assignment
- """
- additional_params = {
- 'policy_id': self.object_id,
- }
- if assign_to_type is not None:
- additional_params['assign_to_type'] = assign_to_type
- if assign_to_id is not None:
- additional_params['assign_to_id'] = assign_to_id
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self._session.get_url('legal_hold_policy_assignments'),
- additional_params=additional_params,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def get_file_version_legal_holds(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get legal holds for a file version.
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param marker:
- The paging marker to start paging from
- :param fields:
- List of fields to request
- :returns:
- An iterator of the entries in the file version legal holds
- """
- additional_params = {
- 'policy_id': self.object_id,
- }
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self._session.get_url('file_version_legal_holds'),
- additional_params=additional_params,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
diff --git a/boxsdk/object/legal_hold_policy_assignment.py b/boxsdk/object/legal_hold_policy_assignment.py
deleted file mode 100644
index db760aafa..000000000
--- a/boxsdk/object/legal_hold_policy_assignment.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_object import BaseObject
-
-
-class LegalHoldPolicyAssignment(BaseObject):
-
- """Represents the legal hold policy assignment"""
- _item_type = 'legal_hold_policy_assignment'
diff --git a/boxsdk/object/metadata.py b/boxsdk/object/metadata.py
deleted file mode 100644
index 674b10a1a..000000000
--- a/boxsdk/object/metadata.py
+++ /dev/null
@@ -1,194 +0,0 @@
-import json
-from typing import TYPE_CHECKING, List, Any
-from boxsdk.object.base_endpoint import BaseEndpoint
-from boxsdk.exception import BoxAPIException
-from ..util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.session.session import Session
- from boxsdk.object.base_object import BaseObject
-
-
-class MetadataUpdate:
- """
- Helper class for updating Box metadata.
- See https://developer.box.com/en/guides/metadata/instances/update/ for more details.
- See http://jsonpatch.com/ for details about JSON patch.
- """
- def __init__(self):
- self._ops = []
-
- @property
- def ops(self) -> List[dict]:
- """
- Get a list of json patch operations in this update.
-
- :return:
- The list of json patch operations in this update.
- """
- return self._ops
-
- def add(self, path: str, value: str) -> None:
- """
- Insert an add operation to this metadata update.
-
- :param path:
- JSON pointer specifying where to add the new value.
- :param value:
- The value to add to the metadata document.
- """
- self._ops.append({'op': 'add', 'path': path, 'value': value})
-
- def remove(self, path: str, old_value: str = None) -> None:
- """
- Insert a remove operation to this metadata update.
-
- :param path:
- JSON pointer specifying where to remove the value from.
- :param old_value:
- If specified, only remove the key/value pair if the current value is equal to oldValue.
- """
- if old_value is not None:
- self._ops.append({'op': 'test', 'path': path, 'value': old_value})
- self._ops.append({'op': 'remove', 'path': path})
-
- def update(self, path: str, value: str, old_value: str = None) -> None:
- """
- Insert an update operation to this metadata update.
-
- :param path:
- JSON pointer specifying where the value is in the metadata document that should be updated.
- :param value:
- The updated value.
- :param old_value:
- If specified, only update the key/value pair if the current value is equal to oldValue.
- """
- if old_value is not None:
- self._ops.append({'op': 'test', 'path': path, 'value': old_value})
- self._ops.append({'op': 'replace', 'path': path, 'value': value})
-
- def test(self, path: str, value: str) -> None:
- """
- Insert a test operation to this metadata update.
- A test operation can invalidate the following operation if the value at the specified path does not match
- the supplied value.
-
- :param path:
- JSON pointer specifying where the value is in the metadata document to test.
- :param value:
- The value to match against.
- """
- self._ops.append({'op': 'test', 'path': path, 'value': value})
-
-
-class Metadata(BaseEndpoint):
- def __init__(self, session: 'Session', box_object: 'BaseObject', scope: str, template: str):
- """
- :param session:
- The Box session used to make requests.
- :param box_object:
- The Box object this metadata instance will be associated with.
- :param scope:
- Scope of the metadata. Must be either 'global' or 'enterprise'.
- :param template:
- The name of the metadata template.
- See https://developer.box.com/en/guides/metadata/ for more details.
- """
- super().__init__(session)
- self._object = box_object
- self._scope = scope
- self._template = template
-
- def get_url(self, *args: Any) -> str:
- """ Base class override. """
- return self._object.get_url('metadata', self._scope, self._template)
-
- @staticmethod
- def start_update() -> MetadataUpdate:
- """
- Get a :class:`MetadataUpdate` for use with the :meth:`update` method.
-
- :return:
- A metadata update object that can be used to update this metadata object.
- """
- return MetadataUpdate()
-
- @api_call
- def update(self, metadata_update: MetadataUpdate) -> 'Metadata':
- """
- Update the key/value pairs associated with this metadata object.
- See https://developer.box.com/en/guides/metadata/instances/update/ for more details.
-
- :param metadata_update:
- A metadata update object containing the changes that should be made to the metadata.
- :return:
- A dictionary containing the updated key/value pairs for this metadata object.
- """
- return self._session.put(
- self.get_url(),
- data=json.dumps(metadata_update.ops),
- headers={b'Content-Type': b'application/json-patch+json'},
- ).json()
-
- @api_call
- def get(self) -> 'Metadata':
- """
- Get the key/value pairs that make up this metadata instance.
-
- :return:
- A dictionary containing the key/value pairs for this metadata object.
- """
- return self._session.get(self.get_url()).json()
-
- @api_call
- def delete(self) -> bool:
- """
- Delete the metadata object.
-
- :returns:
- Whether or not the delete was successful.
- """
- return self._session.delete(self.get_url()).ok
-
- @api_call
- def create(self, metadata: dict) -> 'Metadata':
- """
- Create the metadata instance on Box. If the instance already exists, use :meth:`update` instead.
-
- :param metadata:
- The key/value pairs to be stored in this metadata instance on Box.
- :return:
- A dictionary containing the key/value pairs for this metadata object.
- """
- return self._session.post(
- self.get_url(),
- data=json.dumps(metadata),
- headers={b'Content-Type': b'application/json'},
- ).json()
-
- @api_call
- def set(self, metadata: dict) -> 'Metadata':
- """
- Set the metadata instance on a :class:`Folder` or :class:`File`. Attempts to first create metadata on a
- :class:`Folder` or :class:`File`. If metadata already exists then attempt an update.
-
- :param metadata:
- The key/value pairs to be stored in this metadata instance on Box.
- :return:
- A dictionary containing the key/value pairs for this metadata object.
- """
- try:
- metadata_value = self.create(metadata)
- except BoxAPIException as err:
- if err.status == 409:
- updates = self.start_update()
- for key, value in metadata.items():
- updates.add('/' + key, value)
- metadata_value = self.update(updates)
- else:
- raise
- return metadata_value
-
- def clone(self, session: 'Session' = None) -> 'Metadata':
- """ Base class override. """
- return self.__class__(session or self._session, self._object, self._scope, self._template)
diff --git a/boxsdk/object/metadata_cascade_policy.py b/boxsdk/object/metadata_cascade_policy.py
deleted file mode 100644
index defd5964c..000000000
--- a/boxsdk/object/metadata_cascade_policy.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import json
-from typing import Any
-
-from .base_object import BaseObject
-from ..util.text_enum import TextEnum
-from ..util.api_call_decorator import api_call
-
-
-class CascadePolicyConflictResolution(TextEnum):
- PRESERVE_EXISTING = 'none'
- OVERWRITE = 'overwrite'
-
-
-class MetadataCascadePolicy(BaseObject):
- """Represents a metadata cascade policy, which applies folder metadata to files in that folder."""
-
- _item_type = 'metadata_cascade_policy'
-
- def get_url(self, *args: Any) -> str:
- """
- Base class override to account for the correct pluralization.
-
- """
- return self._session.get_url('metadata_cascade_policies', self.object_id, *args)
-
- @api_call
- def force_apply(self, conflict_resolution: CascadePolicyConflictResolution) -> bool:
- """
- Applies the metadata values on the folder to all files within the folder. The conflict resolution
- parameter determines how conflicts when the same metadata template is already applied to a file will be
- handled; either the file's existing values or the folder values can be given precendence.
-
- :param conflict_resolution:
- How conflicting metadata values should be reolved
- :returns:
- Whether the force application succeeded.
- """
- url = self.get_url('apply')
- body = {
- 'conflict_resolution': conflict_resolution,
- }
- response = self._session.post(url, data=json.dumps(body), expect_json_response=False)
- return response.ok
diff --git a/boxsdk/object/metadata_template.py b/boxsdk/object/metadata_template.py
deleted file mode 100644
index 750bbd74e..000000000
--- a/boxsdk/object/metadata_template.py
+++ /dev/null
@@ -1,294 +0,0 @@
-from typing import TYPE_CHECKING, List, Optional, Iterable, Any
-from .base_object import BaseObject
-from ..util.api_call_decorator import api_call
-from ..util.text_enum import TextEnum
-
-if TYPE_CHECKING:
- from boxsdk.session.session import Session
-
-
-class MetadataTemplateUpdate:
- """Represents a set of update operations to a metadata template."""
-
- def __init__(self):
- super().__init__()
- self._ops = []
-
- def json(self) -> list:
- return self._ops
-
- def add_enum_option(self, field_key: str, option_key: str) -> None:
- """
- Adds a new option to an enum field.
-
- :param field_key:
- The key of the template field to add the option to
- :param option_key:
- The option to add
- """
- self.add_operation({
- 'op': 'addEnumOption',
- 'fieldKey': field_key,
- 'data': {
- 'key': option_key,
- },
- })
-
- def add_field(self, field: 'MetadataField') -> None:
- """
- Add a new field to the template.
-
- :param field:
- The new field to add
- """
- self.add_operation({
- 'op': 'addField',
- 'data': field.json(),
- })
-
- def edit_template(self, data: dict) -> None:
- """
- Edit top-level template properties.
-
- :param data:
- The properties to modify
- """
- self.add_operation({
- 'op': 'editTemplate',
- 'data': data,
- })
-
- def reorder_enum_options(self, field_key: str, option_keys: List[str]) -> None:
- """
- Reorders the options in an enum field, which affects their display in UI.
-
- :param field_key:
- The key of the enum field to reorder
- :param option_keys:
- The option keys in the desired order
- """
- self.add_operation({
- 'op': 'reorderEnumOptions',
- 'fieldKey': field_key,
- 'enumOptionKeys': option_keys,
- })
-
- def reorder_fields(self, field_keys: List[str]) -> None:
- """
- Reorders the fields in a metadata template, which affects their display in UI.
-
- :param field_keys:
- The field keys in the desired order
- """
- self.add_operation({
- 'op': 'reorderFields',
- 'fieldKeys': field_keys,
- })
-
- def edit_field(self, field_key: str, field: 'MetadataField') -> None:
- """
- Edits a field in the template.
-
- :param field_key:
- The key of the field to update
- :param field:
- The updated field values
- """
- self.add_operation({
- 'op': 'editField',
- 'fieldKey': field_key,
- 'data': field.json(),
- })
-
- def edit_enum_option_key(self, field_key: str, old_option_key: str, new_option_key: str) -> None:
- """
- Change the key of an enum field option.
-
- :param field_key:
- The key of the template field in which the option appears
- :param old_option_key:
- The old option key
- :param new_option_key:
- The new option key
- """
- self.add_operation({
- 'op': 'editEnumOption',
- 'fieldKey': field_key,
- 'enumOptionKey': old_option_key,
- 'data': {
- 'key': new_option_key,
- },
- })
-
- def remove_enum_option(self, field_key: str, option_key: str) -> None:
- """
- Remove an option from an enum field.
-
- :param field_key:
- The key of the template field in which the option appears
- :param option_key:
- The key of the enum option to remove
- """
- self.add_operation({
- 'op': 'removeEnumOption',
- 'fieldKey': field_key,
- 'enumOptionKey': option_key,
- })
-
- def remove_field(self, field_key: str) -> None:
- """
- Remove a field from the metadata template.
-
- :param field_key:
- The key of the field to remove
- """
- self.add_operation({
- 'op': 'removeField',
- 'fieldKey': field_key,
- })
-
- def add_operation(self, operation: dict) -> None:
- """
- Adds an update operation.
-
- :param operation:
- The operation to add.
- """
- self._ops.append(operation)
-
-
-class MetadataFieldType(TextEnum):
- STRING = 'string'
- DATE = 'date'
- ENUM = 'enum'
- MULTISELECT = 'multiSelect'
- FLOAT = 'float'
-
-
-class MetadataField:
- """Represents a metadata field when creating or updating a metadata template."""
-
- def __init__(
- self,
- field_type: MetadataFieldType,
- display_name: str,
- key: Optional[str] = None,
- options: Iterable[str] = None,
- description: Optional[str] = None,
- hidden: Optional[bool] = None
- ):
- """
- :param field_type:
- The type of the metadata field
- :param display_name:
- The human-readable name of the metadata field
- :param key:
- The machine-readable key for the metadata field
- :param options:
- For 'enum' or 'multiSelect' fields, the selectable options
- :param description:
- A description of the field
- :param hidden:
- Whether this field is hidden in the UI for the user and can only be set through the API instead
- """
- super().__init__()
- self.type = field_type
- self.name = display_name
- self.key = key
- self.options = options
- self.description = description
- self.hidden = hidden
-
- def json(self) -> dict:
- """
- Returns the correct representation of the template field for the API.
- """
- values = {}
-
- if self.type is not None:
- values['type'] = self.type
-
- if self.name is not None:
- values['displayName'] = self.name
-
- if self.key is not None:
- values['key'] = self.key
-
- if self.type in ['enum', 'multiSelect']:
- values['options'] = [{'key': opt} for opt in self.options or ()]
-
- if self.description is not None:
- values['description'] = self.description
-
- if self.hidden is not None:
- values['hidden'] = self.hidden
-
- return values
-
-
-class MetadataTemplate(BaseObject):
- """Represents a metadata template, which contains the the type information for associated metadata fields."""
-
- _item_type = 'metadata_template'
- _untranslated_fields = ('fields',)
- _scope = None
- _template_key = None
-
- def __init__(self, session: 'Session', object_id: Optional[str], response_object: Optional[dict] = None):
- """
- :param session:
- The Box session used to make requests.
- :param object_id:
- The primary GUID key for the metadata template
- :param response_object:
- A JSON object representing the object returned from a Box API request. This should
- contain 'scope' and 'templateKey' properties if the instance is being constructed without
- a primary GUID object_id.
- """
- super().__init__(session, object_id, response_object)
- if response_object:
- self._scope = response_object.get('scope', None)
- self._template_key = response_object.get('templateKey', None)
- elif not object_id:
- raise ValueError('Metadata template must be constructed with an ID or scope and templateKey')
-
- @property
- def scope(self) -> Optional[str]:
- return self._scope
-
- @property
- def template_key(self) -> Optional[str]:
- return self._template_key
-
- def get_url(self, *args: Any) -> str:
- """
- Base class override, since metadata templates have a weird compound ID and non-standard URL format
- """
- if self._scope and self._template_key:
- return self._session.get_url('metadata_templates', self._scope, self._template_key, 'schema', *args)
-
- return super().get_url(*args)
-
- @staticmethod
- def start_update() -> MetadataTemplateUpdate:
- """
- Start an update operation on the template.
-
- :returns:
- An update object to collect the desired update operations.
- """
- return MetadataTemplateUpdate()
-
- @api_call
- def update_info(self, *, updates: MetadataTemplateUpdate, **kwargs) -> 'MetadataTemplate':
- # pylint: disable=arguments-differ
- """
- Update a metadata template with a set of update operations.
-
- :param updates:
- The update operations to apply to the template
- :returns:
- The updated metadata template object
- """
- # pylint: disable=arguments-differ
- return super().update_info(data=updates.json(), **kwargs)
diff --git a/boxsdk/object/recent_item.py b/boxsdk/object/recent_item.py
deleted file mode 100644
index 8f3e29d8f..000000000
--- a/boxsdk/object/recent_item.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_api_json_object import BaseAPIJSONObject
-
-
-class RecentItem(BaseAPIJSONObject):
- """Represents a single recent item accessed by a Box user."""
-
- _item_type = 'recent_item'
diff --git a/boxsdk/object/retention_policy.py b/boxsdk/object/retention_policy.py
deleted file mode 100644
index 5541cb603..000000000
--- a/boxsdk/object/retention_policy.py
+++ /dev/null
@@ -1,95 +0,0 @@
-import json
-from typing import Any, Union, TYPE_CHECKING, Iterable, Optional
-from .base_object import BaseObject
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.object.metadata_template import MetadataTemplate
- from boxsdk.object.enterprise import Enterprise
- from boxsdk.object.folder import Folder
- from boxsdk.object.retention_policy_assignment import RetentionPolicyAssignment
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class RetentionPolicy(BaseObject):
- """Represents a Box retention policy."""
- _item_type = 'retention_policy'
-
- def get_url(self, *args: Any) -> str:
- """
- Returns the url for this retention policy.
- """
- return self._session.get_url('retention_policies', self._object_id, *args)
-
- @api_call
- def assign(
- self,
- assignee: Union['Folder', 'Enterprise', 'MetadataTemplate'],
- fields: Iterable[str] = None,
- start_date_field: Optional[str] = None,
- ) -> 'RetentionPolicyAssignment':
- """Assign a retention policy to a Box item
-
- :param assignee:
- The item to assign the retention policy on.
- :param fields:
- List of fields to request.
- :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.
- :returns:
- A :class:`RetentionPolicyAssignment` object.
- """
- url = self._session.get_url('retention_policy_assignments')
- body = {
- 'policy_id': self.object_id,
- 'assign_to': {
- 'type': assignee.object_type,
- 'id': assignee.object_id,
- }
- }
- params = {}
- if fields is not None:
- params['fields'] = ','.join(fields)
- if start_date_field is not None:
- body['start_date_field'] = start_date_field
- response = self._session.post(url, data=json.dumps(body), params=params).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def assignments(
- self,
- assignment_type: Optional[str] = None,
- limit: Optional[int] = None,
- marker: Optional[str] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """Get the assignments for the retention policy.
-
- :param assignment_type:
- The type of retention policy assignment to retrieve. Can be set to 'folder', 'enterprise', or 'metadata_template'.
- :param limit:
- The maximum number of items to return.
- :param marker:
- The position marker at which to begin the response.
- :param fields:
- List of fields to request.
- :returns:
- An iterable of assignments in the retention policy.
- """
- additional_params = {}
- if assignment_type is not None:
- additional_params['assignment_type'] = assignment_type
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('assignments'),
- additional_params=additional_params,
- limit=limit,
- marker=marker,
- fields=fields,
- return_full_pages=False,
- )
diff --git a/boxsdk/object/retention_policy_assignment.py b/boxsdk/object/retention_policy_assignment.py
deleted file mode 100644
index ab79d0276..000000000
--- a/boxsdk/object/retention_policy_assignment.py
+++ /dev/null
@@ -1,50 +0,0 @@
-from typing import Optional
-
-from .base_object import BaseObject
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..util.api_call_decorator import api_call
-
-
-class RetentionPolicyAssignment(BaseObject):
- """Represents a Box retention policy assignment."""
- _item_type = 'retention_policy_assignment'
-
- @api_call
- def get_files_under_retention(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None
- ) -> 'MarkerBasedObjectCollection':
- """
- Retrieves all files under retention for a retention policy assignment
-
- :param limit: the limit of retrieved entries per page. Default 100.
- :param marker: the paging marker to start paging from.
- :return: An iterator of the entries with information about all files under retention.
- """
- return MarkerBasedObjectCollection(
- self.session,
- self.get_url('files_under_retention'),
- limit=limit,
- marker=marker
- )
-
- @api_call
- def get_file_versions_under_retention(
- self,
- limit: Optional[int] = None,
- marker: Optional[str] = None
- ) -> 'MarkerBasedObjectCollection':
- """
- Retrieves all file versions under retention for a retention policy assignment
-
- :param limit: the limit of retrieved entries per page. Default 100.
- :param marker: the paging marker to start paging from.
- :return: An iterator of the entries with information about all files uversions nder retention.
- """
- return MarkerBasedObjectCollection(
- self.session,
- self.get_url('file_versions_under_retention'),
- limit=limit,
- marker=marker
- )
diff --git a/boxsdk/object/search.py b/boxsdk/object/search.py
deleted file mode 100644
index b934d91c5..000000000
--- a/boxsdk/object/search.py
+++ /dev/null
@@ -1,425 +0,0 @@
-import json
-from typing import Optional, List, Any, Iterable, TYPE_CHECKING, Tuple, Union
-from .base_endpoint import BaseEndpoint
-from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..util.api_call_decorator import api_call
-from ..util.deprecation_decorator import deprecated_param
-from ..util.text_enum import TextEnum
-
-if TYPE_CHECKING:
- from boxsdk.object.folder import Folder
- from boxsdk.object.user import User
- from boxsdk.object.item import Item
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class SearchScope(TextEnum):
- """Enum of possible serach scopes."""
- USER = 'user_content'
- ENTERPRISE = 'enterprise_content'
-
-
-class TrashContent(TextEnum):
- """Enum of trash content values."""
- NONE = 'non_trashed_only'
- ONLY = 'trashed_only'
-
-
-class MetadataSearchFilter:
- """
- Helper class to encapsulate a single search filter. A search filter can only search against one template,
- but can filter on many fields.
- See :class:`MetadataSearchFilters`.
- """
- def __init__(self, template_key: str, scope: str):
- """
- :param template_key:
- The key of the template to search on
- :param scope:
- The scope of the template to search on
- """
- self._template_key = template_key
- self._scope = scope
- self._field_filters = {}
-
- def as_dict(self) -> dict:
- """
- Returns a `dict` representation of this object
-
- :return:
- The `dict` representation
- """
- return {
- 'templateKey': self._template_key,
- 'scope': self._scope,
- 'filters': self._field_filters
- }
-
- def add_value_based_filter(self, field_key: str, value: str) -> None:
- """
- Add a value-based filter (used for token-based search on string fields, and exact match search on all other fields)
-
- :param field_key:
- The field key to filter on
- :param value:
- The value to use to filter
- """
- self._field_filters.update({field_key: value})
-
- def add_range_filter(
- self,
- field_key: str,
- gt_value: Union[str, int, float] = None,
- lt_value: Union[str, int, float] = None
- ) -> None:
- """
- Add a range filter (used for ranged searches on numbers and dates)
-
- :param field_key:
- The field key to filter on
- :param gt_value:
- The lower bound of the range filter (inclusive)
- :param lt_value:
- The upper bound of the range filter (inclusive)
- """
- range_part = {}
- if gt_value:
- range_part['gt'] = gt_value
- if lt_value:
- range_part['lt'] = lt_value
- if not range_part:
- raise ValueError('Should specify gt and/or lt')
- self._field_filters.update({field_key: range_part})
-
-
-class MetadataSearchFilters:
- """
- Helper class to encapsulate a list of metadata search filter params (mdfilters API param)
- See https://developers.box.com/metadata-api/#search for more details
- """
- def __init__(self):
- self._filters = []
-
- def as_list(self) -> List[dict]:
- """
- Get a list of filters from this object to use as a parameter in the Search API
-
- :return:
- The list of filters
- """
- return [metadata_filter.as_dict() for metadata_filter in self._filters]
-
- def add_filter(self, metadata_filter: MetadataSearchFilter) -> None:
- """
- Add a filter to this object. Note that the API only supports one filter.
-
- :param metadata_filter:
- The filter to add
- """
- self._filters.append(metadata_filter)
-
-
-class Search(BaseEndpoint):
- """Search Box for files and folders."""
-
- def get_url(self, *args: Any) -> str:
- """
- Gets the search endpoint URL.
-
- :return:
- The search endpoint URL.
- """
- return super().get_url('search', *args)
-
- @staticmethod
- def start_metadata_filters() -> MetadataSearchFilters:
- """
- Get a :class:`MetadataSearchFilters` that represents a set of metadata filters.
-
- :return:
- The new :class:`MetadataSearchFilters`
- """
- return MetadataSearchFilters()
-
- @staticmethod
- def make_single_metadata_filter(template_key: str, scope: str) -> MetadataSearchFilter:
- """
- Make a single :class:`MetadataSearchFilter` that represents a filter on a template. It must be
- added to a :class:`MetadataSearchFilters`.
- :param template_key:
- The key of the template to filter on
- :param scope:
- The scope of the template to filter on
- :return:
- The new :class:`MetadataSearchFilter`
- """
- return MetadataSearchFilter(template_key, scope)
-
- @api_call
- # pylint: disable=too-many-arguments,too-many-locals,too-many-branches
- def query(
- self,
- query: str,
- limit: int = None,
- offset: int = 0,
- ancestor_folders: Iterable['Folder'] = None,
- file_extensions: Iterable[str] = None,
- metadata_filters: MetadataSearchFilters = None,
- result_type: str = None,
- content_types: Iterable[str] = None,
- scope: Optional[str] = None,
- created_at_range: Tuple[Optional[str], Optional[str]] = None,
- updated_at_range: Tuple[Optional[str], Optional[str]] = None,
- size_range: Tuple[Optional[int], Optional[int]] = None,
- owner_users: Iterable['User'] = None,
- trash_content: Optional[str] = None,
- fields: Iterable[str] = None,
- sort: Optional[str] = None,
- direction: Optional[str] = None,
- **kwargs: Any
- ) -> Iterable['Item']:
- """
- Search Box for items matching the given query.
-
- :param query:
- The string to search for.
- :param limit:
- The maximum number of items to return.
- :param offset:
- The search result at which to start the response.
- :param ancestor_folders:
- Folder ids to limit the search to.
- :param file_extensions:
- File extensions to limit the search to.
- :param metadata_filters:
- Filters used for metadata search
- :param result_type:
- Which type of result you want. Can be file or folder.
- :param content_types:
- Which content types to search. Valid types include name, description, file_content, comments, and tags.
- :param scope:
- The scope of content to search over
- :param created_at_range:
- A tuple of the form (lower_bound, upper_bound) for the creation datetime of items to search.
- :param updated_at_range:
- A tuple of the form (lower_bound, upper_bound) for the update datetime of items to search.
- :param size_range:
- A tuple of the form (lower_bound, upper_bound) for the size in bytes of items to search.
- :param owner_users:
- Owner users to filter content by; only content belonging to these users will be returned.
- :param trash_content:
- Whether to search trashed or non-trashed content.
- :param fields:
- Fields to include on the returned items.
- :param sort:
- What to sort the search results by. Currently `modified_at`
- :param direction:
- The direction to display the sorted search results. Can be set to `DESC` for descending or `ASC` for ascending.
- :return:
- The collection of items that match the search query.
- """
- url = self.get_url()
- additional_params = {'query': query}
- if ancestor_folders is not None:
- additional_params['ancestor_folder_ids'] = ','.join([folder.object_id for folder in ancestor_folders])
- if file_extensions is not None:
- additional_params['file_extensions'] = ','.join(file_extensions)
- if metadata_filters is not None:
- additional_params['mdfilters'] = json.dumps(metadata_filters.as_list())
- if content_types is not None:
- additional_params['content_types'] = ','.join(content_types)
- if result_type is not None:
- additional_params['type'] = result_type
- if scope is not None:
- additional_params['scope'] = scope
- if created_at_range is not None:
- additional_params['created_at_range'] = f'{created_at_range[0] or ""},{created_at_range[1] or ""}'
- if updated_at_range is not None:
- additional_params['updated_at_range'] = f'{updated_at_range[0] or ""},{updated_at_range[1] or ""}'
- if size_range is not None:
- additional_params['size_range'] = f'{size_range[0] or ""},{size_range[1] or ""}'
- if owner_users is not None:
- additional_params['owner_user_ids'] = ','.join([user.object_id for user in owner_users])
- if trash_content is not None:
- additional_params['trash_content'] = trash_content
- if sort is not None:
- additional_params['sort'] = sort
- if direction is not None:
- additional_params['direction'] = direction
-
- additional_params.update(kwargs)
-
- return LimitOffsetBasedObjectCollection(
- self._session,
- url,
- limit=limit,
- offset=offset,
- fields=fields,
- additional_params=additional_params,
- return_full_pages=False,
- )
-
- @deprecated_param(name="use_index", position=5, message="Parameter will be ignored. See docs for details.")
- @api_call
- def metadata_query(
- self,
- from_template: str,
- ancestor_folder_id: str,
- query: Optional[str] = None,
- query_params: Optional[dict] = None,
- use_index: Optional[str] = None,
- order_by: List[dict] = None,
- marker: Optional[str] = None,
- limit: int = None,
- fields: Iterable[Optional[str]] = None
- ) -> 'BoxObjectCollection':
- # pylint:disable=unused-argument
- """Query Box items by their metadata.
-
- :param from_template:
- The template used in the query. Must be in the form scope.templateKey.
- :param ancestor_folder_id:
- The folder_id to which to restrain the query
- :param query:
- The logical expression of the query
- :param query_params:
- Required if query present. The arguments for the query.
- :param use_index is deprecated
- :param order_by:
- The field_key(s) to order on and the corresponding direction(s)
- :param marker:
- The marker to use for requesting the next page
- :param limit:
- Max results to return for a single request (0-100 inclusive)
- :param fields:
- List of fields to request
- :returns:
- An iterator of the item search results
- """
- url = super().get_url('metadata_queries/execute_read')
- data = {
- 'from': from_template,
- 'ancestor_folder_id': ancestor_folder_id
- }
- if query is not None:
- data['query'] = query
- if query_params is not None:
- data['query_params'] = query_params
- if order_by is not None:
- data['order_by'] = order_by
-
- return MarkerBasedObjectCollection(
- session=self._session,
- url=url,
- limit=limit,
- marker=marker,
- fields=fields,
- additional_params=data,
- return_full_pages=False,
- use_post=True
- )
-
- @api_call
- # pylint: disable=too-many-arguments,too-many-locals,too-many-branches
- def query_with_shared_links(
- self,
- query: str,
- limit: int = None,
- offset: int = 0,
- ancestor_folders: Iterable['Folder'] = None,
- file_extensions: Iterable[str] = None,
- metadata_filters: MetadataSearchFilters = None,
- result_type: str = None,
- content_types: Iterable[str] = None,
- scope: Optional[str] = None,
- created_at_range: Tuple[Optional[str], Optional[str]] = None,
- updated_at_range: Tuple[Optional[str], Optional[str]] = None,
- size_range: Tuple[Optional[int], Optional[int]] = None,
- owner_users: Iterable['User'] = None,
- trash_content: Optional[str] = None,
- fields: Iterable[str] = None,
- sort: Optional[str] = None,
- direction: Optional[str] = None,
- **kwargs: Any
- ) -> Iterable['Item']:
- """
- Search Box for items matching the given query. May also include items that are only accessible via recently used shared links.
-
- :param query:
- The string to search for.
- :param limit:
- The maximum number of items to return.
- :param offset:
- The search result at which to start the response.
- :param ancestor_folders:
- Folder ids to limit the search to.
- :param file_extensions:
- File extensions to limit the search to.
- :param metadata_filters:
- Filters used for metadata search
- :param result_type:
- Which type of result you want. Can be file or folder.
- :param content_types:
- Which content types to search. Valid types include name, description, file_content, comments, and tags.
- :param scope:
- The scope of content to search over
- :param created_at_range:
- A tuple of the form (lower_bound, upper_bound) for the creation datetime of items to search.
- :param updated_at_range:
- A tuple of the form (lower_bound, upper_bound) for the update datetime of items to search.
- :param size_range:
- A tuple of the form (lower_bound, upper_bound) for the size in bytes of items to search.
- :param owner_users:
- Owner users to filter content by; only content belonging to these users will be returned.
- :param trash_content:
- Whether to search trashed or non-trashed content.
- :param fields:
- Fields to include on the returned items.
- :param sort:
- What to sort the search results by. Currently `modified_at`
- :param direction:
- The direction to display the sorted search results. Can be set to `DESC` for descending or `ASC` for ascending.
- :return:
- The collection of items that match the search query.
- """
- url = self.get_url()
- additional_params = {'query': query, 'include_recent_shared_links': True}
- if ancestor_folders is not None:
- additional_params['ancestor_folder_ids'] = ','.join([folder.object_id for folder in ancestor_folders])
- if file_extensions is not None:
- additional_params['file_extensions'] = ','.join(file_extensions)
- if metadata_filters is not None:
- additional_params['mdfilters'] = json.dumps(metadata_filters.as_list())
- if content_types is not None:
- additional_params['content_types'] = ','.join(content_types)
- if result_type is not None:
- additional_params['type'] = result_type
- if scope is not None:
- additional_params['scope'] = scope
- if created_at_range is not None:
- additional_params['created_at_range'] = f'{created_at_range[0] or ""},{created_at_range[1] or ""}'
- if updated_at_range is not None:
- additional_params['updated_at_range'] = f'{updated_at_range[0] or ""},{updated_at_range[1] or ""}'
- if size_range is not None:
- additional_params['size_range'] = f'{size_range[0] or ""},{size_range[1] or ""}'
- if owner_users is not None:
- additional_params['owner_user_ids'] = ','.join([user.object_id for user in owner_users])
- if trash_content is not None:
- additional_params['trash_content'] = trash_content
- if sort is not None:
- additional_params['sort'] = sort
- if direction is not None:
- additional_params['direction'] = direction
-
- additional_params.update(kwargs)
-
- return LimitOffsetBasedObjectCollection(
- self._session,
- url,
- limit=limit,
- offset=offset,
- fields=fields,
- additional_params=additional_params,
- return_full_pages=False,
- )
diff --git a/boxsdk/object/sign_request.py b/boxsdk/object/sign_request.py
deleted file mode 100644
index c5e7e4493..000000000
--- a/boxsdk/object/sign_request.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from typing import Any
-
-from .base_object import BaseObject
-from ..util.api_call_decorator import api_call
-
-
-class SignRequest(BaseObject):
- """
- Represents a Sign Request used by Box Sign
- Sign Requests are used to request e-signatures on documents from signers.
- A Sign Request can refer to one or more Box Files and can be sent to one or more Box Sign Request Signers.
- """
- _item_type = 'sign-request'
-
- def get_url(self, *args: Any) -> str:
- """
- Returns the url for this sign request.
- """
- return self._session.get_url('sign_requests', self._object_id, *args)
-
- @api_call
- def cancel(self) -> 'SignRequest':
- """
- Cancels a sign request if it has not yet been signed or declined.
- Any outstanding signers will no longer be able to sign the document.
-
- :returns:
- The cancelled SignRequest object.
- """
- url = self.get_url('cancel')
- response = self._session.post(url).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def resend(self) -> bool:
- """
- Attempts to resend a Sign Request to all signers that have not signed yet.
- There is a 10 minute cooling-off period between each resend request.
-
- :returns:
- Whether the operation succeeded.
- """
- url = self.get_url('resend')
- response = self._session.post(url, skip_retry_codes={202}, expect_json_response=False)
- return response.ok
diff --git a/boxsdk/object/sign_template.py b/boxsdk/object/sign_template.py
deleted file mode 100644
index a5b8d0094..000000000
--- a/boxsdk/object/sign_template.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from typing import Any
-
-from .base_object import BaseObject
-
-
-class SignTemplate(BaseObject):
- """
- Represents a Sign Template used by Box Sign
- """
- _item_type = 'sign-template'
-
- def get_url(self, *args: Any) -> str:
- """
- Returns the url for this sign template.
- """
- return self._session.get_url('sign_templates', self._object_id, *args)
diff --git a/boxsdk/object/storage_policy.py b/boxsdk/object/storage_policy.py
deleted file mode 100644
index bf4b976a4..000000000
--- a/boxsdk/object/storage_policy.py
+++ /dev/null
@@ -1,70 +0,0 @@
-import json
-from typing import Any, TYPE_CHECKING
-from .base_object import BaseObject
-
-if TYPE_CHECKING:
- from boxsdk.object.user import User
- from boxsdk.object.storage_policy_assignment import StoragePolicyAssignment
-
-
-class StoragePolicy(BaseObject):
- """Represents the storage policy"""
-
- _item_type = 'storage_policy'
-
- def get_url(self, *args: Any) -> str:
- """
- Get url for storage policies.
- """
- return self._session.get_url('storage_policies', self._object_id, *args)
-
- def assign(self, user: 'User') -> 'StoragePolicyAssignment':
- """
- Checks to see if a user is already assigned a storage policy or if the storage policy assigned
- to user belongs to the enterprise. If neither, then update the user storage policy to the new one.
-
- :param user:
- The class:`User` to assign the storage policy to
- :returns:
- Information about the :class:`StoragePolicyAssignment` object.
- """
- assignment = user.get_storage_policy_assignment()
- if assignment.id == self.object_id:
- return assignment
-
- if assignment.assigned_to['type'] == 'enterprise':
- return self.create_assignment(user)
-
- update_object = {
- 'storage_policy': {
- 'type': self.object_type,
- 'id': self.object_id,
- },
- }
- return assignment.update_info(data=update_object)
-
- def create_assignment(self, user: 'User') -> 'StoragePolicyAssignment':
- """
- Assign a storage policy to a :class:`User`.
-
- :param user:
- The :class:'User` to assign the storage policy to.
- :returns:
- Information about the :class:`StoragePolicyAssignment` object
- """
- url = self._session.get_url('storage_policy_assignments')
- body = {
- 'storage_policy': {
- 'type': 'storage_policy',
- 'id': self.object_id,
- },
- 'assigned_to': {
- 'type': user.object_type,
- 'id': user.object_id,
- }
- }
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
diff --git a/boxsdk/object/storage_policy_assignment.py b/boxsdk/object/storage_policy_assignment.py
deleted file mode 100644
index f928182c6..000000000
--- a/boxsdk/object/storage_policy_assignment.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .base_object import BaseObject
-
-
-class StoragePolicyAssignment(BaseObject):
- """Represents the storage policy assignment"""
-
- _item_type = 'storage_policy_assignment'
diff --git a/boxsdk/object/task.py b/boxsdk/object/task.py
deleted file mode 100644
index 9af632534..000000000
--- a/boxsdk/object/task.py
+++ /dev/null
@@ -1,87 +0,0 @@
-import json
-from typing import TYPE_CHECKING, Optional, Iterable
-
-from boxsdk.object.base_object import BaseObject
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.object.user import User
- from boxsdk.object.task_assignment import TaskAssignment
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class Task(BaseObject):
- """Represents a Box task."""
- _item_type = 'task'
-
- @api_call
- def assign(self, assignee: 'User') -> 'TaskAssignment':
- """
- Assign a task to a single user on a single file.
-
- :param assignee:
- The :class:`User` to assign the task to.
- :returns:
- A task assignment object.
- """
- url = self._session.get_url('task_assignments')
- body = {
- 'task': {
- 'type': 'task',
- 'id': self.object_id,
- },
- 'assign_to': {
- 'id': assignee.object_id,
- },
- }
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def assign_with_login(self, assignee_login: Optional[str]) -> 'TaskAssignment':
- """
- Used to assign a task to a single user with the login email address of the assignee.
-
- :param assignee_login:
- The login of the user to assign the task to.
- :returns:
- A task assignment object.
- """
- url = self._session.get_url('task_assignments')
- body = {
- 'task': {
- 'type': 'task',
- 'id': self.object_id,
- },
- 'assign_to': {
- 'login': assignee_login,
- },
- }
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_assignments(self, fields: Iterable[str] = None) -> 'BoxObjectCollection':
- """
- Get the entries in the file task assignment.
-
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the file task assignment.
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('assignments'),
- limit=None,
- marker=None,
- fields=fields,
- return_full_pages=False,
- )
diff --git a/boxsdk/object/task_assignment.py b/boxsdk/object/task_assignment.py
deleted file mode 100644
index 50b30dc1f..000000000
--- a/boxsdk/object/task_assignment.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from boxsdk.util.text_enum import TextEnum
-from .base_object import BaseObject
-
-
-class ResolutionState(TextEnum):
- """An enum of possible resolution states"""
- COMPLETED = 'completed'
- INCOMPLETE = 'incomplete'
- APPROVED = 'approved'
- REJECTED = 'rejected'
-
-
-class TaskAssignment(BaseObject):
- """Represents a Box task."""
-
- _item_type = 'task_assignment'
diff --git a/boxsdk/object/terms_of_service.py b/boxsdk/object/terms_of_service.py
deleted file mode 100644
index 50ac32a52..000000000
--- a/boxsdk/object/terms_of_service.py
+++ /dev/null
@@ -1,116 +0,0 @@
-import json
-from typing import TYPE_CHECKING, Optional
-
-from boxsdk.util.text_enum import TextEnum
-from boxsdk.exception import BoxAPIException
-from .base_object import BaseObject
-
-if TYPE_CHECKING:
- from boxsdk.object.user import User
- from boxsdk.object.terms_of_service_user_status import TermsOfServiceUserStatus
-
-
-class TermsOfServiceType(TextEnum):
- """An enum of possible terms of service types"""
- MANAGED = 'managed'
- EXTERNAL = 'external'
-
-
-class TermsOfServiceStatus(TextEnum):
- """An enum of possible terms of service status"""
- ENABLED = 'enabled'
- DISABLED = 'disabled'
-
-
-class TermsOfService(BaseObject):
- """Represents a Box terms of service."""
-
- _item_type = 'terms_of_service'
-
- def get_user_status(self, user: Optional['User'] = None) -> Optional['TermsOfServiceUserStatus']:
- """
- Get the terms of service user status.
-
- :param user:
- This is the user to get the status of the terms of service for. This defaults to current
- user.
- :returns:
- A :class:`TermsOfServiceUserStatus` object or None if no user status found.
- """
- url = self._session.get_url('terms_of_service_user_statuses')
- additional_params = {
- 'tos_id': self.object_id,
- }
- if user is not None:
- additional_params['user_id'] = user.object_id
- box_response = self._session.get(url, params=additional_params)
- response_object = box_response.json()
-
- if not response_object['entries']:
- return None
-
- response = response_object['entries'][0]
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- def accept(self, user: Optional['User'] = None) -> 'TermsOfServiceUserStatus':
- """
- Accept a terms of service.
-
- :param user:
- The :class:`User` to assign the terms of service to.
- :returns:
- A newly created :class:`TermsOfServiceUserStatus` object
- """
- return self.set_user_status(is_accepted=True, user=user)
-
- def reject(self, user: Optional['User'] = None) -> 'TermsOfServiceUserStatus':
- """
- Reject a terms of service.
-
- :param user:
- The :class:`User` to assign the terms of service to.
- :returns:
- A newly created :class:`TermsOfServiceUserStatus` object
- """
- return self.set_user_status(is_accepted=False, user=user)
-
- def set_user_status(self, is_accepted: bool, user: Optional['User'] = None) -> 'TermsOfServiceUserStatus':
- """
- Create a terms of service user status.
-
- :param is_accepted:
- Indicates whether a use has accepted or rejected a terms of service.
- :param user:
- The :class:`User` to assign the terms of service to.
- :returns:
- A newly created :class:`TermsOfServiceUserStatus` object
- """
- url = self._session.get_url('terms_of_service_user_statuses')
- body = {
- 'tos': {
- 'type': self.object_type,
- 'id': self.object_id,
- },
- 'is_accepted': is_accepted,
- }
- if user is not None:
- body['user'] = {
- 'type': user.object_type,
- 'id': user.object_id,
- }
- translated_response = None
- try:
- box_response = self._session.post(url, data=json.dumps(body))
- response = box_response.json()
- translated_response = self.translator.translate(
- session=self._session,
- response_object=response,
- )
- except BoxAPIException as err:
- if err.status == 409:
- user_status = self.get_user_status(user)
- translated_response = user_status.update_info(data={'is_accepted': is_accepted})
- return translated_response
diff --git a/boxsdk/object/terms_of_service_user_status.py b/boxsdk/object/terms_of_service_user_status.py
deleted file mode 100644
index 81b46561f..000000000
--- a/boxsdk/object/terms_of_service_user_status.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from typing import Any
-
-from .base_object import BaseObject
-
-
-class TermsOfServiceUserStatus(BaseObject):
- """Represents a Box terms of service user status."""
-
- _item_type = 'terms_of_service_user_status'
-
- def get_url(self, *args: Any) -> str:
- return self._session.get_url('terms_of_service_user_statuses', self._object_id, *args)
-
- def accept(self) -> 'TermsOfServiceUserStatus':
- """
- Accept a term of service.
- """
- body = {
- 'is_accepted': True
- }
- return self.update_info(data=body)
-
- def reject(self) -> 'TermsOfServiceUserStatus':
- """
- Reject a term of service.
- """
- body = {
- 'is_accepted': False
- }
- return self.update_info(data=body)
diff --git a/boxsdk/object/trash.py b/boxsdk/object/trash.py
deleted file mode 100644
index d15c26ee4..000000000
--- a/boxsdk/object/trash.py
+++ /dev/null
@@ -1,155 +0,0 @@
-import json
-from typing import Iterable, TYPE_CHECKING, Optional
-
-from boxsdk.pagination.marker_based_object_collection import MarkerBasedObjectCollection
-
-from .base_endpoint import BaseEndpoint
-
-from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-from ..util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.object.base_item import BaseItem
- from boxsdk.object.folder import Folder
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
-
-
-class Trash(BaseEndpoint):
- """Box API endpoint for performing trash related actions in Box."""
-
- @api_call
- def get_item(self, item: 'BaseItem', fields: Iterable[str] = None) -> 'BaseItem':
- """
- Get item from trash.
-
- :param item:
- The :class:`BaseItem` object to get info on.
- :param fields:
- List of fields to request
- :returns:
- Information for a trashed :class:`BaseItem` object.
- """
- url = item.get_url('trash')
- params = {}
- if fields:
- params['fields'] = ','.join(fields)
- box_response = self._session.get(url, params=params)
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def restore_item(
- self,
- item: 'BaseItem',
- name: Optional[str] = None,
- parent_folder: Optional['Folder'] = None,
- fields: Iterable[str] = None
- ) -> 'BaseItem':
- """
- Restores an item from the trash. Could be files, folders, or weblinks.
-
- :param item:
- The :class:`BaseItem` object to restore from trash.
- :param name:
- The new name for this item. Only used if the item can't be restored due to name conflict.
- :param parent_folder:
- The new parent folder. Only used if the previous parent folder no longer exists.
- :param fields:
- List of fields to request
- :returns:
- A restored :class:`BaseItem`.
- """
- url = item.get_url()
- body = {}
- if name is not None:
- body['name'] = name
- if parent_folder is not None:
- body['parent'] = {'id': parent_folder.object_id}
- params = {}
- if fields:
- params['fields'] = ','.join(fields)
- box_response = self._session.post(
- url, data=json.dumps(body), params=params)
- response = box_response.json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def permanently_delete_item(self, item: 'BaseItem') -> bool:
- """
- Permanently delete an item that is in the trash. The item will no longer exist in Box.
-
- :param item:
- The :class:`BaseItem` to delete from trash.
- :returns:
- Whether or not the delete was successful.
- """
- url = item.get_url('trash')
- box_response = self._session.delete(url, expect_json_response=False)
- return box_response.ok
-
- @api_call
- def get_items(
- self,
- limit: Optional[int] = None,
- offset: Optional[int] = None,
- fields: Iterable[str] = None,
- marker: Optional[str] = None,
- use_marker: bool = False,
- sort: Optional[str] = None,
- direction: Optional[str] = None
- ) -> 'BoxObjectCollection':
- """
- Using limit-offset paging, get the files, folders and web links that are in the user's trash.
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param offset:
- The offset of the item at which to begin the response.
- :param fields:
- List of fields to request.
- :param marker:
- The marker at which to begin the response.
- :param use_marker:
- Whether or not to use marker-based paging.
- :param sort:
- The field to sort by. Can be 'id', 'name', 'date' or 'size'.
- :param direction:
- The direction to sort. Can be 'ASC' or 'DESC'.
- :returns:
- An iterator of the entries in the trash
- """
- additional_params = {}
- if limit is not None:
- additional_params['limit'] = limit
- if direction:
- additional_params['direction'] = direction
- if sort:
- additional_params['sort'] = sort
-
- if use_marker:
- additional_params['usemarker'] = True
- return MarkerBasedObjectCollection(
- url=self._session.get_url('folders', 'trash', 'items'),
- session=self._session,
- limit=limit,
- marker=marker,
- fields=fields,
- additional_params=additional_params,
- return_full_pages=False,
- )
-
- return LimitOffsetBasedObjectCollection(
- session=self._session,
- url=self._session.get_url('folders', 'trash', 'items'),
- limit=limit,
- offset=offset,
- fields=fields,
- return_full_pages=False,
- additional_params=additional_params,
- )
diff --git a/boxsdk/object/upload_session.py b/boxsdk/object/upload_session.py
deleted file mode 100644
index 8ccbe5476..000000000
--- a/boxsdk/object/upload_session.py
+++ /dev/null
@@ -1,205 +0,0 @@
-import base64
-import hashlib
-import json
-import os
-from http import HTTPStatus
-from typing import Any, Optional, TYPE_CHECKING, Iterable, IO
-
-from boxsdk import BoxAPIException
-from boxsdk.util.api_call_decorator import api_call
-from boxsdk.util.chunked_uploader import ChunkedUploader
-from boxsdk.session.session import Session
-from boxsdk.config import API
-from .base_object import BaseObject
-from ..pagination.limit_offset_based_dict_collection import LimitOffsetBasedDictCollection
-
-if TYPE_CHECKING:
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
- from boxsdk.object.file import File
-
-
-class UploadSession(BaseObject):
- _item_type = 'upload_session'
- _parent_item_type = 'file'
- _default_upload_url = API.UPLOAD_URL
-
- def __init__(
- self, session: Session, object_id: str, response_object: dict = None, use_upload_session_urls: bool = True
- ):
- super().__init__(session, object_id, response_object)
- self._use_upload_session_urls = use_upload_session_urls
-
- def get_url(self, *args: Any, url_key: str = None) -> str:
- """
- Base class override. Endpoint is a little different - it's /files/upload_sessions.
- """
- session_endpoints = getattr(self, 'session_endpoints', {})
- if self._use_upload_session_urls and url_key in session_endpoints and self.session.api_config.UPLOAD_URL == self._default_upload_url:
- return session_endpoints[url_key]
-
- return self._session.get_url(
- f'{self._parent_item_type}s/{self._item_type}s',
- self._object_id,
- *args
- ).replace(self.session.api_config.BASE_API_URL, self.session.api_config.UPLOAD_URL)
-
- @api_call
- def get_parts(self, limit: Optional[int] = None, offset: Optional[int] = None) -> 'BoxObjectCollection':
- """
- Get a list of parts uploaded so far.
-
- :param limit:
- The maximum number of items to return per page. If not specified, then will use the server-side default.
- :param offset:
- The index at which to start returning items.
- :returns:
- Returns a :class:`BoxObjectCollection` object containing the uploaded parts.
- """
- return LimitOffsetBasedDictCollection(
- session=self.session,
- url=self.get_url('parts', url_key='list_parts'),
- limit=limit,
- offset=offset,
- fields=None,
- return_full_pages=False,
- )
-
- @api_call
- def upload_part_bytes(
- self,
- part_bytes: bytes,
- offset: int,
- total_size: int,
- part_content_sha1: Optional[bytes] = None
- ) -> dict:
- """
- Upload a part of a file.
-
- :param part_bytes:
- Part bytes
- :param offset:
- Offset, in number of bytes, of the part compared to the beginning of the file. This number should be a
- multiple of the part size.
- :param total_size:
- The size of the file that this part belongs to.
- :param part_content_sha1:
- SHA-1 hash of the part's content. If not specified, this will be calculated.
- :returns:
- The uploaded part record.
- """
-
- if part_content_sha1 is None:
- sha1 = hashlib.sha1()
- sha1.update(part_bytes)
- part_content_sha1 = sha1.digest()
-
- range_end = min(offset + self.part_size - 1, total_size - 1) # pylint:disable=no-member
- headers = {
- 'Content-Type': 'application/octet-stream',
- 'Digest': f'SHA={base64.b64encode(part_content_sha1).decode("utf-8")}',
- 'Content-Range': f'bytes {offset}-{range_end}/{total_size}',
- }
- response = self._session.put(
- self.get_url(url_key='upload_part'),
- headers=headers,
- data=part_bytes,
- )
- return response.json()['part']
-
- @api_call
- def commit(
- self,
- content_sha1: bytes,
- parts: Iterable[Optional[dict]] = None,
- file_attributes: dict = None,
- etag: Optional[str] = None
- ) -> Optional['File']:
- """
- Commit a multiput upload.
-
- :param content_sha1:
- SHA-1 hash of the file contents that was uploaded.
- :param parts:
- List of parts that were uploaded.
- :param file_attributes:
- A `dict` of attributes to set on the uploaded file.
- :param etag:
- If specified, instruct the Box API to delete the folder only if the current version's etag matches.
- :returns:
- The newly-uploaded file object or None if commit was not processed
- """
- body = {}
- if file_attributes is not None:
- body['attributes'] = file_attributes
- if parts is not None:
- body['parts'] = parts
- else:
- body['parts'] = list(self.get_parts())
- headers = {
- 'Content-Type': 'application/json',
- 'Digest': f'SHA={base64.b64encode(content_sha1).decode("utf-8")}',
- }
- if etag is not None:
- headers['If-Match'] = etag
-
- try:
- response = self._session.post(
- self.get_url('commit', url_key='commit'),
- headers=headers,
- data=json.dumps(body),
- )
- except BoxAPIException as box_api_exc:
- if box_api_exc.status == HTTPStatus.ACCEPTED:
- return None
- raise box_api_exc
-
- entry = response.json()['entries'][0]
- return self.translator.translate(
- session=self._session,
- response_object=entry,
- )
-
- @api_call
- def abort(self) -> bool:
- """
- Abort an upload session, cancelling the upload and removing any parts that have already been uploaded.
-
- :returns:
- A boolean indication success of the upload abort.
- """
-
- box_response = self._session.delete(
- self.get_url(url_key='abort'),
- expect_json_response=False
- )
- return box_response.ok
-
- def get_chunked_uploader_for_stream(self, content_stream: IO[bytes], file_size: int) -> ChunkedUploader:
- """
- Instantiate the chunked upload instance and create upload session.
-
- :param content_stream:
- File-like object containing the content of the part to be uploaded.
- :param file_size:
- The size of the file that this part belongs to.
- :returns:
- A :class:`ChunkedUploader` object.
- """
- return ChunkedUploader(self, content_stream, file_size)
-
- def get_chunked_uploader(self, file_path: str) -> ChunkedUploader:
- # pylint: disable=consider-using-with
- """
- Instantiate the chunked upload instance and create upload session with path to file.
-
- :param file_path:
- The local path to the file you wish to upload.
- :returns:
- A :class:`ChunkedUploader` object.
- """
- total_size = os.stat(file_path).st_size
- content_stream = open(file_path, 'rb')
- return self.get_chunked_uploader_for_stream(
- content_stream=content_stream,
- file_size=total_size,
- )
diff --git a/boxsdk/object/user.py b/boxsdk/object/user.py
deleted file mode 100644
index 9c8c7ba2d..000000000
--- a/boxsdk/object/user.py
+++ /dev/null
@@ -1,231 +0,0 @@
-import json
-import os
-from typing import TYPE_CHECKING, Optional, Iterable, IO
-
-from .base_object import BaseObject
-from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
-from ..util.api_call_decorator import api_call
-
-if TYPE_CHECKING:
- from boxsdk.object.email_alias import EmailAlias
- from boxsdk.pagination.box_object_collection import BoxObjectCollection
- from boxsdk.object.folder import Folder
- from boxsdk.object.storage_policy_assignment import StoragePolicyAssignment
-
-
-class User(BaseObject):
- """Represents a Box user."""
-
- _item_type = 'user'
-
- @api_call
- def add_email_alias(self, email: str) -> 'EmailAlias':
- """
- Adds a new email alias to the given user's account.
-
- :param email:
- The email alias to add to the user.
- :returns:
- The new email alias object
- """
- url = self.get_url('email_aliases')
- body = {
- 'email': email,
- }
- response = self._session.post(url, data=json.dumps(body)).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_email_aliases(self, limit: Optional[int] = None, fields: Iterable[str] = None) -> 'BoxObjectCollection':
- """
- Gets an list of email aliases for a user.
-
- :param limit:
- The maximum number of users to return. If not specified, the Box API will determine an appropriate limit.
- :param fields:
- List of fields to request
- :returns:
- An iterator of the user's email aliases
- """
- return MarkerBasedObjectCollection(
- session=self._session,
- url=self.get_url('email_aliases'),
- limit=limit,
- marker=None,
- fields=fields,
- return_full_pages=False,
- )
-
- @api_call
- def remove_email_alias(self, email_alias: 'EmailAlias') -> bool:
- """
- Remove an email alias from the user.
-
- :param email_alias:
- The email alias to remove.
- :returns:
- Whether the removal succeeded.
- """
- url = self.get_url('email_aliases', email_alias.object_id)
- response = self._session.delete(url, expect_json_response=False)
- return response.ok
-
- @api_call
- def transfer_content(
- self,
- destination_user: 'User',
- notify: Optional[bool] = None,
- fields: Iterable[str] = None
- ) -> 'Folder':
- """
- Move all of the items owned by a user into a new folder in another user's account.
-
- :param destination_user:
- The id of the user to transfer content to.
- :param notify:
- Whether the destination user should receive email notification of the transfer.
- :param fields:
- Fields to return on the resulting :class:`Folder` object
- :returns:
- A :class:`Folder` object that was transferred to another user.
- """
- url = self.get_url('folders', '0')
- body = {
- 'owned_by': {
- 'id': destination_user.object_id,
- },
- }
- params = {}
- if notify is not None:
- params['notify'] = notify
- if fields is not None:
- params['fields'] = ','.join(fields)
- response = self._session.put(url, data=json.dumps(body), params=params).json()
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- def get_storage_policy_assignment(self) -> 'StoragePolicyAssignment':
- """
- Get the storage policy assignment assigned to the user.
-
- :returns:
- The :class:`StoragePolicyAssignment` object information
- """
- url = self._session.get_url('storage_policy_assignments')
- additional_params = {
- 'resolved_for_type': self.object_type,
- 'resolved_for_id': self.object_id,
- }
- box_response = self._session.get(url, params=additional_params)
- response = box_response.json()['entries'][0]
- return self.translator.translate(
- session=self._session,
- response_object=response,
- )
-
- @api_call
- def get_group_memberships(
- self,
- limit: Optional[int] = None,
- offset: Optional[int] = None,
- fields: Iterable[str] = None
- ) -> 'BoxObjectCollection':
- """
- Get the entries in the user group membership using limit-offset paging.
-
- :param limit:
- The maximum number of entries to return per page. If not specified, then will use the server-side default.
- :param offset:
- The offset of the item at which to begin the response.
- :param fields:
- List of fields to request.
- :returns:
- An iterator of the entries in the groups
- """
- additional_params = {}
- if fields is not None:
- additional_params['fields'] = ','.join(fields)
- return LimitOffsetBasedObjectCollection(
- session=self._session,
- url=self.get_url('memberships'),
- additional_params=additional_params,
- limit=limit,
- offset=offset,
- return_full_pages=False,
- )
-
- @api_call
- def get_avatar(self) -> bytes:
- """
- Get the avatar for the User.
-
- :returns:
- Avatar content as bytes.
- """
- url = self.get_url('avatar')
- response = self._session.get(url, expect_json_response=False)
- return response.content
-
- @api_call
- def upload_avatar(self, image_path: str) -> str:
- """
- Upload avatar image to user account. Supported formats are JPG, JPEG and PNG.
- Maximum allowed file size is 1MB and resolution 1024x1024 pixels.
-
- :param image_path: Path of the avatar image to upload
- :return: URLs to existing user avatars that were updated
- """
- with open(image_path, 'rb') as image_stream:
- image_extension = os.path.splitext(image_path)[-1][1:]
- return self.upload_avatar_stream(image_stream=image_stream, image_extension=image_extension)
-
- @api_call
- def upload_avatar_stream(self, image_stream: IO[bytes], image_extension: str) -> str:
- """
- Upload avatar image to user account. Supported formats are JPG, JPEG and PNG.
- Maximum allowed file size is 1MB and resolution 1024x1024 pixels.
-
- :param image_extension: Extension of the image. Supported: 'jpg', 'jpeg' and 'png'.
- :param image_stream: The file-like object containing the bytes of the image
- :return: URLs to existing user avatars that were updated
- """
- url = self.get_url('avatar')
- files = {'pic': (f'avatar.{image_extension}', image_stream, f'image/{image_extension}')}
- response = self._session.post(url, files=files)
- return response.json()['pic_urls']
-
- @api_call
- def delete_avatar(self) -> bool:
- """
- Remove avatar from user account
-
- :return: Whether the deletion succeeded
- """
- url = self.get_url('avatar')
- response = self._session.delete(url)
- return response.ok
-
- @api_call
- def delete(self, *, notify: bool = True, force: bool = False, **kwargs) -> bool:
- # pylint: disable=arguments-differ,arguments-renamed
- """
- Delete a user's account. This user will no longer be able to access Box.
-
- :param notify:
- Whether a notification should be sent about the deletion
- :param force:
- Whether the user should be deleted even if they still own files
- :returns:
- Whether the deletion succeeded
- """
- params = {
- 'notify': notify,
- 'force': force,
- }
- return super().delete(params=params, **kwargs)
diff --git a/boxsdk/object/watermark.py b/boxsdk/object/watermark.py
deleted file mode 100644
index a8e53a30b..000000000
--- a/boxsdk/object/watermark.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .api_json_object import APIJSONObject
-
-
-class Watermark(APIJSONObject):
- """Box API endpoint for applying watermark in a Box account."""
-
- _item_type = 'watermark'
diff --git a/boxsdk/object/web_link.py b/boxsdk/object/web_link.py
deleted file mode 100644
index 999de75f5..000000000
--- a/boxsdk/object/web_link.py
+++ /dev/null
@@ -1,106 +0,0 @@
-from datetime import datetime
-from typing import Optional, Any, Union
-
-from ..util.api_call_decorator import api_call
-from ..util.default_arg_value import SDK_VALUE_NOT_SET
-from .base_item import BaseItem
-
-
-class WebLink(BaseItem):
- """Box API endpoint for interacting with WebLinks."""
-
- _item_type = 'web_link'
-
- @api_call
- def create_shared_link(
- self,
- *,
- access: Optional[str] = None,
- unshared_at: Union[datetime, str, None] = SDK_VALUE_NOT_SET,
- password: Optional[str] = None,
- vanity_name: Optional[str] = None,
- **kwargs: Any
- ) -> 'WebLink':
- """
- Baseclass override.
-
- :param access:
- Determines who can access the shared link. May be open, company, or collaborators. If no access is
- specified, the default access will be used.
- :param unshared_at:
- The date on which this link should be disabled. May only be set if the current user is not a free user
- and has permission to set expiration dates. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- The time portion can be omitted,
- which defaults to midnight (00:00:00) on that date.
- :param password:
- The password required to view this link. If no password is specified then no password will be set.
- Please notice that this is a premium feature, which might not be available to your app.
- :param vanity_name:
- Defines a custom vanity name to use in the shared link URL, eg. https://app.box.com/v/my-custom-vanity-name.
- If this parameter is None, the standard shared link URL will be used.
- :param kwargs:
- Used to fulfill the contract of overriden method
- :return:
- The updated object with s shared link.
- Returns a new object of the same type, without modifying the original object passed as self.
- """
- # pylint:disable=arguments-differ
- return super().create_shared_link(
- access=access,
- unshared_at=unshared_at,
- password=password,
- vanity_name=vanity_name
- )
-
- @api_call
- def get_shared_link(
- self,
- *,
- access: Optional[str] = None,
- unshared_at: Union[datetime, str, None] = SDK_VALUE_NOT_SET,
- password: Optional[str] = None,
- vanity_name: Optional[str] = None,
- **kwargs: Any
- ) -> str:
- """
- Baseclass override.
-
- :param access:
- Determines who can access the shared link. May be open, company, or collaborators. If no access is
- specified, the default access will be used.
- :param unshared_at:
- The date on which this link should be disabled. May only be set if the current user is not a free user
- and has permission to set expiration dates. Takes a datetime string supported by the dateutil library
- or a datetime.datetime object. If no timezone info provided, local timezone will be applied.
- The time portion can be omitted, which defaults to midnight (00:00:00) on that date.
- :param password:
- The password required to view this link. If no password is specified then no password will be set.
- Please notice that this is a premium feature, which might not be available to your app.
- :param vanity_name:
- Defines a custom vanity name to use in the shared link URL, eg. https://app.box.com/v/my-custom-vanity-name.
- If this parameter is None, the standard shared link URL will be used.
- :param kwargs:
- Used to fulfill the contract of overriden method
- :returns:
- The URL of the shared link.
- """
- # pylint:disable=arguments-differ
- return super().get_shared_link(
- access=access,
- unshared_at=unshared_at,
- password=password,
- vanity_name=vanity_name
- )
-
- @api_call
- def remove_shared_link(self, **kwargs: Any) -> bool:
- """
- Baseclass override.
-
- :param kwargs:
- Used to fulfill the contract of overriden method
- :returns:
- Whether or not the update was successful.
- """
- return super().remove_shared_link()
diff --git a/boxsdk/object/webhook.py b/boxsdk/object/webhook.py
deleted file mode 100644
index 5df32ffec..000000000
--- a/boxsdk/object/webhook.py
+++ /dev/null
@@ -1,74 +0,0 @@
-import base64
-import hashlib
-import hmac
-from typing import Optional
-
-from .base_object import BaseObject
-
-
-class Webhook(BaseObject):
- """Represents a Box Webhook."""
-
- _item_type = 'webhook'
-
- @staticmethod
- def validate_message(
- body: bytes,
- headers: dict,
- primary_signature_key: str,
- secondary_signature_key: str = None
- ) -> bool:
- """
- Validates a `Webhook` message.
-
- :param body:
- The encoded webhook body.
- :param headers:
- The headers for the `Webhook` notification.
- :param primary_signature_key:
- The `Webhook` primary signature key for this application.
- :param secondary_signature_key:
- The `Webhook` secondary signature key for this application.
- :return:
- A `bool` indicating whether a webhook message was validated or not
- """
-
- primary_signature = _compute_signature(body, headers, primary_signature_key)
- if primary_signature is not None and hmac.compare_digest(primary_signature, headers.get('box-signature-primary')):
- return True
-
- if secondary_signature_key:
- secondary_signature = _compute_signature(body, headers, secondary_signature_key)
- if secondary_signature is not None and hmac.compare_digest(secondary_signature, headers.get('box-signature-secondary')):
- return True
- return False
-
- return False
-
-
-def _compute_signature(body: bytes, headers: dict, signature_key: str) -> Optional[str]:
- """
- Computes the Hmac for the webhook notification given one signature key.
-
- :param body:
- The encoded webhook body.
- :param headers:
- The headers for the `Webhook` notification.
- :param signature_key:
- The `Webhook` signature key for this application.
- :return:
- An Hmac signature.
- """
- if signature_key is None:
- return None
- if headers.get('box-signature-version') != '1':
- return None
- if headers.get('box-signature-algorithm') != 'HmacSHA256':
- return None
-
- encoded_signature_key = signature_key.encode('utf-8')
- encoded_delivery_time_stamp = headers.get('box-delivery-timestamp').encode('utf-8')
- new_hmac = hmac.new(encoded_signature_key, digestmod=hashlib.sha256)
- new_hmac.update(body + encoded_delivery_time_stamp)
- signature = base64.b64encode(new_hmac.digest()).decode()
- return signature
diff --git a/boxsdk/pagination/__init__.py b/boxsdk/pagination/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/boxsdk/pagination/box_object_collection.py b/boxsdk/pagination/box_object_collection.py
deleted file mode 100644
index e7da45512..000000000
--- a/boxsdk/pagination/box_object_collection.py
+++ /dev/null
@@ -1,166 +0,0 @@
-import json
-from abc import ABC, abstractmethod
-from collections.abc import Iterator
-from typing import TYPE_CHECKING, Optional, Union, Any, Iterator as Iter
-from boxsdk.pagination.page import Page
-
-if TYPE_CHECKING:
- from boxsdk.session.session import Session
- from boxsdk.object.base_object import BaseObject
-
-
-class BoxObjectCollection(Iterator, ABC):
- """
- An iterator that represents a collection of Box objects (BaseObject).
-
- A BoxObjectCollection instance contains everything it needs in order to retrieve and page through
- responses from Box API endpoints that return collections of Box objects.
-
- This class only has two public methods:
-
- 1). next(), which returns either a Page (sequence of BaseObjects) or individual BaseObjects based on
- the constructor argument 'return_full_pages'.
-
- 2). next_pointer(), which returns the pointer (either an offset or a marker, based on the endpoint) that
- will be used to retrieve the next page of Box objects. This pointer can be used when requesting new
- BoxObjectCollection instances that start off from a particular page, instead of from the very beginning.
- """
- _page_constructor = Page
-
- def __init__(
- self,
- session: 'Session',
- url: str,
- limit: Optional[int] = None,
- fields: Optional[Iter[str]] = None,
- additional_params: Optional[dict] = None,
- return_full_pages: bool = False,
- use_post: bool = False
- ):
- """
- :param session:
- The Box session used to make requests.
- :param url:
- The endpoint url to hit.
- :param limit:
- The number of entries for each page to return. The default, as well as the upper limit of this value,
- differs by endpoint. See https://developer.box.com/en/reference. If limit is set to None, then the default
- limit (returned by Box in the response) is used.
- :param fields:
- List of fields to request. If None, will return the default fields for the object.
- :param additional_params:
- Additional HTTP params to send in the request.
- :param return_full_pages:
- If True, then the returned iterator for this collection will return full pages of Box objects on each
- call to next(). If False, the iterator will return a single Box object on each next() call.
- :param use_post:
- If True, then the returned iterator will make POST requests with all the data in the body on each
- call to next().
- If False, the iterator will make GET requets with all the data as query params on each call to next().
- """
- super().__init__()
- self._session = session
- self._url = url
- self._limit = limit
- self._fields = fields
- self._additional_params = additional_params
- self._return_full_pages = return_full_pages
- self._has_retrieved_all_items = False
- self._all_items = None
- self._use_post = use_post
-
- def next(self) -> Union[Page, 'BaseObject']:
- """
- Returns either a Page (a Sequence of BaseObjects) or a BaseObject depending on self._return_full_pages.
-
- Invoking this method may make an API call to Box. Any exceptions that can occur while making requests
- may be raised in this method.
- """
- if self._all_items is None:
- self._all_items = self._items_generator()
- return next(self._all_items)
-
- __next__ = next
-
- def _items_generator(self) -> Union[Page, 'BaseObject']:
- while not self._has_retrieved_all_items:
- response_object = self._load_next_page()
-
- self._update_pointer_to_next_page(response_object)
- self._has_retrieved_all_items = not self._has_more_pages(response_object)
- page = self._page_constructor(self._session, response_object)
-
- if self._return_full_pages:
- yield page
- else:
- # It's possible for the Box API to return 0 items in a page, even if there are more items to be
- # retrieved on subsequent pages. When self._return_full_pages is True, then yielding a 0-item
- # page is fine because that's what the page returned.
- # But when we are iterating over individual items, and not pages, it's odd to yield a sequence of
- # Nones (for that page that had 0 items). So instead, we continue to request more pages until we
- # have Box objects to yield.
- if not page:
- continue
- yield from page
-
- def _load_next_page(self) -> dict:
- """
- Request the next page of entries from Box. Raises any network-related exceptions, including BoxAPIException.
- Returns a parsed dictionary of the JSON response from Box
- """
- params = {}
- if self._limit is not None:
- params['limit'] = self._limit
- if self._additional_params:
- params.update(self._additional_params)
- params.update(self._next_page_pointer_params())
- if self._use_post:
- if self._fields:
- params['fields'] = self._fields
- box_response = self._session.post(self._url, data=json.dumps(params), headers={b'Content-Type': b'application/json'})
- else:
- if self._fields:
- params['fields'] = ','.join(self._fields)
- box_response = self._session.get(self._url, params=params)
- return box_response.json()
-
- @abstractmethod
- def _update_pointer_to_next_page(self, response_object: dict) -> None:
- """
- Update the internal pointer attribute of this class to what will be used to request the next page
- of Box objects.
-
- A "pointer" can either be a marker (for marker-based paging) or an offset (for limit-offset paging).
-
- :param response_object:
- The parsed HTTP response from Box after requesting more pages.
- """
- raise NotImplementedError
-
- @abstractmethod
- def _has_more_pages(self, response_object: dict) -> bool:
- """
- Are there more pages of entries to query Box for? This gets invoked after self._update_pointer_to_next_page().
-
- :param response_object:
- The parsed HTTP response from Box after requesting more pages.
- """
- raise NotImplementedError
-
- @abstractmethod
- def _next_page_pointer_params(self) -> dict:
- """
- The dict of HTTP params that specify which page of Box objects to retrieve.
- """
- raise NotImplementedError
-
- @abstractmethod
- def next_pointer(self) -> Any:
- """
- The pointer that will be used to request the next page of Box objects.
-
- For limit-offset based paging, this is an offset. For marker-based paging, this is a marker.
-
- The pointer only gets progressed upon successful page requests to Box.
- """
- raise NotImplementedError
diff --git a/boxsdk/pagination/dict_page.py b/boxsdk/pagination/dict_page.py
deleted file mode 100644
index 7568fcfd5..000000000
--- a/boxsdk/pagination/dict_page.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from typing import Any
-
-from .page import Page
-
-
-class DictPage(Page):
- def __getitem__(self, key: str) -> Any:
- return self._response_object[self._item_entries_key_name][key]
diff --git a/boxsdk/pagination/limit_offset_based_dict_collection.py b/boxsdk/pagination/limit_offset_based_dict_collection.py
deleted file mode 100644
index 5732f110f..000000000
--- a/boxsdk/pagination/limit_offset_based_dict_collection.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .dict_page import DictPage
-from .limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
-
-
-class LimitOffsetBasedDictCollection(LimitOffsetBasedObjectCollection):
- """Represents a limit/offset-based collection of simple dicts, which are not translated into objects."""
- _page_constructor = DictPage
diff --git a/boxsdk/pagination/limit_offset_based_object_collection.py b/boxsdk/pagination/limit_offset_based_object_collection.py
deleted file mode 100644
index 73c94bc1b..000000000
--- a/boxsdk/pagination/limit_offset_based_object_collection.py
+++ /dev/null
@@ -1,98 +0,0 @@
-from typing import Optional, Iterator, TYPE_CHECKING
-
-from .box_object_collection import BoxObjectCollection
-
-if TYPE_CHECKING:
- from boxsdk.session.session import Session
-
-
-class LimitOffsetBasedObjectCollection(BoxObjectCollection):
- """
- An iterator of Box objects (BaseObjects) that were retrieved from a Box API endpoint that supports
- limit-offset type of pagination.
-
- See https://developer.box.com/en/guides/api-calls/pagination/ for more details.
- """
-
- def __init__(
- self,
- session: 'Session',
- url: str,
- limit: Optional[int] = None,
- fields: Iterator[str] = None,
- additional_params: Optional[dict] = None,
- return_full_pages: bool = False,
- offset: int = 0,
- ):
- """
- :param session:
- The Box session used to make requests.
- :param url:
- The endpoint url to hit.
- :param limit:
- The number of entries for each page to return. The default, as well as the upper limit of this value,
- differs by endpoint. See https://developer.box.com/en/reference. If limit is set to None, then the default
- limit (returned by Box in the response) is used.
- :param fields:
- List of fields to request. If None, will return the default fields for the object.
- :param additional_params:
- Additional HTTP params to send in the request.
- :param return_full_pages:
- If True, then the returned iterator for this collection will return full pages of Box objects on each
- call to next(). If False, the iterator will return a single Box object on each next() call.
- :param offset:
- The offset index to start paging from.
- """
- super().__init__(
- session,
- url,
- limit=limit,
- fields=fields,
- additional_params=additional_params,
- return_full_pages=return_full_pages,
- )
- self._offset = offset
-
- def _update_pointer_to_next_page(self, response_object: dict) -> None:
- """Baseclass override."""
- total_count = response_object['total_count']
-
- if 'limit' in response_object:
- self._limit, old_limit = int(response_object['limit']), self._limit
-
- # The API might use a lower limit than the client asked for, if the
- # client asked for a limit above the maximum limit for that endpoint.
- # The API is supposed to respond with the limit that it actually used.
- # If that is given, then use that limit for the offset calculation, and
- # also for the remainder of the paging.
-
- # Do not apply this same logic to "offset". Offset is not documented to be
- # changed in the response, so respecting that value can lead to undefined
- # behavior.
-
- # If the API erroneously sends a bad value for limit, we want to
- # avoid getting into an infinite chain of API calls. So abort with
- # a runtime error.
- if self._limit <= 0 < old_limit:
- self._offset = total_count # Disable additional paging.
- raise RuntimeError(f'API returned limit={self._limit}, cannot continue paging')
-
- # de-none-ify the _offset value so that the arthimatic below works
- self._offset = self._offset or 0
-
- if total_count >= self._offset + self._limit:
- self._offset += self._limit
- else:
- self._offset = total_count
-
- def _has_more_pages(self, response_object: dict) -> bool:
- """Baseclass override."""
- return self._offset < response_object['total_count']
-
- def _next_page_pointer_params(self) -> dict:
- """Baseclass override."""
- return {'offset': self._offset}
-
- def next_pointer(self) -> int:
- """Baseclass override."""
- return self._offset
diff --git a/boxsdk/pagination/marker_based_dict_collection.py b/boxsdk/pagination/marker_based_dict_collection.py
deleted file mode 100644
index c68b9b8c5..000000000
--- a/boxsdk/pagination/marker_based_dict_collection.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from .dict_page import DictPage
-from .marker_based_object_collection import MarkerBasedObjectCollection
-
-
-class MarkerBasedDictCollection(MarkerBasedObjectCollection):
- """Represents a marker-based collection of simple dicts, which are not translated into objects."""
- _page_constructor = DictPage
diff --git a/boxsdk/pagination/marker_based_object_collection.py b/boxsdk/pagination/marker_based_object_collection.py
deleted file mode 100644
index 082c831a6..000000000
--- a/boxsdk/pagination/marker_based_object_collection.py
+++ /dev/null
@@ -1,102 +0,0 @@
-from typing import Optional, Iterator, TYPE_CHECKING
-
-from .box_object_collection import BoxObjectCollection
-
-if TYPE_CHECKING:
- from boxsdk.session.session import Session
-
-
-class MarkerBasedObjectCollection(BoxObjectCollection):
- """
- An iterator of Box objects (BaseObjects) that were retrieved from a Box API endpoint that supports
- marker type of pagination.
-
- See https://developer.box.com/en/guides/api-calls/pagination/ for more details.
- """
-
- def __init__(
- self,
- session: 'Session',
- url: str,
- limit: Optional[int] = None,
- fields: Iterator[str] = None,
- additional_params: Optional[dict] = None,
- return_full_pages: bool = False,
- marker: Optional[str] = None,
- supports_limit_offset_paging: bool = False,
- use_post: bool = False
- ):
- """
- :param session:
- The Box session used to make requests.
- :param url:
- The endpoint url to hit.
- :param limit:
- The number of entries for each page to return. The default, as well as the upper limit of this value,
- differs by endpoint. See https://developer.box.com/en/reference. If limit is set to None, then the default
- limit (returned by Box in the response) is used.
- :param fields:
- List of fields to request. If None, will return the default fields for the object.
- :param additional_params:
- Additional HTTP params to send in the request.
- :param return_full_pages:
- If True, then the returned iterator for this collection will return full pages of Box objects on each
- call to next(). If False, the iterator will return a single Box object on each next() call.
- :param marker:
- The offset index to start paging from.
- :param supports_limit_offset_paging:
- Does this particular endpoint also support limit-offset paging? This information is needed, as
- the endpoints that support both require an special extra request parameter.
- :param use_post:
- If True, then the returned iterator will make POST requests with all the data in the body on each
- call to next().
- If False, the iterator will make GET requets with all the data as query params on each call to next().
- """
- super().__init__(
- session,
- url,
- limit=limit,
- fields=fields,
- additional_params=additional_params,
- return_full_pages=return_full_pages,
- use_post=use_post
- )
- self._marker = marker
- self._supports_limit_offset_paging = supports_limit_offset_paging
-
- def _update_pointer_to_next_page(self, response_object: dict) -> None:
- """Baseclass override."""
- self._marker = self._get_next_marker_from_response_object(response_object)
-
- def _has_more_pages(self, response_object) -> bool:
- """Baseclass override."""
- return bool(self._get_next_marker_from_response_object(response_object))
-
- @staticmethod
- def _get_next_marker_from_response_object(response_object) -> Optional[str]:
- """Get the marker that should be used to retrieve the next page.
-
- When we've just retrieved the last page, the API is inconsistent about
- what it returns. Some endpoints return "next_marker":"", some return
- "next_marker":null, some don't give any "next_marker" value. In all of
- these cases, this method will return `None`.
-
- Otherwise, this method returns the string value of the "next_marker"
- field.
- """
- return response_object.get('next_marker') or None
-
- def _next_page_pointer_params(self) -> dict:
- """Baseclass override."""
- pointer_params = {}
- # For transitioning endpoints that support both marker and limit-offset paging, we must specify an
- # additional 'useMarker' parameter to the Box API.
- if self._supports_limit_offset_paging:
- pointer_params['useMarker'] = True
- if self._marker is not None:
- pointer_params['marker'] = self._marker
- return pointer_params
-
- def next_pointer(self) -> Optional[str]:
- """Baseclass override."""
- return self._marker
diff --git a/boxsdk/pagination/page.py b/boxsdk/pagination/page.py
deleted file mode 100644
index ef032db6c..000000000
--- a/boxsdk/pagination/page.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import copy
-
-from collections.abc import Sequence
-from typing import TYPE_CHECKING
-
-if TYPE_CHECKING:
- from boxsdk.session.session import Session
- from boxsdk.util.translator import Translator
- from boxsdk.object.base_object import BaseObject
-
-
-class Page(Sequence):
- """
- A sequence of BaseObjects that belong to a page returned from a paging api call.
-
- The Page makes available detailed response data for page requests.
- """
- _item_entries_key_name = "entries"
-
- def __init__(self, session: 'Session', response_object: dict):
- """
- :param session:
- The Box session used to make the request that generated the response.
- :param response_object:
- The parsed HTTP response from Box after requesting more pages.
- """
- super().__init__()
- self._session = session
- self._response_object = response_object
-
- @property
- def _translator(self) -> 'Translator':
- """
- The translator used for translating Box API JSON responses into `BaseAPIJSONObject` smart objects.
- """
- return self._session.translator
-
- @property
- def response_object(self) -> dict:
- """
- Return a copy of the response object for this Page.
- """
- return copy.deepcopy(self._response_object)
-
- def __getitem__(self, key: str) -> 'BaseObject':
- """
- Try to get the attribute from the API response object.
-
- :param key:
- The attribute to retrieve from the API response object.
- """
- item_json = self._response_object[self._item_entries_key_name][key]
- return self._translator.translate(self._session, item_json)
-
- def __len__(self) -> int:
- """
- Get the number of items in the page.
- """
- return len(self._response_object[self._item_entries_key_name])
diff --git a/boxsdk/py.typed b/boxsdk/py.typed
deleted file mode 100644
index e69de29bb..000000000
diff --git a/boxsdk/session/__init__.py b/boxsdk/session/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/boxsdk/session/box_request.py b/boxsdk/session/box_request.py
deleted file mode 100644
index b255c5c2b..000000000
--- a/boxsdk/session/box_request.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from typing import Optional
-
-import attr
-
-from ..util.log import sanitize_dictionary
-
-
-@attr.s(slots=True)
-class BoxRequest:
- """Represents a Box API request.
-
- :param url: The URL being requested.
- :param method: The HTTP method to use for the request.
- :param headers: HTTP headers to include with the request.
- :param auto_session_renewal: Whether or not the session can be automatically renewed if the request fails.
- :param expect_json_response: Whether or not the API response must be JSON.
- """
- url: str = attr.ib()
- method: Optional[str] = attr.ib(default='GET')
- headers: Optional[dict] = attr.ib(default=attr.Factory(dict))
- auto_session_renewal: Optional[bool] = attr.ib(default=True)
- expect_json_response: Optional[bool] = attr.ib(default=True)
- access_token: Optional[str] = attr.ib(default=None)
-
- def __repr__(self) -> str:
- return f' Any:
- """
- Return the parsed JSON response.
- """
- return self._network_response.json()
-
- @property
- def content(self) -> Any:
- """
- Return the content of the response body.
- """
- return self._network_response.content
-
- @property
- def ok(self) -> bool:
- """
- Return whether or not the request was successful.
- """
- # pylint:disable=invalid-name
- return self._network_response.ok
-
- @property
- def status_code(self) -> int:
- """
- Return the HTTP status code of the response.
- """
- return self._network_response.status_code
-
- @property
- def headers(self) -> dict:
- """
- Get the response headers.
- """
- return self._network_response.headers
-
- @property
- def network_response(self) -> 'NetworkResponse':
- """
- Return the underlying network response.
- """
- return self._network_response
-
- def __repr__(self) -> str:
- return f''
diff --git a/boxsdk/session/session.py b/boxsdk/session/session.py
deleted file mode 100644
index e60f5f0a6..000000000
--- a/boxsdk/session/session.py
+++ /dev/null
@@ -1,587 +0,0 @@
-import random
-import math
-
-from functools import partial
-from logging import getLogger
-from numbers import Number
-from typing import TYPE_CHECKING, Optional, Any, Type, Callable, Set
-
-from requests.exceptions import RequestException
-from boxsdk.exception import BoxException
-from .box_request import BoxRequest as _BoxRequest
-from .box_response import BoxResponse as _BoxResponse
-from ..config import API, Client, Proxy
-from ..exception import BoxAPIException
-from ..network.default_network import DefaultNetwork
-from ..util.json import is_json_response
-from ..util.multipart_stream import MultipartStream
-from ..util.shared_link import get_shared_link_header
-from ..util.translator import Translator
-
-if TYPE_CHECKING:
- from boxsdk.network.network_interface import Network
- from boxsdk.object.user import User
- from boxsdk import NetworkResponse, OAuth2
-
-
-class Session:
-
- _retry_randomization_factor = 0.5
- _retry_base_interval = 1
- _JWT_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:jwt-bearer'
- _CCG_GRANT_TYPE = 'client_credentials'
-
- """
- Box API session. Provides automatic retry of failed requests.
- """
- def __init__(
- self,
- network_layer: 'Network' = None,
- default_headers: Optional['dict'] = None,
- translator: Translator = None,
- default_network_request_kwargs: Optional['dict'] = None,
- api_config: API = None,
- client_config: Client = None,
- proxy_config: Optional[Proxy] = None,
- ):
- """
- :param network_layer:
- Network implementation used by the session to make requests.
- :param default_headers:
- A dictionary containing default values to be used as headers when this session makes an API request.
- :param translator:
- (optional) The translator to use for translating Box API JSON
- responses into :class:`BaseAPIJSONObject` smart objects.
- Defaults to a new :class:`Translator` that inherits the
- registrations of the default translator.
- :param default_network_request_kwargs:
- A dictionary containing default values to be passed to the network layer
- when this session makes an API request.
- :param api_config:
- Object containing URLs for the Box API.
- :param client_config:
- Object containing client information, including user agent string.
- :param proxy_config:
- Object containing proxy information.
- """
- if translator is None:
- translator = Translator(extend_default_translator=True, new_child=True)
- self._api_config = api_config or API()
- self._client_config = client_config or Client()
- self._proxy_config = proxy_config or Proxy()
- super().__init__()
- self._network_layer = network_layer or DefaultNetwork()
- self._default_headers = {
- 'User-Agent': self._client_config.USER_AGENT_STRING,
- 'X-Box-UA': self._client_config.BOX_UA_STRING,
- }
- self._translator = translator
- self._default_network_request_kwargs = {}
- if default_headers:
- self._default_headers.update(default_headers)
- if default_network_request_kwargs:
- self._default_network_request_kwargs.update(default_network_request_kwargs)
- self._logger = getLogger(__name__)
-
- def get(self, url: str, **kwargs: Any) -> '_BoxResponse':
- """Make a GET request to the Box API.
-
- :param url:
- The URL for the request.
- """
- return self.request('GET', url, **kwargs)
-
- def post(self, url: str, **kwargs: Any) -> '_BoxResponse':
- """Make a POST request to the Box API.
-
- :param url:
- The URL for the request.
- """
- return self.request('POST', url, **kwargs)
-
- def put(self, url: str, **kwargs: Any) -> '_BoxResponse':
- """Make a PUT request to the Box API.
-
- :param url:
- The URL for the request.
- """
- return self.request('PUT', url, **kwargs)
-
- def delete(self, url: str, **kwargs: Any) -> '_BoxResponse':
- """Make a DELETE request to the Box API.
-
- :param url:
- The URL for the request.
- """
- if 'expect_json_response' not in kwargs:
- kwargs['expect_json_response'] = False
- if 'skip_retry_codes' not in kwargs:
- kwargs['skip_retry_codes'] = {202}
- return self.request('DELETE', url, **kwargs)
-
- def options(self, url: str, **kwargs: Any) -> '_BoxResponse':
- """Make an OPTIONS request to the Box API.
-
- :param url:
- The URL for the request.
- """
- return self.request('OPTIONS', url, **kwargs)
-
- def request(self, method: str, url: str, **kwargs: Any) -> '_BoxResponse':
- """Make a request to the Box API.
-
- :param method:
- The HTTP verb for the request.
- :param url:
- The URL for the request.
- """
- response = self._prepare_and_send_request(method, url, **kwargs)
- return self.box_response_constructor(response)
-
- @property
- def box_request_constructor(self) -> Type[_BoxRequest]:
- """Get the constructor for the container class representing an API request"""
- return _BoxRequest
-
- @property
- def box_response_constructor(self) -> Type[_BoxResponse]:
- """Get the constructor for the container class representing an API response"""
- return _BoxResponse
-
- @property
- def translator(self) -> Translator:
- """
- The translator used for translating Box API JSON responses into `BaseAPIJSONObject` smart objects.
- """
- return self._translator
-
- @property
- def api_config(self) -> API:
- return self._api_config
-
- @property
- def client_config(self) -> Client:
- return self._client_config
-
- @property
- def proxy_config(self) -> Proxy:
- return self._proxy_config
-
- def get_url(self, endpoint: str, *args: Any) -> str:
- """
- Return the URL for the given Box API endpoint.
-
- :param endpoint:
- The name of the endpoint.
- :param args:
- Additional parts of the endpoint URL.
- """
- # pylint:disable=no-self-use
- url = [f'{self._api_config.BASE_API_URL}/{endpoint}']
- url.extend([f'/{x}' for x in args])
- return ''.join(url)
-
- def get_constructor_kwargs(self) -> dict:
- return dict(
- network_layer=self._network_layer,
- translator=self._translator,
- default_network_request_kwargs=self._default_network_request_kwargs.copy(),
- api_config=self._api_config,
- client_config=self._client_config,
- proxy_config=self._proxy_config,
- default_headers=self._default_headers.copy(),
- )
-
- def as_user(self, user: 'User') -> 'Session':
- """
- Returns a new session object with default headers set up to make requests as the specified user.
-
- :param user:
- The user to impersonate when making API requests.
- """
- kwargs = self.get_constructor_kwargs()
- kwargs['default_headers']['As-User'] = user.object_id
- return self.__class__(**kwargs)
-
- def with_shared_link(self, shared_link: str, shared_link_password: str = None) -> 'Session':
- """
- Returns a new session object with default headers set up to make requests using the shared link for auth.
-
- :param shared_link:
- The shared link.
- :param shared_link_password:
- The password for the shared link.
- """
- kwargs = self.get_constructor_kwargs()
- kwargs['default_headers'].update(get_shared_link_header(shared_link, shared_link_password))
- return self.__class__(**kwargs)
-
- def with_default_network_request_kwargs(self, extra_network_parameters: dict) -> 'Session':
- kwargs = self.get_constructor_kwargs()
- kwargs['default_network_request_kwargs'].update(extra_network_parameters)
- return self.__class__(**kwargs)
-
- # We updated our retry strategy to use exponential backoff instead of the header returned from the API response.
- # This is something we can remove in latter major bumps.
- # pylint: disable=unused-argument
- def get_retry_after_time(self, attempt_number: int, retry_after_header: Optional[str]) -> Number:
- """
- Get the amount of time to wait before retrying the API request, using the attempt number that failed to
- calculate the retry time for the next retry attempt.
-
- If the Retry-After header is supplied, use it; otherwise, use exponential backoff
- For 202 Accepted (thumbnail or file not ready) and 429 (too many requests), retry later, after a delay
- specified by the Retry-After header.
- For 5xx Server Error, retry later, after a delay; use exponential backoff to determine the delay.
-
- :param attempt_number: How many attempts at this request have already been tried.
- :param retry_after_header: Value of the 'Retry-After` response header.
- :return: Number of seconds to wait before retrying.
- """
- if retry_after_header is not None:
- try:
- return int(retry_after_header)
- except (ValueError, TypeError):
- pass
- min_randomization = 1 - self._retry_randomization_factor
- max_randomization = 1 + self._retry_randomization_factor
- randomization = (random.uniform(0, 1) * (max_randomization - min_randomization)) + min_randomization
- exponential = math.pow(2, attempt_number)
- return exponential * self._retry_base_interval * randomization
-
- @staticmethod
- def _raise_on_unsuccessful_request(network_response: 'NetworkResponse', request: '_BoxRequest', raised_exception: Exception) -> None:
- """
- Raise an exception if the request was unsuccessful.
-
- :param network_response:
- The network response which is being tested for success.
- :param request:
- The API request that could be unsuccessful.
- """
- if network_response is None:
- raise raised_exception
-
- if not network_response.ok:
- response_json = {}
- try:
- response_json = network_response.json()
- except ValueError:
- pass
- raise BoxAPIException(
- status=network_response.status_code,
- headers=network_response.headers,
- code=response_json.get('code', None) or response_json.get('error', None),
- message=response_json.get('message', None) or response_json.get('error_description', None),
- request_id=response_json.get('request_id', None),
- url=request.url,
- method=request.method,
- context_info=response_json.get('context_info', None),
- network_response=network_response
- )
-
- if not Session._is_json_response_if_expected(network_response, request):
- raise BoxAPIException(
- status=network_response.status_code,
- headers=network_response.headers,
- message='Non-json response received, while expecting json response.',
- url=request.url,
- method=request.method,
- network_response=network_response,
- )
-
- @staticmethod
- def _is_json_response_if_expected(network_response: 'NetworkResponse', request: '_BoxRequest') -> bool:
- """
- Validate that the response is json if the request expects json response.
-
- :param network_response:
- The network response which is being tested for success.
- :param request:
- The API request that could be unsuccessful.
- """
- return not request.expect_json_response or is_json_response(network_response)
-
- def _prepare_and_send_request(
- self,
- method: str,
- url: str,
- headers: dict = None,
- auto_session_renewal: bool = True,
- expect_json_response: bool = True,
- **kwargs: Any
- ) -> 'NetworkResponse':
- """
- Prepare a request to be sent to the Box API.
-
- :param method:
- The HTTP verb to use to make the request.
- :param url:
- The request URL.
- :param headers:
- Headers to include with the request.
- :param auto_session_renewal:
- Whether to automatically renew the session if the request fails due to an expired access token.
- :param expect_json_response:
- Whether the response content should be json.
- """
- files = kwargs.get('files')
- kwargs['file_stream_positions'] = None
- if files:
- kwargs['file_stream_positions'] = {name: file_tuple[1].tell() for name, file_tuple in files.items()}
- attempt_number = 0
- request_headers = self._get_request_headers()
- request_headers.update(headers or {})
-
- request = self.box_request_constructor(
- url=url,
- method=method,
- headers=request_headers,
- auto_session_renewal=auto_session_renewal,
- expect_json_response=expect_json_response,
- )
-
- skip_retry_codes = kwargs.pop('skip_retry_codes', set())
-
- raised_exception = None
- try:
- network_response = self._send_request(request, **kwargs)
- reauthentication_needed = network_response.status_code == 401
- except RequestException as request_exc:
- raised_exception = request_exc
- network_response = None
- if 'EOF occurred in violation of protocol' in str(request_exc):
- reauthentication_needed = True
- elif any(text in str(request_exc) for text in [
- 'Connection aborted', 'Connection broken', 'Connection reset'
- ]):
- reauthentication_needed = False
- else:
- raise
-
- while True:
- retry = self._get_retry_request_callable(
- network_response, attempt_number, request, skip_retry_codes, reauthentication_needed, **kwargs)
-
- if retry is None or attempt_number >= API.MAX_RETRY_ATTEMPTS:
- if network_response is None:
- raise raised_exception
- break
-
- attempt_number += 1
- self._logger.debug('Retrying request')
- network_response = retry(request, **kwargs)
-
- self._raise_on_unsuccessful_request(network_response, request, raised_exception)
-
- return network_response
-
- def _get_retry_request_callable(
- self,
- network_response: Optional['NetworkResponse'],
- attempt_number: int,
- request: '_BoxRequest',
- skip_retry_codes: Set[int],
- session_renewal_needed: bool = False,
- **kwargs: Any
- ) -> Optional[Callable]:
- """
- Get a callable that retries a request for certain types of failure.
-
- For 202 Accepted (thumbnail or file not ready) and 429 (too many requests), retry later, after a delay
- specified by the Retry-After header.
- For 5xx Server Error, retry later, after a delay; use exponential backoff to determine the delay.
-
- Otherwise, return None.
-
- :param network_response:
- The response from the Box API.
- :param attempt_number:
- How many attempts at this request have already been tried. Used for exponential backoff calculations.
- :param request:
- The API request that could require retrying.
- :return:
- Callable that, when called, will retry the request. Takes the same parameters as :meth:`_send_request`.
- """
- # pylint:disable=unused-argument
- # pylint:disable=line-too-long
- if network_response is None or (network_response.ok and request.method == 'GET' and not self._is_json_response_if_expected(network_response, request)):
- return partial(
- self._network_layer.retry_after,
- self.get_retry_after_time(attempt_number, None),
- self._send_request,
- )
- code = network_response.status_code
-
- if (code in (202, 429) or code >= 500) and code not in skip_retry_codes and not self._is_server_auth_type(kwargs):
- return partial(
- self._network_layer.retry_after,
- self.get_retry_after_time(attempt_number, network_response.headers.get('Retry-After', None)),
- self._send_request,
- )
- return None
-
- def _is_server_auth_type(self, kwargs: dict) -> bool:
- data = kwargs.get('data', {})
- grant_type = None
- try:
- if 'grant_type' in data:
- grant_type = data['grant_type']
- except TypeError:
- pass
- return grant_type in (self._JWT_GRANT_TYPE, self._CCG_GRANT_TYPE)
-
- def _get_request_headers(self) -> dict:
- return self._default_headers.copy()
-
- def _prepare_proxy(self) -> Optional[dict]:
- """
- Prepares basic authenticated and unauthenticated proxies for requests.
-
- :return:
- A prepared proxy dict to send along with the request. None if incorrect parameters were passed.
- """
- proxy = {}
- if self._proxy_config.URL is None:
- return None
- if self._proxy_config.AUTH and {'user', 'password'} <= set(self._proxy_config.AUTH):
- host = self._proxy_config.URL
- address = host.split('//')[1]
- proxy_string = f'http://{self._proxy_config.AUTH.get("user", None)}:' \
- f'{self._proxy_config.AUTH.get("password", None)}@{address}'
- elif self._proxy_config.AUTH is None:
- proxy_string = self._proxy_config.URL
- else:
- raise BoxException("The proxy auth dict you provided does not match pattern "
- "{'user': 'example_user', 'password': 'example_password'}")
- proxy['http'] = proxy_string
- proxy['https'] = proxy['http']
-
- return proxy
-
- def _send_request(self, request: '_BoxRequest', **kwargs: Any) -> 'NetworkResponse':
- """
- Make a request to the Box API.
-
- :param request:
- The API request to send.
- """
- # Reset stream positions to what they were when the request was made so the same data is sent even if this
- # is a retried attempt.
- files, file_stream_positions, stream_file_content = (
- kwargs.get('files'), kwargs.pop('file_stream_positions'), kwargs.pop('stream_file_content', True))
- request_kwargs = self._default_network_request_kwargs.copy()
- request_kwargs.update(kwargs)
- proxy_dict = self._prepare_proxy()
- if proxy_dict is not None:
- request_kwargs.update({'proxies': proxy_dict})
- if files and file_stream_positions:
- for name, position in file_stream_positions.items():
- files[name][1].seek(position)
- if stream_file_content:
- data = request_kwargs.pop('data', {})
- multipart_stream = MultipartStream(data, files)
- request_kwargs['data'] = multipart_stream
- del request_kwargs['files']
- request.headers['Content-Type'] = multipart_stream.content_type
- request.access_token = request_kwargs.pop('access_token', None)
-
- # send the request
- network_response = self._network_layer.request(
- request.method,
- request.url,
- access_token=request.access_token,
- headers=request.headers,
- log_response_content=request.expect_json_response,
- **request_kwargs
- )
-
- return network_response
-
-
-class AuthorizedSession(Session):
- """
- Box API authorized session. Provides auth, automatic retry of failed requests, and session renewal.
- """
-
- def __init__(self, oauth: 'OAuth2', **kwargs: Any):
- """
- :param oauth:
- OAuth2 object used by the session to authorize requests.
- :param session:
- The Box API session to wrap for authorization.
- """
- super().__init__(**kwargs)
- self._oauth = oauth
-
- def get_constructor_kwargs(self) -> dict:
- kwargs = super().get_constructor_kwargs()
- kwargs['oauth'] = self._oauth
- return kwargs
-
- def _renew_session(self, access_token_used: Optional[str]) -> str:
- """
- Renews the session by refreshing the access token.
-
- :param access_token_used:
- The access token that's currently being used by the session, that needs to be refreshed.
- """
- new_access_token, _ = self._oauth.refresh(access_token_used)
- return new_access_token
-
- def _get_retry_request_callable(
- self,
- network_response: Optional['NetworkResponse'],
- attempt_number: int,
- request: '_BoxRequest',
- skip_retry_codes: Set[int],
- session_renewal_needed: bool = False,
- **kwargs: Any
- ) -> Callable:
- """
- Get a callable that retries a request for certain types of failure.
-
- For 401 Unauthorized responses, renew the session by refreshing the access token; then retry.
-
- Otherwise, defer to baseclass implementation.
-
- :param network_response:
- The response from the Box API.
- :param attempt_number:
- How many attempts at this request have already been tried. Used for exponential backoff calculations.
- :param request:
- The API request that could require retrying.
- :return:
- Callable that, when called, will retry the request. Takes the same parameters as :meth:`_send_request`.
- """
- if request.auto_session_renewal and session_renewal_needed:
- self._renew_session(request.access_token)
- request.auto_session_renewal = False
- return self._send_request
-
- return super()._get_retry_request_callable(
- network_response,
- attempt_number,
- request,
- skip_retry_codes,
- session_renewal_needed,
- **kwargs
- )
-
- def _send_request(self, request: '_BoxRequest', **kwargs: Any) -> 'NetworkResponse':
- """
- Make a request to the Box API.
-
- :param request:
- The API request to send.
- """
- # Since there can be session renewal happening in the middle of preparing the request, it's important to be
- # consistent with the access_token being used in the request.
- access_token = self._oauth.access_token
- if request.auto_session_renewal and access_token is None:
- access_token = self._renew_session(None)
- request.auto_session_renewal = False
- authorization_header = {'Authorization': f'Bearer {access_token}'}
- request.headers.update(authorization_header)
- kwargs['access_token'] = access_token
- return super()._send_request(request, **kwargs)
diff --git a/boxsdk/util/__init__.py b/boxsdk/util/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/boxsdk/util/api_call_decorator.py b/boxsdk/util/api_call_decorator.py
deleted file mode 100644
index db963b4fc..000000000
--- a/boxsdk/util/api_call_decorator.py
+++ /dev/null
@@ -1,68 +0,0 @@
-from functools import update_wrapper, wraps
-from typing import Callable, Any
-
-from ..object.cloneable import Cloneable
-
-
-def api_call(method: Callable) -> Any:
- """
- Designates the decorated method as one that makes a Box API call.
- The decorated method can then accept a new keyword argument `extra_network_parameters`,
- a dictionary of key-value pairs to be passed to the network layer for API
- calls made by the method.
-
- The decorated method must belong to a subclass of `Cloneable` as using this
- decorator and then passing a `extra_network_parameters` parameter to the method will cause
- the object's clone method to be called.
-
- :param method:
- The method to decorate.
- :return:
- A wrapped method that can pass extra request data to the network layer.
- """
- return APICallWrapper(method)
-
-
-class APICallWrapper:
-
- def __init__(self, func_that_makes_an_api_call: Callable):
- super().__init__()
- self._func_that_makes_an_api_call = func_that_makes_an_api_call
- self.__name__ = func_that_makes_an_api_call.__name__
- update_wrapper(self, func_that_makes_an_api_call)
-
- def __call__(self, cloneable_instance: 'Cloneable', *args: Any, **kwargs: Any) -> Any:
- return self.__get__(cloneable_instance, type(cloneable_instance))(*args, **kwargs)
-
- def __get__(self, _instance: Any, owner: Any) -> Any:
- # `APICallWrapper` is imitating a function. For native functions,
- # ```func.__get__(None, cls)``` always returns `func`.
- if _instance is None:
- return self
-
- if isinstance(owner, type) and not issubclass(owner, Cloneable):
- raise TypeError(
- f"descriptor {self.__name__!r} must be owned by a 'Cloneable' subclass, not {owner.__name__}"
- )
- expected_type = owner or Cloneable
- if not isinstance(_instance, expected_type):
- raise TypeError(
- f"descriptor {self.__name__!r} for {expected_type.__name__!r} objects "
- f"doesn't apply to {_instance.__class__.__name__!r} object"
- )
-
- @wraps(self._func_that_makes_an_api_call)
- def call(instance, *args, **kwargs):
- extra_network_parameters = kwargs.pop('extra_network_parameters', None)
- if extra_network_parameters:
- # If extra_network_parameters is specified, then clone the instance, and specify the parameters
- # as the defaults to be used.
- instance = instance.clone(instance.session.with_default_network_request_kwargs(extra_network_parameters))
-
- method = self._func_that_makes_an_api_call.__get__(instance, owner)
- return method(*args, **kwargs)
-
- # Since the caller passed a non-`None` instance to `__get__()`, they
- # want a bound method back, not an unbound function. Thus, we must bind
- # `call()` to `_instance` and then return that bound method.
- return call.__get__(_instance, owner)
diff --git a/boxsdk/util/chunked_uploader.py b/boxsdk/util/chunked_uploader.py
deleted file mode 100644
index 85c4d860c..000000000
--- a/boxsdk/util/chunked_uploader.py
+++ /dev/null
@@ -1,205 +0,0 @@
-import hashlib
-from concurrent.futures import ThreadPoolExecutor, as_completed, Future
-from threading import Lock
-from typing import IO, TYPE_CHECKING, Optional, List
-
-from boxsdk.exception import BoxException
-from boxsdk.config import API
-
-if TYPE_CHECKING:
- from boxsdk.object.file import File
- from boxsdk.object.upload_session import UploadSession
-
-
-class ChunkedUploader:
-
- def __init__(self, upload_session: 'UploadSession', content_stream: IO[bytes], file_size: int):
- """
- The initializer for the :class:`ChunkedUploader`
-
- :param upload_session:
- The upload session for doing the chunked uploader.
- :param content_stream:
- The file-like object to upload.
- :param file_size:
- The total size of the file for the chunked upload.
- :returns:
- An intialized`ChunkedUploader` object.
- """
- self._upload_session = upload_session
- self._content_stream = content_stream
- self._file_size = file_size
- self._part_array = []
- self._sha1 = hashlib.sha1()
- self._part_definitions = {}
- self._is_aborted = False
- self._lock = Lock()
- self._inflight_parts = {}
- self._chunk_index = 0
- self._executor = ThreadPoolExecutor(max_workers=API.CHUNK_UPLOAD_THREADS)
-
- def start(self) -> Optional['File']:
- """
- Starts the process of chunk uploading a file. Should return file. If commit was not processed will return None.
- You can call ChunkedUploader.resume to retry committing upload.
-
- :returns:
- An uploaded :class:`File` or None if session was not processed
- """
- if self._is_aborted:
- raise BoxException('The upload has been previously aborted. Please retry upload with a new upload session.')
-
- futures = [self._executor.submit(self._upload_part) for _ in range(self._upload_session.total_parts)]
- self._upload(futures)
- return self._commit_and_erase_stream_reference_when_succeed()
-
- def resume(self) -> Optional['File']:
- """
- Resumes the process of chunk uploading a file from where upload failed.
- Should return file. If commit was not processed will return None.
- You can call ChunkedUploader.resume to retry committing upload.
-
- :returns:
- An uploaded :class:`File` or None if session was not processed
- """
- if self._is_aborted:
- raise BoxException('The upload has been previously aborted. Please retry upload with a new upload session.')
-
- self._executor = ThreadPoolExecutor(max_workers=API.CHUNK_UPLOAD_THREADS)
- parts = self._upload_session.get_parts()
- for part in parts:
- self._part_definitions[part['offset']] = part
-
- with self._lock:
- futures = [self._executor.submit(lambda item=part: self._upload_part(item)) for part in self._inflight_parts.values()]
- for _ in range(self._upload_session.total_parts - self._chunk_index - len(self._inflight_parts)):
- futures.append(self._executor.submit(self._upload_part))
-
- self._upload(futures)
- return self._commit_and_erase_stream_reference_when_succeed()
-
- def abort(self) -> bool:
- """
- Abort an upload session, cancelling the upload and removing any parts that have already been uploaded.
-
- :returns:
- A boolean indication success of the upload abort.
- """
- self._content_stream = None
- self._part_definitions = {}
- self._inflight_parts = {}
- self._is_aborted = True
- return self._upload_session.abort()
-
- def _upload(self, futures: List[Future]) -> None:
- """
- Utility function for looping through all parts of the upload session and uploading them.
- """
- try:
- for future in as_completed(futures):
- future.result()
- except Exception as exc:
- self._executor.shutdown(wait=True)
- raise exc
-
- self._part_array = sorted(self._part_definitions.values(), key=lambda part: part['offset'])
-
- def _upload_part(self, task=None):
- if isinstance(task, InflightPart):
- next_part = task
- else:
- with self._lock:
- next_part = self._get_next_part()
- self._sha1.update(next_part.chunk)
-
- with self._lock:
- if self._part_definitions.get(next_part.offset):
- return
- self._inflight_parts[next_part.offset] = next_part
-
- uploaded_part = next_part.upload()
-
- with self._lock:
- self._part_definitions[next_part.offset] = uploaded_part
- del self._inflight_parts[next_part.offset]
-
- def _get_next_part(self) -> 'InflightPart':
- """
- Retrieves the next :class:`InflightPart` that needs to be uploaded
-
- :returns:
- The :class:`InflightPart` object to be uploaded next.
- """
- copied_length = 0
- chunk = b''
- offset = self._chunk_index * self._upload_session.part_size
- self._chunk_index += 1
- while copied_length < self._upload_session.part_size:
- bytes_read = self._content_stream.read(self._upload_session.part_size - copied_length)
- if bytes_read is None:
- # stream returns none when no bytes are ready currently but there are
- # potentially more bytes in the stream to be read.
- continue
- if not bytes_read:
- # stream is exhausted.
- break
- chunk += bytes_read
- copied_length += len(bytes_read)
- return InflightPart(offset, chunk, self._upload_session, self._file_size)
-
- def _commit_and_erase_stream_reference_when_succeed(self):
- content_sha1 = self._sha1.digest()
- commit_result = self._upload_session.commit(content_sha1=content_sha1, parts=self._part_array)
- # Remove file stream reference when uploading file succeeded
- if commit_result is not None:
- self._content_stream = None
- self._executor.shutdown(wait=True)
- return commit_result
-
-
-class InflightPart:
-
- def __init__(self, offset: int, chunk: bytes, upload_session: 'UploadSession', total_size: int):
- """
- The initializer for the :class:`InflightPart` object.
-
- :param offset:
- The offset for the :class:`InflightPart` that represents the position of the part to be uploaded
- :param chunk:
- The chunk in bytes to be uploaded.
- :param upload_session:
- The :class:`UploadSession` for the :class:`InflightPart`.
- :param total_size:
- The total size of the file to be chunked uploaded.
- """
- self._offset = offset
- self._chunk = chunk
- self._upload_session = upload_session
- self._total_size = total_size
-
- @property
- def offset(self) -> int:
- """
- Getter for the offset of the :class:`InflightPart`
- """
- return self._offset
-
- @property
- def chunk(self) -> bytes:
- """
- Getter for the chunk of the :class:`InflightPart`
- """
- return self._chunk
-
- def upload(self) -> dict:
- """
- Upload method for the :class:`InflightPart`
-
- :returns:
- The uploaded part record.
- """
- return self._upload_session.upload_part_bytes(
- part_bytes=self.chunk,
- offset=self.offset,
- total_size=self._total_size
- )
diff --git a/boxsdk/util/datetime_formatter.py b/boxsdk/util/datetime_formatter.py
deleted file mode 100644
index ba3f0ab5c..000000000
--- a/boxsdk/util/datetime_formatter.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from datetime import datetime
-from typing import Union, Optional
-
-from dateutil import parser
-
-
-def normalize_date_to_rfc3339_format(date: Union[None, datetime, str]) -> Optional[str]:
- """
- Normalizes any datetime string supported by dateutil library or a datetime.datetime object to rfc3339 format.
-
- :param date: datetime str or datetime object
- :return: date-time str in rfc3339 format
- """
- if date is None:
- return None
-
- if isinstance(date, str):
- date = parser.parse(date)
-
- if not isinstance(date, datetime):
- raise TypeError(f"Got unsupported type {date.__class__.__name__!r} for date.")
-
- timezone_aware_datetime = date if date.tzinfo is not None else date.astimezone()
- return timezone_aware_datetime.isoformat(timespec='seconds')
diff --git a/boxsdk/util/default_arg_value.py b/boxsdk/util/default_arg_value.py
deleted file mode 100644
index ca217a8df..000000000
--- a/boxsdk/util/default_arg_value.py
+++ /dev/null
@@ -1 +0,0 @@
-SDK_VALUE_NOT_SET = object()
diff --git a/boxsdk/util/deprecation_decorator.py b/boxsdk/util/deprecation_decorator.py
deleted file mode 100644
index 89e893caa..000000000
--- a/boxsdk/util/deprecation_decorator.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import warnings
-from typing import Callable, Any
-
-
-def deprecated(message: str):
- def deprecated_decorator(func: Callable) -> Any:
- def deprecated_func(*args, **kwargs):
- warnings.simplefilter('default', DeprecationWarning)
- warnings.warn(f'{func.__name__} is a deprecated function. {message}',
- category=DeprecationWarning,
- stacklevel=2)
- return func(*args, **kwargs)
- return deprecated_func
- return deprecated_decorator
-
-
-def deprecated_param(*, name: str, position: int, message: str):
- def deprecated_decorator(func: Callable) -> Any:
- def deprecated_func(*args, **kwargs):
- if len(args) >= position + 1 or name in kwargs:
- warnings.simplefilter('default', DeprecationWarning)
- warnings.warn(
- f'{func.__name__} function parameter `{name}` at position {position} is deprecated. {message}',
- category=DeprecationWarning,
- stacklevel=2
- )
- return func(*args, **kwargs)
- return deprecated_func
- return deprecated_decorator
diff --git a/boxsdk/util/enum.py b/boxsdk/util/enum.py
deleted file mode 100644
index 2296c5ae5..000000000
--- a/boxsdk/util/enum.py
+++ /dev/null
@@ -1,134 +0,0 @@
-# pylint:disable=no-value-for-parameter
-
-from collections import OrderedDict
-from itertools import chain
-
-from enum import EnumMeta
-
-__all__ = ['ExtendableEnumMeta']
-
-from typing import Any
-
-
-class ExtendableEnumMeta(EnumMeta):
- """A metaclass for enum hierarchies.
-
- This allows you to define hierarchies such as this:
-
- from box.util.compat import with_metaclass
-
- class EnumBase(with_metaclass(ExtendableEnumMeta, Enum)): pass
-
- class Enum1(EnumBase):
- A = 'A'
-
- class Enum2(EnumBase): pass
-
- class Enum2_1(Enum2):
- B = 'B'
-
- class Enum2_2(Enum2):
- C = 'C'
-
- and have all members be accessible on EnumBase (as well as have all members
- of Enum2_1 and Enum2_2 be available on Enum2) as if they had been defined
- there.
-
- Non-leaf classes still may not have members directly defined on them, as
- with standard enums.
-
- Most of the usual enum magic methods are extended: __contains__, __dir__,
- __getitem__, __getattr__, __iter__, __len__, and __reversed__. Only __new__
- is not extended; instead, a new method `lookup` is provided. The
- __members__ property is also extended.
- """
-
- def lookup(cls, value: Any) -> Any:
- """Custom value lookup, which does recursive lookups on subclasses.
-
- If this is a leaf enum class with defined members, this acts the same
- as __new__().
-
- But if this is a base class with no defined members of its own, it
- tries doing a value lookup on all its subclasses until it finds the
- value.
-
- NOTE: Because of the implementation details of Enum, this must be a new
- classmethod, and can't be implemented as __new__() [1].
-
- [1]
-
- :param value:
- The value to look up. Can be a value, or an enum instance.
- :raises:
- :class:`ValueError` if the value isn't found anywhere.
- """
- try:
- return cls(value)
- except (ValueError, TypeError) as value_error:
- for subclass in cls.__subclasses__():
- try:
- return subclass.lookup(value)
- except (ValueError, TypeError):
- pass
- raise value_error
-
- @property
- def __members__(cls):
- members = OrderedDict(super().__members__)
- for subclass in cls.__subclasses__():
- members.update(subclass.__members__)
- return members
-
- def __contains__(cls, member):
- try:
- if super().__contains__(member):
- return True
- except TypeError:
- return False
-
- def in_(subclass):
- return member in subclass
-
- return any(map(in_, cls.__subclasses__()))
-
- def __dir__(cls):
- return list(set(super().__dir__()).union(*map(dir, cls.__subclasses__())))
-
- def __getitem__(cls, name):
- try:
- return super().__getitem__(name)
- except KeyError as key_error:
- for subclass in cls.__subclasses__():
- try:
- return subclass[name]
- except KeyError:
- pass
- raise key_error
-
- def __getattr__(cls, name):
- try:
- return super().__getattr__(name)
- except AttributeError as attribute_error:
- try:
- # If the super() call fails, don't call getattr() on all of the
- # subclasses. Instead, use __getitem__ to do this. This is
- # because we don't want to grab arbitrary attributes from
- # subclasses, only enum members. For enum members, __getattr__
- # and __getitem__ have the same behavior. And __getitem__ has
- # the advantage of never grabbing anything other than enum
- # members.
- return cls[name] # pylint:disable=unsubscriptable-object
- except KeyError:
- pass
-
- raise attribute_error
-
- def __iter__(cls):
- return chain(super().__iter__(), chain.from_iterable(map(iter, cls.__subclasses__())))
-
- def __len__(cls):
- return super().__len__() + sum(map(len, cls.__subclasses__()))
-
- def __reversed__(cls):
- return reversed(list(cls))
diff --git a/boxsdk/util/json.py b/boxsdk/util/json.py
deleted file mode 100644
index 8ad709471..000000000
--- a/boxsdk/util/json.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from typing import TYPE_CHECKING, Union
-
-if TYPE_CHECKING:
- from boxsdk.session.box_response import BoxResponse
- from boxsdk import NetworkResponse
-
-
-def is_json_response(network_response: Union['BoxResponse', 'NetworkResponse']) -> bool:
- """Return whether or not the network response content is json.
-
- :param network_response:
- The response from the Box API.
- """
- try:
- network_response.json()
- return True
- except ValueError:
- return False
diff --git a/boxsdk/util/log.py b/boxsdk/util/log.py
deleted file mode 100644
index 49278adcb..000000000
--- a/boxsdk/util/log.py
+++ /dev/null
@@ -1,115 +0,0 @@
-import logging
-import re
-import sys
-
-from collections.abc import Mapping
-from typing import Union, IO, Optional
-
-_no_logger = object()
-
-
-class Logging:
- _has_setup = False
- KEYS_TO_SANITIZE = (
- 'Authorization',
- 'access_token',
- 'refresh_token',
- 'subject_token',
- 'token',
- 'client_id',
- 'client_secret',
- 'code',
- 'shared_link',
- 'download_url',
- 'jwt_private_key',
- 'jwt_private_key_passphrase',
- 'password',
- )
-
- PROXY_KEYS_TO_SANITIZE = (
- 'http',
- 'https',
- )
-
- def setup_logging(self, stream_or_file=_no_logger, debug=False, name=None):
- if not self._has_setup:
- self._has_setup = True
- self._setup_logging(stream_or_file, debug, name)
-
- @staticmethod
- def _setup_logging(stream_or_file=_no_logger, debug=False, name=None):
- logger = logging.getLogger(name)
- if isinstance(stream_or_file, str):
- logger.addHandler(logging.FileHandler(stream_or_file, mode='a'))
- elif stream_or_file is not _no_logger:
- logger.addHandler(logging.StreamHandler(stream_or_file or sys.stdout))
- logger.setLevel(logging.DEBUG if debug else logging.INFO)
-
- @staticmethod
- def sanitize_value(value):
- return f'---{value[-4:]}'
-
- @staticmethod
- def sanitize_proxy_value(value: str) -> str:
- return re.sub(
- '^(.*://)(.*):(.*)(@.*)$',
- lambda repl: f'{repl.group(1)}{"---"}:{"---"}{repl.group(4)}',
- value
- )
-
- def sanitize_dictionary(self, dictionary: Mapping) -> Mapping:
- if not isinstance(dictionary, Mapping):
- return dictionary
- sanitized_dictionary = {}
- for key, value in dictionary.items():
- if key in self.KEYS_TO_SANITIZE and isinstance(value, str):
- sanitized_dictionary[key] = self.sanitize_value(value)
- elif key in self.PROXY_KEYS_TO_SANITIZE and isinstance(value, str):
- sanitized_dictionary[key] = self.sanitize_proxy_value(value)
- elif isinstance(value, Mapping):
- sanitized_dictionary[key] = self.sanitize_dictionary(value)
- else:
- sanitized_dictionary[key] = value
- return sanitized_dictionary
-
-
-_logging = Logging()
-
-
-def setup_logging(
- stream_or_file: Optional[Union[str, IO]] = _no_logger,
- debug: Optional[bool] = False,
- name: Optional[str] = None
-) -> None:
- """
- Create a logger for communicating with the user or writing to log files.
- Sets the level to INFO or DEBUG, depending on the debug flag.
-
- If a stream or file is passed (or None is passed to stream_or_file), then
- a handler to that stream or file (stdout for None) is added to the logger.
-
- :param stream_or_file:
- The destination of the log messages. If None, stdout will be used.
- :param debug:
- Whether or not the logger will be at the DEBUG level (if False, the logger will be at the INFO level).
- :param name:
- The logging channel. If None, a root logger will be created.
- """
- _logging.setup_logging(stream_or_file, debug, name)
-
-
-def sanitize_dictionary(dictionary: Mapping) -> dict:
- """
- Get a copy of a dictionary that has sensitive information redacted. Should be called on objects that will be
- logged or printed.
-
- :param dictionary: Dictionary that may contain sensitive information.
- :return: Copy of the dictionary with sensitive information redacted.
- """
- return _logging.sanitize_dictionary(dictionary)
-
-
-logging.getLogger(__name__).addHandler(logging.NullHandler())
-
-
-__all__ = ['setup_logging', 'sanitize_dictionary']
diff --git a/boxsdk/util/lru_cache.py b/boxsdk/util/lru_cache.py
deleted file mode 100644
index 88581909e..000000000
--- a/boxsdk/util/lru_cache.py
+++ /dev/null
@@ -1,45 +0,0 @@
-from collections import OrderedDict
-from typing import Any
-
-
-class LRUCache:
- def __init__(self, capacity: int = 512):
- """
- :param capacity:
- The Maximum number of key-value pairs can be cached.
- """
- super().__init__()
- self.capacity = capacity
- self.cache = OrderedDict()
-
- def get(self, key: str) -> Any:
- """
- Look up the value in cache using the associated key. Returns the value if found.
- Raises :class:`KeyError` otherwise.
-
- :param key:
- The key used to look up the cache.
- :return:
- The value associated with the key if exists.
- :raises:
- :class:`KeyError` if the key doesn't exist.
- """
- value = self.cache.pop(key)
- self.cache[key] = value
- return value
-
- def set(self, key: str, value: Any = None):
- """
- Store the key-value pair to cache.
-
- :param key:
- The key associated with the value to be stored. It's used to look up the cache.
- :param value:
- The value to be stored.
- """
- try:
- self.cache.pop(key)
- except KeyError:
- if len(self.cache) >= self.capacity:
- self.cache.popitem(last=False)
- self.cache[key] = value
diff --git a/boxsdk/util/multipart_stream.py b/boxsdk/util/multipart_stream.py
deleted file mode 100644
index b7b7a5be0..000000000
--- a/boxsdk/util/multipart_stream.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from collections import OrderedDict
-
-from requests_toolbelt.multipart.encoder import MultipartEncoder
-
-
-class MultipartStream(MultipartEncoder):
- """
- Subclass of the requests_toolbelt's :class:`MultipartEncoder` that ensures that data
- is encoded before files. This allows a server to process information in the data before
- receiving the file bytes.
- """
- def __init__(self, data, files):
- fields = OrderedDict()
- for k in data:
- fields[k] = data[k]
- for k in files:
- fields[k] = files[k]
- super().__init__(fields)
diff --git a/boxsdk/util/shared_link.py b/boxsdk/util/shared_link.py
deleted file mode 100644
index 03b4e2f7e..000000000
--- a/boxsdk/util/shared_link.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def get_shared_link_header(shared_link: str, password: str = None) -> dict:
- """
- Gets the HTTP header required to use a shared link to grant access to a shared item.
-
- :param shared_link:
- The shared link.
- :param password:
- The password for the shared link.
- :return:
- The item referred to by the shared link.
- """
- shared_link_password = f'&shared_link_password={password}' if password is not None else ''
- box_api_header = f'shared_link={shared_link}{shared_link_password}'
- return {'BoxApi': box_api_header}
diff --git a/boxsdk/util/text_enum.py b/boxsdk/util/text_enum.py
deleted file mode 100644
index f9f3a40f3..000000000
--- a/boxsdk/util/text_enum.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from enum import Enum
-
-
-class TextEnum(str, Enum):
- def __repr__(self):
- return self._value_ # pylint:disable=no-member
-
- def __str__(self):
- return str(self.value) # pylint:disable=no-member
diff --git a/boxsdk/util/translator.py b/boxsdk/util/translator.py
deleted file mode 100644
index 8e39cd858..000000000
--- a/boxsdk/util/translator.py
+++ /dev/null
@@ -1,172 +0,0 @@
-from collections import ChainMap
-import inspect
-
-__all__ = list(map(str, ['Translator']))
-
-from typing import Any, TYPE_CHECKING, Dict
-
-if TYPE_CHECKING:
- from boxsdk.object.base_api_json_object import BaseAPIJSONObjectMeta
- from boxsdk.session.session import Session
-
-
-def _get_object_id(obj: dict) -> Any:
- """
- Gets the ID for an API object.
-
- :param obj:
- The API object
- :return:
- """
- return obj.get('id', None)
-
-
-class Translator(ChainMap):
- """
- Translate item responses from the Box API to Box objects.
-
- Also acts as a :class:`Mapping` from type names to Box object classes.
-
- There exists a global default `Translator`, containing the default API
- object classes defined by the SDK. Custom `Translator` instances can be
- created to extend the default `Translator` with custom subclasses.
-
- A `Translator` is a :class:`ChainMap`, so that one translator can "extend"
- others. The most common scenario would be a custom, non-global
- `Translator` that extends only the default translator, to register 0 or
- more new classes. But more complex inheritance is also allowed, in case
- that is useful.
- """
-
- __slots__ = ()
-
- # :attr _default_translator:
- # A global `Translator` containing the default API object classes
- # defined by the SDK. By default, new `Translator` instances will
- # "extend" this one, so that the global registrations are reflected
- # automatically.
- #
- # NOTE: For convenience and backwards-compatability, developers are
- # allowed to register their own custom subclasses with
- # `_default_translator`, but are encouraged not to. The default
- # translator may change or be removed in any major or minor release.
- # Additionally, it has the usual hazards of mutable global state.
- # The supported and recommended ways for registering custom subclasses
- # are:
- #
- # - Constructing a new `Translator`, calling `Translator.register()` as
- # necessary, and passing it to the `BoxSession` constructor.
- # - Calling `session.translator.register()` on an existing
- # `BoxSession`.
- # - Calling `client.translator.register()` on an existing `Client`.
- # :type _default_translator: :class:`Translator`
- _default_translator = {} # Will be set to a `Translator` instance below, after the class is defined.
-
- def __init__(self, *translation_maps: Dict[str, 'BaseAPIJSONObjectMeta'], **kwargs: Any):
- """Baseclass override.
-
- :param translation_maps:
- (variadic) The same as the `maps` variadic parameter to
- :class:`ChainMap`, except restricted to maps from type names to Box
- object classes.
- :param extend_default_translator:
- (optional, keyword-only) If `True` (the default),
- `_default_translator` is appended to the end of `translation_maps`.
- When this functionality is used, the new `Translator` will inherit
- all of the global registrations.
- :type extend_default_translator: `bool`
- :param new_child:
- (optional, keyword-only) If `True` (the default), a new empty
- `dict` is prepended to the front of `translation_maps`. Either way,
- the resulting `Translator` starts out with the same key-value
- pairs. But when this is `False`, the first item in
- `translation_maps` will be mutated by `__setitem__()` and
- `__delitem()__` calls, which will affect other references to it.
- Whereas when this is `True`, all items in `translation_maps` are
- safe from mutation in normal usage scenarios.
- :type new_child: `bool`
- """
- translation_maps = list(translation_maps)
- extend_default_translator = kwargs.pop('extend_default_translator', True)
- new_child = kwargs.pop('new_child', True)
- if extend_default_translator:
- translation_maps.append(self._default_translator)
- if new_child:
- translation_maps.insert(0, {})
- super().__init__(*translation_maps, **kwargs)
-
- def register(self, type_name: str, box_cls: 'BaseAPIJSONObjectMeta') -> Any:
- """Associate a Box object class to handle Box API item responses with the given type name.
-
- :param type_name:
- The type name to be registered.
- :param box_cls:
- The Box object class, which will be associated with the type name provided.
- """
- self[type_name] = box_cls
-
- def get(self, key: str, default: 'BaseAPIJSONObjectMeta' = None) -> 'BaseAPIJSONObjectMeta':
- """Get the box object class associated with the given type name.
-
- :param key:
- The type name to be translated.
- :param default:
- (optional) The default Box object class to return.
- Defaults to `BaseObject`.
- """
- # pylint:disable=import-outside-toplevel
- from boxsdk.object.base_object import BaseObject
- if default is None:
- default = BaseObject
- return super().get(key, default)
-
- def translate(self, session: 'Session', response_object: dict) -> Any:
- """
- Translate a given API response object into SDK classes, rescursively translating any subobjects.
-
- :param session:
- The SDK session to use for any objects that require a session (i.e. classes that make API calls)
- :param response_object:
- The JSON response object from the API, which will be translated
- :return:
- The translated object
- """
-
- if not isinstance(response_object, dict):
- return response_object
-
- translated_obj = {}
- object_type = response_object.get('type', None)
- object_class = self.get(object_type) if object_type is not None else None
- # Parent classes have the ability to skip fields that they do not want translated
- fields_to_skip = object_class.untranslated_fields() if object_class is not None else ()
- for key in response_object:
- if key in fields_to_skip:
- translated_obj[key] = response_object[key]
- continue
- if isinstance(response_object[key], dict):
- translated_obj[key] = self.translate(session, response_object[key])
- elif isinstance(response_object[key], list):
- translated_obj[key] = [self.translate(session, o) for o in response_object[key]]
- else:
- translated_obj[key] = response_object[key]
-
- # Try to translate any API object with a `type` property, except for metadata instances
- # The $type value in metadata instances isn't directly usable, so we avoid it altogether
- # NOTE: Currently, we represent metadata as just a `dict`, so there's no need to translate it anyway
- # Metadata field objects are another issue; they contain a 'type' property that doesn't really
- # map to a Box object. We probably want to treat these as just `dict`s, so they're excluded here
- if object_class is not None and '$type' not in translated_obj:
- param_values = {
- 'session': session,
- 'response_object': translated_obj,
- 'object_id': _get_object_id(translated_obj),
- }
- params = inspect.signature(object_class.__init__).parameters
- param_values = {p: param_values[p] for p in params if p in param_values}
- return object_class(**param_values)
-
- return translated_obj
-
-
-Translator._default_translator = Translator(extend_default_translator=False) # pylint:disable=protected-access
diff --git a/boxsdk/version.py b/boxsdk/version.py
deleted file mode 100644
index 6e9b3ce48..000000000
--- a/boxsdk/version.py
+++ /dev/null
@@ -1 +0,0 @@
-__version__ = '3.14.0'
diff --git a/demo/Advanced Auth Techniques.ipynb b/demo/Advanced Auth Techniques.ipynb
deleted file mode 100644
index 6407b7a26..000000000
--- a/demo/Advanced Auth Techniques.ipynb
+++ /dev/null
@@ -1,193 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "The Python SDK tries to make it easy to make requests to the Box API.\n",
- "\n",
- "Part of the ease is the fact that the SDK handles the OAuth2 dance, including token refresh, even for multithreaded applications.\n",
- "\n",
- "New to the SDK are some OAuth2 subclasses and mixins that enable the SDK to handle auth in a variety of advanced use cases:\n",
- "* Cooperative multiprocessing - share token pairs across python processes\n",
- "* Remote auth - make API requests on a local client, but handle auth on a remote server to avoid exposing a client secret on clients\n",
- "* Distributed cooperative multiprocessing - store token pairs in Redis; share among multiple processes or machines"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "from boxsdk import Client\n",
- "from boxsdk.auth.redis_managed_oauth2 import RedisManagedOAuth2"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "# Get a client ID and secret from a text file (to avoid exposing them in the notebook)\n",
- "with open('secrets.txt') as secrets:\n",
- " client_id = secrets.readline().strip()\n",
- " client_secret = secrets.readline().strip()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "# Instantiate a redis managed auth client\n",
- "auth = RedisManagedOAuth2(client_id=client_id, client_secret=client_secret)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 10,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "(u'g9katDPiv0C5DxcoDmzxxFzumMKpiH2z',\n",
- " u'pvGLrhHFdd70Ka7kPY1xxSAQ5RHAWrZBAuA4zbimV1o2Xrouvu0Ixl7iCERU7yTw')"
- ]
- },
- "execution_count": 10,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# Authenticate the instance using an auth code (obtained manually)\n",
- "auth.authenticate(auth_code='thZWxpiTRPhJpqZRNidr1vZLsmWpHRLI')"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "The auth instance automatically saves the tokens to redis.\n",
- "\n",
- "We can see the values directly in redis."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 13,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "1) \"g9katDPiv0C5DxcoDmzxxFzumMKpiH2z\"\r\n",
- "2) \"pvGLrhHFdd70Ka7kPY1xxSAQ5RHAWrZBAuA4zbimV1o2Xrouvu0Ixl7iCERU7yTw\"\r\n"
- ]
- }
- ],
- "source": [
- "!redis-cli hvals {str(auth.unique_id)}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 15,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "u'g9katDPiv0C5DxcoDmzxxFzumMKpiH2z'"
- ]
- },
- "execution_count": 15,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "auth.access_token"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "We can spin up another auth instance that will share tokens.\n",
- "\n",
- "We just need to use the same unique id."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 16,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'g9katDPiv0C5DxcoDmzxxFzumMKpiH2z'"
- ]
- },
- "execution_count": 16,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "auth2 = RedisManagedOAuth2(client_id=client_id, client_secret=client_secret, unique_id=auth.unique_id)\n",
- "auth2.access_token"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/demo/Development Client.ipynb b/demo/Development Client.ipynb
deleted file mode 100644
index 283b5b5d0..000000000
--- a/demo/Development Client.ipynb
+++ /dev/null
@@ -1,152 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "The `Client` is the centerpiece of the Box SDK. We provide several subclasses of the `Client` that can be especially useful during development of applications using the SDK.\n",
- "\n",
- "* The `LoggingClient` sets up logging to `stdout` to help visualize API calls made by the SDK.\n",
- "* The `DeveloperTokenClient` sets up auth using a developer token that you can get from the Box Developer Console.\n",
- "* The `DevelopmentClient` does both!"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Enter developer token: ERTP2iXmvV6cPMAAkLfwufBiy3k0VbUb\n"
- ]
- }
- ],
- "source": [
- "from boxsdk import DevelopmentClient\n",
- "client = DevelopmentClient()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[36mGET https://api.box.com/2.0/users/me {'headers': {'Authorization': 'Bearer ERTP2iXmvV6cPMAAkLfwufBiy3k0VbUb',\n",
- " 'User-Agent': 'box-python-sdk-2.0.0a12'},\n",
- " 'params': None}\u001b[0m\n",
- "\u001b[32m\"GET https://api.box.com/2.0/users/me\" 200 427\n",
- "{'Strict-Transport-Security': 'max-age=31536000', 'Cache-Control': 'no-cache, no-store', 'Content-Encoding': 'gzip', 'Vary': 'Accept-Encoding', 'BOX-REQUEST-ID': '05vmol15bp0htusbqk406r8e335', 'Date': 'Mon, 04 Jun 2018 23:44:03 GMT', 'Content-Type': 'application/json', 'Age': '0', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive'}\n",
- "{'address': '',\n",
- " 'avatar_url': 'https://cloud.app.box.com/api/avatar/large/202476009',\n",
- " 'created_at': '2013-09-09T14:35:35-07:00',\n",
- " 'id': '202476009',\n",
- " 'job_title': '',\n",
- " 'language': 'en',\n",
- " 'login': 'jmeadows@box.com',\n",
- " 'max_upload_size': 34359738368,\n",
- " 'modified_at': '2018-06-04T10:26:57-07:00',\n",
- " 'name': 'Jeffrey Meadows',\n",
- " 'phone': '',\n",
- " 'space_amount': 1000000000000000.0,\n",
- " 'space_used': 131650134148,\n",
- " 'status': 'active',\n",
- " 'timezone': 'America/Los_Angeles',\n",
- " 'type': 'user'}\n",
- "\u001b[0m\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- ""
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "client.user('me').get()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[36mGET https://api.box.com/2.0/files/1234 {'headers': {'Authorization': 'Bearer ERTP2iXmvV6cPMAAkLfwufBiy3k0VbUb',\n",
- " 'User-Agent': 'box-python-sdk-2.0.0a12'},\n",
- " 'params': None}\u001b[0m\n",
- "\u001b[31m\"GET https://api.box.com/2.0/files/1234\" 404 304\n",
- "{'Strict-Transport-Security': 'max-age=31536000', 'Cache-Control': 'no-cache, no-store', 'Content-Encoding': 'gzip', 'Vary': 'Accept-Encoding', 'BOX-REQUEST-ID': '0bc0o82ru5o7hegpivej1dcsmbf', 'Date': 'Mon, 04 Jun 2018 23:45:37 GMT', 'Content-Type': 'application/json', 'Age': '0', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive'}\n",
- "{'code': 'not_found',\n",
- " 'context_info': {'errors': [{'message': \"Invalid value 'f_1234'. 'item' with \"\n",
- " \"value 'f_1234' not found\",\n",
- " 'name': 'item',\n",
- " 'reason': 'invalid_parameter'}]},\n",
- " 'help_url': 'http://developers.box.com/docs/#errors',\n",
- " 'message': 'Not Found',\n",
- " 'request_id': 'r5fkoyfrzypwe2pe',\n",
- " 'status': 404,\n",
- " 'type': 'error'}\n",
- "\u001b[0m\n"
- ]
- }
- ],
- "source": [
- "from boxsdk.exception import BoxAPIException\n",
- "try:\n",
- " client.file('1234').get()\n",
- "except BoxAPIException as e:\n",
- " pass"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "As you can see, **requests** are logged in blue; **successful responses** in green, **error responses** in red."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.6.3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/demo/Shared Link.ipynb b/demo/Shared Link.ipynb
deleted file mode 100644
index 584f58d28..000000000
--- a/demo/Shared Link.ipynb
+++ /dev/null
@@ -1,135 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "The Python SDK has the capability to operate on files and folders shared with a user via shared link.\n",
- "\n",
- "Simply use `client.with_shared_link()` to get a client instance that can access the shared resource."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "from boxsdk import Client, OAuth2\n",
- "# Create an SDK client using a developer token\n",
- "client = Client(OAuth2(None, None, access_token='KoquazbCU7fxrMM0wSgGiAlWKZNeQGgq'))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "# This is a shared link created with a different Box account\n",
- "SHARED_LINK_URL = 'https://app.box.com/s/gjkefibtegdn318xqnsu3koc35qt18z3'"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "u'Book1.xls'"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "shared_item = client.get_shared_item(SHARED_LINK_URL)\n",
- "shared_item.name"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "ename": "BoxAPIException",
- "evalue": "\nMessage: Not Found\nStatus: 404\nCode: not_found\nRequest id: 135510722156675a3fa6c6c\nHeaders: {'Content-Length': '242', 'Content-Encoding': 'gzip', 'Age': '0', 'Vary': 'Accept-Encoding', 'Server': 'ATS', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, no-store', 'Date': 'Tue, 08 Dec 2015 22:31:27 GMT', 'Content-Type': 'application/json'}\nURL: https://api.box.com/2.0/files/39001292145\nMethod: GET\nContext info: {u'errors': [{u'reason': u'invalid_parameter', u'message': u\"Invalid value 'f_39001292145'. 'item' with value 'f_39001292145' not found\", u'name': u'item'}]}",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mBoxAPIException\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# This account doesn't actually have permissions on this file outside of the shared link context\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mclient\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mshared_item\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mid\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
- "\u001b[0;32m/Users/jmeadows/.virtualenvs/sdknotebooks/lib/python2.7/site-packages/boxsdk/object/item.pyc\u001b[0m in \u001b[0;36mget\u001b[0;34m(self, fields, etag)\u001b[0m\n\u001b[1;32m 124\u001b[0m \u001b[0;31m# pylint:disable=arguments-differ\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 125\u001b[0m \u001b[0mheaders\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m'If-None-Match'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0metag\u001b[0m\u001b[0;34m}\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0metag\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mNone\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 126\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mItem\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfields\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfields\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheaders\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mheaders\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 127\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparent_folder\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/Users/jmeadows/.virtualenvs/sdknotebooks/lib/python2.7/site-packages/boxsdk/object/base_object.pyc\u001b[0m in \u001b[0;36mget\u001b[0;34m(self, fields, headers)\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0murl\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_url\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 104\u001b[0m \u001b[0mparams\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m'fields'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m','\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfields\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m}\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfields\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 105\u001b[0;31m \u001b[0mbox_response\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheaders\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mheaders\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 106\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_object_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbox_response\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjson\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 107\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/Users/jmeadows/.virtualenvs/sdknotebooks/lib/python2.7/site-packages/boxsdk/session/box_session.pyc\u001b[0m in \u001b[0;36mget\u001b[0;34m(self, url, **kwargs)\u001b[0m\n\u001b[1;32m 370\u001b[0m \u001b[0;34m`\u001b[0m\u001b[0municode\u001b[0m\u001b[0;34m`\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 371\u001b[0m \"\"\"\n\u001b[0;32m--> 372\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_prepare_and_send_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'GET'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 373\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mBoxResponse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 374\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/Users/jmeadows/.virtualenvs/sdknotebooks/lib/python2.7/site-packages/boxsdk/session/box_session.pyc\u001b[0m in \u001b[0;36m_prepare_and_send_request\u001b[0;34m(self, method, url, headers, auto_session_renewal, expect_json_response, attempt_number, **kwargs)\u001b[0m\n\u001b[1;32m 274\u001b[0m \u001b[0mattempt_number\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 275\u001b[0m \u001b[0mfile_stream_positions\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfile_stream_positions\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 276\u001b[0;31m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 277\u001b[0m )\n\u001b[1;32m 278\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/Users/jmeadows/.virtualenvs/sdknotebooks/lib/python2.7/site-packages/boxsdk/session/box_session.pyc\u001b[0m in \u001b[0;36m_make_request\u001b[0;34m(self, method, url, headers, auto_session_renewal, expect_json_response, attempt_number, **kwargs)\u001b[0m\n\u001b[1;32m 358\u001b[0m )\n\u001b[1;32m 359\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 360\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_raise_on_unsuccessful_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnetwork_response\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexpect_json_response\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 361\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 362\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnetwork_response\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/Users/jmeadows/.virtualenvs/sdknotebooks/lib/python2.7/site-packages/boxsdk/session/box_session.pyc\u001b[0m in \u001b[0;36m_raise_on_unsuccessful_request\u001b[0;34m(self, network_response, expect_json_response, method, url)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 215\u001b[0;31m \u001b[0mcontext_info\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mresponse_json\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'context_info'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 216\u001b[0m )\n\u001b[1;32m 217\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mexpect_json_response\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_is_json_response\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnetwork_response\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;31mBoxAPIException\u001b[0m: \nMessage: Not Found\nStatus: 404\nCode: not_found\nRequest id: 135510722156675a3fa6c6c\nHeaders: {'Content-Length': '242', 'Content-Encoding': 'gzip', 'Age': '0', 'Vary': 'Accept-Encoding', 'Server': 'ATS', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, no-store', 'Date': 'Tue, 08 Dec 2015 22:31:27 GMT', 'Content-Type': 'application/json'}\nURL: https://api.box.com/2.0/files/39001292145\nMethod: GET\nContext info: {u'errors': [{u'reason': u'invalid_parameter', u'message': u\"Invalid value 'f_39001292145'. 'item' with value 'f_39001292145' not found\", u'name': u'item'}]}"
- ]
- }
- ],
- "source": [
- "# This account doesn't actually have permissions on this file outside of the shared link context\n",
- "client.file(shared_item.id).get()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- ""
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# Operations on the item are allowed using client.get_shared_item() or client.with_shared_link()\n",
- "client.with_shared_link(SHARED_LINK_URL, None).file(shared_item.id).get()"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/demo/__init__.py b/demo/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/demo/auth.py b/demo/auth.py
deleted file mode 100644
index 4e33bae7a..000000000
--- a/demo/auth.py
+++ /dev/null
@@ -1,64 +0,0 @@
-import bottle
-import os
-from threading import Thread, Event
-import webbrowser
-from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, make_server
-
-from boxsdk import OAuth2
-
-
-CLIENT_ID = '' # Insert Box client ID here
-CLIENT_SECRET = '' # Insert Box client secret here
-
-
-def authenticate(oauth_class=OAuth2):
- class StoppableWSGIServer(bottle.ServerAdapter):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- self._server = None
-
- def run(self, app):
- server_cls = self.options.get('server_class', WSGIServer)
- handler_cls = self.options.get('handler_class', WSGIRequestHandler)
- self._server = make_server(self.host, self.port, app, server_cls, handler_cls)
- self._server.serve_forever()
-
- def stop(self):
- self._server.shutdown()
-
- auth_code = {}
- auth_code_is_available = Event()
-
- local_oauth_redirect = bottle.Bottle()
-
- @local_oauth_redirect.get('/')
- def get_token():
- auth_code['auth_code'] = bottle.request.query.code
- auth_code['state'] = bottle.request.query.state
- auth_code_is_available.set()
-
- local_server = StoppableWSGIServer(host='localhost', port=8080)
- server_thread = Thread(target=lambda: local_oauth_redirect.run(server=local_server))
- server_thread.start()
-
- oauth = oauth_class(
- client_id=CLIENT_ID,
- client_secret=CLIENT_SECRET,
- )
- auth_url, csrf_token = oauth.get_authorization_url('http://localhost:8080')
- webbrowser.open(auth_url)
-
- auth_code_is_available.wait()
- local_server.stop()
- assert auth_code['state'] == csrf_token
- access_token, refresh_token = oauth.authenticate(auth_code['auth_code'])
-
- print('access_token: ' + access_token)
- print('refresh_token: ' + refresh_token)
-
- return oauth, access_token, refresh_token
-
-
-if __name__ == '__main__':
- authenticate()
- os._exit(0)
diff --git a/demo/cooperative_auth.py b/demo/cooperative_auth.py
deleted file mode 100644
index 5c7ea7c32..000000000
--- a/demo/cooperative_auth.py
+++ /dev/null
@@ -1,71 +0,0 @@
-from logging import getLogger
-from multiprocessing import Manager, Process
-from os import getpid
-
-from boxsdk.auth.cooperatively_managed_oauth2 import CooperativelyManagedOAuth2
-from boxsdk.util.log import setup_logging
-from boxsdk import Client
-
-from .auth import authenticate, CLIENT_ID, CLIENT_SECRET
-
-
-def main():
- # Create a multiprocessing manager to use as the token store
- global tokens, refresh_lock
- manager = Manager()
- tokens = manager.Namespace()
- refresh_lock = manager.Lock()
-
- # Authenticate in main process
- oauth2, tokens.access, tokens.refresh = authenticate(CooperativelyManagedOAuth2)
-
- # Create 2 worker processes and wait on them to finish
- workers = []
- for _ in range(2):
- worker_process = Process(target=worker)
- worker_process.start()
- workers.append(worker_process)
- for worker_process in workers:
- worker_process.join()
-
-
-def _retrive_tokens():
- return tokens.access, tokens.refresh
-
-
-def _store_tokens(access_token, refresh_token):
- tokens.access, tokens.refresh = access_token, refresh_token
-
-
-def worker():
- # Set up a logging network, but use the LoggingProxy so we can see which PID is generating messages
- logger = getLogger(f'boxsdk.network.{getpid()}')
- setup_logging(name=logger.name)
-
- # Create a coop oauth2 instance.
- # Tokens will be retrieved from and stored to the multiprocessing Namespace.
- # A multiprocessing Lock will be used to synchronize token refresh.
- # The tokens from the main process are used for initial auth.
- # Whichever process needs to refresh
- oauth2 = CooperativelyManagedOAuth2(
- retrieve_tokens=_retrive_tokens,
- client_id=CLIENT_ID,
- client_secret=CLIENT_SECRET,
- store_tokens=_store_tokens,
- access_token=tokens.access,
- refresh_token=tokens.refresh,
- refresh_lock=refresh_lock,
- )
- client = Client(oauth2)
- _do_work(client)
-
-
-def _do_work(client):
- # Do some work in a worker process.
- # To see token refresh, perhaps put this in a loop (and don't forget to sleep for a bit between requests).
- me = client.user(user_id='me').get()
- items = client.folder('0').get_items(10)
-
-
-if __name__ == '__main__':
- main()
diff --git a/demo/example.py b/demo/example.py
deleted file mode 100644
index 12d4ff0ce..000000000
--- a/demo/example.py
+++ /dev/null
@@ -1,296 +0,0 @@
-import os
-from boxsdk import Client
-from boxsdk.exception import BoxAPIException
-from boxsdk.object.collaboration import CollaborationRole
-from demo.auth import authenticate
-
-
-def run_user_example(client):
- # 'me' is a handy value to get info on the current authenticated user.
- me = client.user(user_id='me').get(fields=['login'])
- print(f'The email of the user is: {me["login"]}')
-
-
-def run_folder_examples(client):
- root_folder = client.folder(folder_id='0').get()
- print(f'The root folder is owned by: {root_folder.owned_by["login"]}')
-
- items = root_folder.get_items(limit=100, offset=0)
- print('This is the first 100 items in the root folder:')
- for item in items:
- print(" " + item.name)
-
-
-def run_collab_examples(client):
- root_folder = client.folder(folder_id='0')
- collab_folder = root_folder.create_subfolder('collab folder')
- try:
- print(f'Folder {collab_folder.get()["name"]} created')
- collaboration = collab_folder.add_collaborator('someone@example.com', CollaborationRole.VIEWER)
- print('Created a collaboration')
- try:
- modified_collaboration = collaboration.update_info(role=CollaborationRole.EDITOR)
- print(f'Modified a collaboration: {modified_collaboration.role}')
- finally:
- collaboration.delete()
- print('Deleted a collaboration')
- finally:
- # Clean up
- print(f'Delete folder collab folder succeeded: {collab_folder.delete()}')
-
-
-def rename_folder(client):
- root_folder = client.folder(folder_id='0')
- foo = root_folder.create_subfolder('foo')
- try:
- print(f'Folder {foo.get()["name"]} created')
-
- bar = foo.rename('bar')
- print(f'Renamed to {bar.get()["name"]}')
- finally:
- print(f'Delete folder bar succeeded: {foo.delete()}')
-
-
-def get_folder_shared_link(client):
- root_folder = client.folder(folder_id='0')
- collab_folder = root_folder.create_subfolder('shared link folder')
- try:
- print(f'Folder {collab_folder.get().name} created')
-
- shared_link = collab_folder.get_shared_link()
- print('Got shared link:' + shared_link)
- finally:
- print(f'Delete folder collab folder succeeded: {collab_folder.delete()}')
-
-
-def upload_file(client):
- root_folder = client.folder(folder_id='0')
- file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file.txt')
- a_file = root_folder.upload(file_path, file_name='i-am-a-file.txt')
- try:
- print(f'{a_file.get()["name"]} uploaded: ')
- finally:
- print(f'Delete i-am-a-file.txt succeeded: {a_file.delete()}')
-
-
-def upload_accelerator(client):
- root_folder = client.folder(folder_id='0')
- file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file.txt')
- a_file = root_folder.upload(file_path, file_name='i-am-a-file.txt', upload_using_accelerator=True)
- try:
- print(f'{a_file.get()["name"]} uploaded via Accelerator: ')
- file_v2_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file_v2.txt')
- a_file = a_file.update_contents(file_v2_path, upload_using_accelerator=True)
- print(f'{a_file.get()["name"]} updated via Accelerator: ')
- finally:
- print(f'Delete i-am-a-file.txt succeeded: {a_file.delete()}')
-
-
-def rename_file(client):
- root_folder = client.folder(folder_id='0')
- file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file.txt')
- foo = root_folder.upload(file_path, file_name='foo.txt')
- try:
- print(f'{foo.get()["name"]} uploaded ')
- bar = foo.rename('bar.txt')
- print(f'Rename succeeded: {bool(bar)}')
- finally:
- foo.delete()
-
-
-def update_file(client):
- root_folder = client.folder(folder_id='0')
- file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file.txt')
- file_v1 = root_folder.upload(file_path, file_name='file_v1.txt')
- try:
- # print f'File content after upload: {file_v1.content()}'
- file_v2_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file_v2.txt')
- file_v2 = file_v1.update_contents(file_v2_path)
- # print f'File content after update: {file_v2.content()}'
- finally:
- file_v1.delete()
-
-
-def search_files(client):
- search_results = client.search().query(
- 'i-am-a-file.txt',
- limit=2,
- offset=0,
- ancestor_folders=[client.folder(folder_id='0')],
- file_extensions=['txt'],
- )
- for item in search_results:
- item_with_name = item.get(fields=['name'])
- print('matching item: ' + item_with_name.id)
- else:
- print('no matching items')
-
-
-def copy_item(client):
- root_folder = client.folder(folder_id='0')
- file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file.txt')
- a_file = root_folder.upload(file_path, file_name='a file.txt')
- try:
- subfolder1 = root_folder.create_subfolder('copy_sub')
- try:
- a_file.copy(subfolder1)
- print(subfolder1.get_items(limit=10, offset=0))
- subfolder2 = root_folder.create_subfolder('copy_sub2')
- try:
- subfolder1.copy(subfolder2)
- print(subfolder2.get_items(limit=10, offset=0))
- finally:
- subfolder2.delete()
- finally:
- subfolder1.delete()
- finally:
- a_file.delete()
-
-
-def move_item(client):
- root_folder = client.folder(folder_id='0')
- file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file.txt')
- a_file = root_folder.upload(file_path, file_name='a file.txt')
- try:
- subfolder1 = root_folder.create_subfolder('move_sub')
- try:
- a_file.move(subfolder1)
- print(subfolder1.get_items(limit=10, offset=0))
- subfolder2 = root_folder.create_subfolder('move_sub2')
- try:
- subfolder1.move(subfolder2)
- print(subfolder2.get_items(limit=10, offset=0))
- finally:
- subfolder2.delete()
- finally:
- try:
- subfolder1.delete()
- except BoxAPIException:
- pass
- finally:
- try:
- a_file.delete()
- except BoxAPIException:
- pass
-
-
-def get_events(client):
- print(client.events().get_events(limit=100, stream_position='now'))
-
-
-def get_latest_stream_position(client):
- print(client.events().get_latest_stream_position())
-
-
-def long_poll(client):
- print(client.events().long_poll())
-
-
-def _delete_leftover_group(existing_groups, group_name):
- """
- delete group if it already exists
- """
- existing_group = next((g for g in existing_groups if g.name == group_name), None)
- if existing_group:
- existing_group.delete()
-
-
-def run_groups_example(client):
- """
- Shows how to interact with 'Groups' in the Box API. How to:
- - Get info about all the Groups to which the current user belongs
- - Create a Group
- - Rename a Group
- - Add a member to the group
- - Remove a member from a group
- - Delete a Group
- """
- try:
- # First delete group if it already exists
- original_groups = client.groups()
- _delete_leftover_group(original_groups, 'box_sdk_demo_group')
- _delete_leftover_group(original_groups, 'renamed_box_sdk_demo_group')
-
- new_group = client.create_group('box_sdk_demo_group')
- except BoxAPIException as ex:
- if ex.status != 403:
- raise
- print('The authenticated user does not have permissions to manage groups. Skipping the test of this demo.')
- return
-
- print('New group:', new_group.name, new_group.id)
-
- new_group = new_group.update_info({'name': 'renamed_box_sdk_demo_group'})
- print("Group's new name:", new_group.name)
-
- me_dict = client.user().get(fields=['login'])
- me = client.user(user_id=me_dict['id'])
- group_membership = new_group.add_member(me, 'member')
-
- members = list(new_group.membership())
-
- print('The group has a membership of: ', len(members))
- print('The id of that membership: ', group_membership.object_id)
-
- group_membership.delete()
- print('After deleting that membership, the group has a membership of: ', len(list(new_group.membership())))
-
- new_group.delete()
- groups_after_deleting_demo = client.groups()
- has_been_deleted = not any(g.name == 'renamed_box_sdk_demo_group' for g in groups_after_deleting_demo)
- print('The new group has been deleted: ', has_been_deleted)
-
-
-def run_metadata_example(client):
- root_folder = client.folder(folder_id='0')
- file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'file.txt')
- foo = root_folder.upload(file_path, file_name='foo.txt')
- print(f'{foo.get()["name"]} uploaded ')
- try:
- metadata = foo.metadata()
- metadata.create({'foo': 'bar'})
- print(f'Created metadata: {metadata.get()}')
- update = metadata.start_update()
- update.update('/foo', 'baz', 'bar')
- print(f'Updated metadata: {metadata.update(update)}')
- finally:
- foo.delete()
-
-
-def run_examples(oauth):
-
- client = Client(oauth)
-
- run_user_example(client)
- run_folder_examples(client)
- run_collab_examples(client)
- rename_folder(client)
- get_folder_shared_link(client)
- upload_file(client)
- rename_file(client)
- update_file(client)
- search_files(client)
- copy_item(client)
- move_item(client)
- get_events(client)
- get_latest_stream_position(client)
- # long_poll(client)
-
- # Enterprise accounts only
- run_groups_example(client)
- run_metadata_example(client)
-
- # Premium Apps only
- upload_accelerator(client)
-
-
-def main():
-
- # Please notice that you need to put in your client id and client secret in demo/auth.py in order to make this work.
- oauth, _, _ = authenticate()
- run_examples(oauth)
- os._exit(0)
-
-
-if __name__ == '__main__':
- main()
diff --git a/demo/file.txt b/demo/file.txt
deleted file mode 100644
index 2cadabd91..000000000
--- a/demo/file.txt
+++ /dev/null
@@ -1 +0,0 @@
-I am a file
diff --git a/demo/file_v2.txt b/demo/file_v2.txt
deleted file mode 100644
index e7bd22dd8..000000000
--- a/demo/file_v2.txt
+++ /dev/null
@@ -1 +0,0 @@
-I am updated
\ No newline at end of file
diff --git a/demo/music_player.py b/demo/music_player.py
deleted file mode 100644
index d30ba9fee..000000000
--- a/demo/music_player.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from random import shuffle
-import subprocess
-import tempfile
-from boxsdk.client import Client
-from demo.auth import authenticate
-
-
-class MusicPlayer:
- def __init__(self, folder_path):
- self._folder_path = folder_path
- self._client = self._get_client()
- self._mp3_files = self._get_all_mp3_files(self._client)
- shuffle(self._mp3_files)
-
- def _get_client(self):
- oauth, _, _ = self._authenticate()
- return Client(oauth)
-
- def _authenticate(self):
- return authenticate()
-
- def _get_all_mp3_files(self, client):
- # music_folder = client.folder(folder_id='0').get_subfolder('music')
- return client.search().query(query='*.mp3', limit=100, offset=0, file_extensions=['mp3'])
-
- def play(self):
- for item in self._mp3_files:
- temp_file = tempfile.NamedTemporaryFile()
- temp_file.write(item.content())
- item_with_name = item.get()
- print(item_with_name.name)
- subprocess.check_call(['afplay', temp_file.name])
-
-
-if __name__ == '__main__':
- music_player = MusicPlayer('music')
- music_player.play()
diff --git a/docs/Makefile b/docs/Makefile
deleted file mode 100644
index 00910543f..000000000
--- a/docs/Makefile
+++ /dev/null
@@ -1,177 +0,0 @@
-# Makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = sphinx-build
-PAPER =
-BUILDDIR = build
-
-# User-friendly check for sphinx-build
-ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
-$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
-endif
-
-# Internal variables.
-PAPEROPT_a4 = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
-# the i18n builder cannot share the environment and doctrees with the others
-I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
-
-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
-
-help:
- @echo "Please use \`make ' where is one of"
- @echo " html to make standalone HTML files"
- @echo " dirhtml to make HTML files named index.html in directories"
- @echo " singlehtml to make a single large HTML file"
- @echo " pickle to make pickle files"
- @echo " json to make JSON files"
- @echo " htmlhelp to make HTML files and a HTML help project"
- @echo " qthelp to make HTML files and a qthelp project"
- @echo " devhelp to make HTML files and a Devhelp project"
- @echo " epub to make an epub"
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
- @echo " latexpdf to make LaTeX files and run them through pdflatex"
- @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
- @echo " text to make text files"
- @echo " man to make manual pages"
- @echo " texinfo to make Texinfo files"
- @echo " info to make Texinfo files and run them through makeinfo"
- @echo " gettext to make PO message catalogs"
- @echo " changes to make an overview of all changed/added/deprecated items"
- @echo " xml to make Docutils-native XML files"
- @echo " pseudoxml to make pseudoxml-XML files for display purposes"
- @echo " linkcheck to check all external links for integrity"
- @echo " doctest to run all doctests embedded in the documentation (if enabled)"
-
-clean:
- rm -rf $(BUILDDIR)/*
-
-html:
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-
-dirhtml:
- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
-
-singlehtml:
- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
- @echo
- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
-
-pickle:
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
- @echo
- @echo "Build finished; now you can process the pickle files."
-
-json:
- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
- @echo
- @echo "Build finished; now you can process the JSON files."
-
-htmlhelp:
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
- @echo
- @echo "Build finished; now you can run HTML Help Workshop with the" \
- ".hhp project file in $(BUILDDIR)/htmlhelp."
-
-qthelp:
- $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
- @echo
- @echo "Build finished; now you can run "qcollectiongenerator" with the" \
- ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/BoxPythonSDK.qhcp"
- @echo "To view the help file:"
- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/BoxPythonSDK.qhc"
-
-devhelp:
- $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
- @echo
- @echo "Build finished."
- @echo "To view the help file:"
- @echo "# mkdir -p $$HOME/.local/share/devhelp/BoxPythonSDK"
- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/BoxPythonSDK"
- @echo "# devhelp"
-
-epub:
- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
- @echo
- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-
-latex:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo
- @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
- @echo "Run \`make' in that directory to run these through (pdf)latex" \
- "(use \`make latexpdf' here to do that automatically)."
-
-latexpdf:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through pdflatex..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-latexpdfja:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through platex and dvipdfmx..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-text:
- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
- @echo
- @echo "Build finished. The text files are in $(BUILDDIR)/text."
-
-man:
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
- @echo
- @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
-
-texinfo:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo
- @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
- @echo "Run \`make' in that directory to run these through makeinfo" \
- "(use \`make info' here to do that automatically)."
-
-info:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo "Running Texinfo files through makeinfo..."
- make -C $(BUILDDIR)/texinfo info
- @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
-
-gettext:
- $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
- @echo
- @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
-
-changes:
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
- @echo
- @echo "The overview file is in $(BUILDDIR)/changes."
-
-linkcheck:
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
- @echo
- @echo "Link check complete; look for any errors in the above output " \
- "or in $(BUILDDIR)/linkcheck/output.txt."
-
-doctest:
- $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
- @echo "Testing of doctests in the sources finished, look at the " \
- "results in $(BUILDDIR)/doctest/output.txt."
-
-xml:
- $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
- @echo
- @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
-
-pseudoxml:
- $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
- @echo
- @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 000000000..7b54f27b4
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,86 @@
+# Documentation
+
+## High-level Documentation
+
+General explanations of the available functionality and examples of how to use
+the SDK are available by topic:
+
+- [Ai](ai.md)
+- [Ai studio](ai_studio.md)
+- [App item associations](app_item_associations.md)
+- [Archives](archives.md)
+- [Authorization](authorization.md)
+- [Avatars](avatars.md)
+- [Chunked uploads](chunked_uploads.md)
+- [Classifications](classifications.md)
+- [Collaboration allowlist entries](collaboration_allowlist_entries.md)
+- [Collaboration allowlist exempt targets](collaboration_allowlist_exempt_targets.md)
+- [Collections](collections.md)
+- [Comments](comments.md)
+- [Device pinners](device_pinners.md)
+- [Docgen](docgen.md)
+- [Docgen template](docgen_template.md)
+- [Downloads](downloads.md)
+- [Email aliases](email_aliases.md)
+- [Events](events.md)
+- [File classifications](file_classifications.md)
+- [File metadata](file_metadata.md)
+- [File requests](file_requests.md)
+- [File version legal holds](file_version_legal_holds.md)
+- [File version retentions](file_version_retentions.md)
+- [File versions](file_versions.md)
+- [File watermarks](file_watermarks.md)
+- [Files](files.md)
+- [Folder classifications](folder_classifications.md)
+- [Folder locks](folder_locks.md)
+- [Folder metadata](folder_metadata.md)
+- [Folder watermarks](folder_watermarks.md)
+- [Folders](folders.md)
+- [Groups](groups.md)
+- [Hub collaborations](hub_collaborations.md)
+- [Hub items](hub_items.md)
+- [Hubs](hubs.md)
+- [Integration mappings](integration_mappings.md)
+- [Invites](invites.md)
+- [Legal hold policies](legal_hold_policies.md)
+- [Legal hold policy assignments](legal_hold_policy_assignments.md)
+- [List collaborations](list_collaborations.md)
+- [Memberships](memberships.md)
+- [Metadata cascade policies](metadata_cascade_policies.md)
+- [Metadata templates](metadata_templates.md)
+- [Recent items](recent_items.md)
+- [Retention policies](retention_policies.md)
+- [Retention policy assignments](retention_policy_assignments.md)
+- [Search](search.md)
+- [Session termination](session_termination.md)
+- [Shared links app items](shared_links_app_items.md)
+- [Shared links files](shared_links_files.md)
+- [Shared links folders](shared_links_folders.md)
+- [Shared links web links](shared_links_web_links.md)
+- [Shield information barrier reports](shield_information_barrier_reports.md)
+- [Shield information barrier segment members](shield_information_barrier_segment_members.md)
+- [Shield information barrier segment restrictions](shield_information_barrier_segment_restrictions.md)
+- [Shield information barrier segments](shield_information_barrier_segments.md)
+- [Shield information barriers](shield_information_barriers.md)
+- [Shield lists](shield_lists.md)
+- [Sign requests](sign_requests.md)
+- [Sign templates](sign_templates.md)
+- [Skills](skills.md)
+- [Storage policies](storage_policies.md)
+- [Storage policy assignments](storage_policy_assignments.md)
+- [Task assignments](task_assignments.md)
+- [Tasks](tasks.md)
+- [Terms of service user statuses](terms_of_service_user_statuses.md)
+- [Terms of services](terms_of_services.md)
+- [Transfer](transfer.md)
+- [Trashed files](trashed_files.md)
+- [Trashed folders](trashed_folders.md)
+- [Trashed items](trashed_items.md)
+- [Trashed web links](trashed_web_links.md)
+- [Uploads](uploads.md)
+- [User collaborations](user_collaborations.md)
+- [Users](users.md)
+- [Web links](web_links.md)
+- [Webhooks](webhooks.md)
+- [Workflows](workflows.md)
+- [Zip downloads](zip_downloads.md)
diff --git a/docs/ai.md b/docs/ai.md
new file mode 100644
index 000000000..59784e916
--- /dev/null
+++ b/docs/ai.md
@@ -0,0 +1,267 @@
+# AiManager
+
+- [Ask question](#ask-question)
+- [Generate text](#generate-text)
+- [Get AI agent default configuration](#get-ai-agent-default-configuration)
+- [Extract metadata (freeform)](#extract-metadata-freeform)
+- [Extract metadata (structured)](#extract-metadata-structured)
+
+## Ask question
+
+Sends an AI request to supported LLMs and returns an answer specifically focused on the user's question given the provided context.
+
+This operation is performed by calling function `create_ai_ask`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-ai-ask/).
+
+
+
+```python
+client.ai.create_ai_ask(
+ CreateAiAskMode.SINGLE_ITEM_QA,
+ "which direction sun rises",
+ [
+ AiItemAsk(
+ id=file_to_ask.id,
+ type=AiItemAskTypeField.FILE,
+ content="Sun rises in the East",
+ )
+ ],
+ ai_agent=ai_ask_agent_config,
+)
+```
+
+### Arguments
+
+- mode `CreateAiAskMode`
+ - Box AI handles text documents with text representations up to 1MB in size, or a maximum of 25 files, whichever comes first. If the text file size exceeds 1MB, the first 1MB of text representation will be processed. Box AI handles image documents with a resolution of 1024 x 1024 pixels, with a maximum of 5 images or 5 pages for multi-page images. If the number of image or image pages exceeds 5, the first 5 images or pages will be processed. If you set mode parameter to `single_item_qa`, the items array can have one element only. Currently Box AI does not support multi-modal requests. If both images and text are sent Box AI will only process the text.
+- prompt `str`
+ - The prompt provided by the client to be answered by the LLM. The prompt's length is limited to 10000 characters.
+- items `List[AiItemAsk]`
+ - The items to be processed by the LLM, often files.
+- dialogue_history `Optional[List[AiDialogueHistory]]`
+ - The history of prompts and answers previously passed to the LLM. This provides additional context to the LLM in generating the response.
+- include_citations `Optional[bool]`
+ - A flag to indicate whether citations should be returned.
+- ai_agent `Optional[Union[AiAgentAsk, AiAgentReference]]`
+- 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 `Optional[AiResponseFull]`.
+
+A successful response including the answer from the LLM.No content is available to answer the question. This is returned when the request item is a hub, but content in the hubs is not indexed. To ensure content in the hub is indexed, make sure Box AI for Hubs in the Admin Console was enabled before hub creation.
+
+## Generate text
+
+Sends an AI request to supported Large Language Models (LLMs) and returns generated text based on the provided prompt.
+
+This operation is performed by calling function `create_ai_text_gen`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-ai-text-gen/).
+
+
+
+```python
+client.ai.create_ai_text_gen(
+ "Parapharse the document.s",
+ [
+ CreateAiTextGenItems(
+ id=file_to_ask.id,
+ type=CreateAiTextGenItemsTypeField.FILE,
+ content="The Earth goes around the sun. Sun rises in the East in the morning.",
+ )
+ ],
+ dialogue_history=[
+ AiDialogueHistory(
+ prompt="What does the earth go around?",
+ answer="The sun",
+ created_at=date_time_from_string("2021-01-01T00:00:00Z"),
+ ),
+ AiDialogueHistory(
+ prompt="On Earth, where does the sun rise?",
+ answer="East",
+ created_at=date_time_from_string("2021-01-01T00:00:00Z"),
+ ),
+ ],
+ ai_agent=ai_text_gen_agent_config,
+)
+```
+
+### Arguments
+
+- prompt `str`
+ - The prompt provided by the client to be answered by the LLM. The prompt's length is limited to 10000 characters.
+- items `List[CreateAiTextGenItems]`
+ - The items to be processed by the LLM, often files. The array can include **exactly one** element. **Note**: Box AI handles documents with text representations up to 1MB in size. If the file size exceeds 1MB, the first 1MB of text representation will be processed.
+- dialogue_history `Optional[List[AiDialogueHistory]]`
+ - The history of prompts and answers previously passed to the LLM. This parameter provides the additional context to the LLM when generating the response.
+- ai_agent `Optional[Union[AiAgentReference, AiAgentTextGen]]`
+- 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 `AiResponse`.
+
+A successful response including the answer from the LLM.
+
+## Get AI agent default configuration
+
+Get the AI agent default config.
+
+This operation is performed by calling function `get_ai_agent_default_config`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-ai-agent-default/).
+
+
+
+```python
+client.ai.get_ai_agent_default_config(GetAiAgentDefaultConfigMode.ASK, language="en-US")
+```
+
+### Arguments
+
+- mode `GetAiAgentDefaultConfigMode`
+ - The mode to filter the agent config to return.
+- language `Optional[str]`
+ - The ISO language code to return the agent config for. If the language is not supported the default agent config is returned.
+- model `Optional[str]`
+ - The model to return the default agent config 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 `Union[AiAgentAsk, AiAgentTextGen, AiAgentExtract, AiAgentExtractStructured]`.
+
+A successful response including the default agent configuration.
+This response can be one of the following four objects:
+
+- AI agent for questions
+- AI agent for text generation
+- AI agent for freeform metadata extraction
+- AI agent for structured metadata extraction.
+ The response depends on the agent configuration requested in this endpoint.
+
+## Extract metadata (freeform)
+
+Sends an AI request to supported Large Language Models (LLMs) and extracts metadata in form of key-value pairs.
+In this request, both the prompt and the output can be freeform.
+Metadata template setup before sending the request is not required.
+
+This operation is performed by calling function `create_ai_extract`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-ai-extract/).
+
+
+
+```python
+client.ai.create_ai_extract(
+ "firstName, lastName, location, yearOfBirth, company",
+ [AiItemBase(id=file.id)],
+ ai_agent=agent_ignoring_overriding_embeddings_model,
+)
+```
+
+### Arguments
+
+- prompt `str`
+ - The prompt provided to a Large Language Model (LLM) in the request. The prompt can be up to 10000 characters long and it can be an XML or a JSON schema.
+- items `List[AiItemBase]`
+ - The items that LLM will process. Currently, you can use files only.
+- ai_agent `Optional[Union[AiAgentReference, AiAgentExtract]]`
+- 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 `AiResponse`.
+
+A response including the answer from the LLM.
+
+## Extract metadata (structured)
+
+Sends an AI request to supported Large Language Models (LLMs) and returns extracted metadata as a set of key-value pairs.
+For this request, you either need a metadata template or a list of fields you want to extract.
+Input is **either** a metadata template or a list of fields to ensure the structure.
+To learn more about creating templates, see [Creating metadata templates in the Admin Console](https://support.box.com/hc/en-us/articles/360044194033-Customizing-Metadata-Templates)
+or use the [metadata template API](g://metadata/templates/create).
+
+This operation is performed by calling function `create_ai_extract_structured`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-ai-extract-structured/).
+
+
+
+```python
+client.ai.create_ai_extract_structured(
+ [AiItemBase(id=file.id)],
+ fields=[
+ CreateAiExtractStructuredFields(
+ key="firstName",
+ display_name="First name",
+ description="Person first name",
+ prompt="What is the your first name?",
+ type="string",
+ ),
+ CreateAiExtractStructuredFields(
+ key="lastName",
+ display_name="Last name",
+ description="Person last name",
+ prompt="What is the your last name?",
+ type="string",
+ ),
+ CreateAiExtractStructuredFields(
+ key="dateOfBirth",
+ display_name="Birth date",
+ description="Person date of birth",
+ prompt="What is the date of your birth?",
+ type="date",
+ ),
+ CreateAiExtractStructuredFields(
+ key="age",
+ display_name="Age",
+ description="Person age",
+ prompt="How old are you?",
+ type="float",
+ ),
+ CreateAiExtractStructuredFields(
+ key="hobby",
+ display_name="Hobby",
+ description="Person hobby",
+ prompt="What is your hobby?",
+ type="multiSelect",
+ options=[
+ CreateAiExtractStructuredFieldsOptionsField(key="guitar"),
+ CreateAiExtractStructuredFieldsOptionsField(key="books"),
+ ],
+ ),
+ ],
+ ai_agent=agent_ignoring_overriding_embeddings_model,
+)
+```
+
+### Arguments
+
+- items `List[AiItemBase]`
+ - The items to be processed by the LLM. Currently you can use files only.
+- metadata_template `Optional[CreateAiExtractStructuredMetadataTemplate]`
+ - The metadata template containing the fields to extract. For your request to work, you must provide either `metadata_template` or `fields`, but not both.
+- fields `Optional[List[CreateAiExtractStructuredFields]]`
+ - The fields to be extracted from the provided items. For your request to work, you must provide either `metadata_template` or `fields`, but not both.
+- ai_agent `Optional[Union[AiAgentReference, AiAgentExtractStructured]]`
+- 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 `AiExtractStructuredResponse`.
+
+A successful response including the answer from the LLM.
diff --git a/docs/ai_studio.md b/docs/ai_studio.md
new file mode 100644
index 000000000..92e42046e
--- /dev/null
+++ b/docs/ai_studio.md
@@ -0,0 +1,192 @@
+# AiStudioManager
+
+- [List AI agents](#list-ai-agents)
+- [Create AI agent](#create-ai-agent)
+- [Update AI agent](#update-ai-agent)
+- [Get AI agent by agent ID](#get-ai-agent-by-agent-id)
+- [Delete AI agent](#delete-ai-agent)
+
+## List AI agents
+
+Lists AI agents based on the provided parameters.
+
+This operation is performed by calling function `get_ai_agents`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-ai-agents/).
+
+
+
+```python
+client.ai_studio.get_ai_agents()
+```
+
+### Arguments
+
+- mode `Optional[List[str]]`
+ - The mode to filter the agent config to return. Possible values are: `ask`, `text_gen`, and `extract`.
+- fields `Optional[List[str]]`
+ - The fields to return in the response.
+- agent_state `Optional[List[str]]`
+ - The state of the agents to return. Possible values are: `enabled`, `disabled` and `enabled_for_selected_users`.
+- include_box_default `Optional[bool]`
+ - Whether to include the Box default agents in the response.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `AiMultipleAgentResponse`.
+
+A successful response including the agents list.
+
+## Create AI agent
+
+Creates an AI agent. At least one of the following capabilities must be provided: `ask`, `text_gen`, `extract`.
+
+This operation is performed by calling function `create_ai_agent`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-ai-agents/).
+
+
+
+```python
+client.ai_studio.create_ai_agent(
+ agent_name,
+ "enabled",
+ ask=AiStudioAgentAsk(access_state="enabled", description="desc1"),
+)
+```
+
+### Arguments
+
+- type `CreateAiAgentType`
+ - The type of agent used to handle queries.
+- name `str`
+ - The name of the AI Agent.
+- access_state `str`
+ - The state of the AI Agent. Possible values are: `enabled`, `disabled`, and `enabled_for_selected_users`.
+- icon_reference `Optional[str]`
+ - The icon reference of the AI Agent. It should have format of the URL `https://cdn01.boxcdn.net/app-assets/aistudio/avatars/` where possible values of `file_name` are: `logo_boxAi.png`,`logo_stamp.png`,`logo_legal.png`,`logo_finance.png`,`logo_config.png`,`logo_handshake.png`,`logo_analytics.png`,`logo_classification.png`.
+- allowed_entities `Optional[List[AiAgentAllowedEntity]]`
+ - List of allowed users or groups.
+- ask `Optional[AiStudioAgentAsk]`
+- text_gen `Optional[AiStudioAgentTextGen]`
+- extract `Optional[AiStudioAgentExtract]`
+- 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 `AiSingleAgentResponseFull`.
+
+Definition of created AI agent.
+
+## Update AI agent
+
+Updates an AI agent.
+
+This operation is performed by calling function `update_ai_agent_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-ai-agents-id/).
+
+
+
+```python
+client.ai_studio.update_ai_agent_by_id(
+ created_agent.id,
+ agent_name,
+ "enabled",
+ ask=AiStudioAgentAsk(access_state="disabled", description="desc2"),
+)
+```
+
+### Arguments
+
+- agent_id `str`
+ - The ID of the agent to update. Example: "1234"
+- type `UpdateAiAgentByIdType`
+ - The type of agent used to handle queries.
+- name `str`
+ - The name of the AI Agent.
+- access_state `str`
+ - The state of the AI Agent. Possible values are: `enabled`, `disabled`, and `enabled_for_selected_users`.
+- icon_reference `Optional[str]`
+ - The icon reference of the AI Agent. It should have format of the URL `https://cdn01.boxcdn.net/app-assets/aistudio/avatars/` where possible values of `file_name` are: `logo_boxAi.png`,`logo_stamp.png`,`logo_legal.png`,`logo_finance.png`,`logo_config.png`,`logo_handshake.png`,`logo_analytics.png`,`logo_classification.png`.
+- allowed_entities `Optional[List[AiAgentAllowedEntity]]`
+ - List of allowed users or groups.
+- ask `Optional[AiStudioAgentAsk]`
+- text_gen `Optional[AiStudioAgentTextGen]`
+- extract `Optional[AiStudioAgentExtract]`
+- 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 `AiSingleAgentResponseFull`.
+
+Definition of created AI agent.
+
+## Get AI agent by agent ID
+
+Gets an AI Agent using the `agent_id` parameter.
+
+This operation is performed by calling function `get_ai_agent_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-ai-agents-id/).
+
+
+
+```python
+client.ai_studio.get_ai_agent_by_id(created_agent.id, fields=["ask"])
+```
+
+### Arguments
+
+- agent_id `str`
+ - The agent id to get. Example: "1234"
+- fields `Optional[List[str]]`
+ - The fields to return in the response.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `AiSingleAgentResponseFull`.
+
+A successful response including the agent.
+
+## Delete AI agent
+
+Deletes an AI agent using the provided parameters.
+
+This operation is performed by calling function `delete_ai_agent_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-ai-agents-id/).
+
+
+
+```python
+client.ai_studio.delete_ai_agent_by_id(created_agent.id)
+```
+
+### Arguments
+
+- agent_id `str`
+ - The ID of the agent to delete. Example: "1234"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A successful response with no content.
diff --git a/docs/app_item_associations.md b/docs/app_item_associations.md
new file mode 100644
index 000000000..371483db1
--- /dev/null
+++ b/docs/app_item_associations.md
@@ -0,0 +1,84 @@
+# AppItemAssociationsManager
+
+- [List file app item associations](#list-file-app-item-associations)
+- [List folder app item associations](#list-folder-app-item-associations)
+
+## List file app item associations
+
+**This is a beta feature, which means that its availability might be limited.**
+Returns all app items the file is associated with. This includes app items
+associated with ancestors of the file. Assuming the context user has access
+to the file, the type/ids are revealed even if the context user does not
+have **View** permission on the app item.
+
+This operation is performed by calling function `get_file_app_item_associations`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-app-item-associations/).
+
+
+
+```python
+client.app_item_associations.get_file_app_item_associations(file_id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- application_type `Optional[str]`
+ - If given, only return app items for this application type.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `AppItemAssociations`.
+
+Returns a collection of app item objects. If there are no
+app items on this file, an empty collection will be returned.
+This list includes app items on ancestors of this File.
+
+## List folder app item associations
+
+**This is a beta feature, which means that its availability might be limited.**
+Returns all app items the folder is associated with. This includes app items
+associated with ancestors of the folder. Assuming the context user has access
+to the folder, the type/ids are revealed even if the context user does not
+have **View** permission on the app item.
+
+This operation is performed by calling function `get_folder_app_item_associations`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-folders-id-app-item-associations/).
+
+
+
+```python
+client.app_item_associations.get_folder_app_item_associations(folder_id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- application_type `Optional[str]`
+ - If given, returns only app items for this application type.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `AppItemAssociations`.
+
+Returns a collection of app item objects. If there are no
+app items on this folder an empty collection will be returned.
+This list includes app items on ancestors of this folder.
diff --git a/docs/archives.md b/docs/archives.md
new file mode 100644
index 000000000..cc730a340
--- /dev/null
+++ b/docs/archives.md
@@ -0,0 +1,97 @@
+# ArchivesManager
+
+- [List archives](#list-archives)
+- [Create archive](#create-archive)
+- [Delete archive](#delete-archive)
+
+## List archives
+
+Retrieves archives for an enterprise.
+
+This operation is performed by calling function `get_archives_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-archives/).
+
+
+
+```python
+client.archives.get_archives_v2025_r0(limit=100)
+```
+
+### Arguments
+
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ArchivesV2025R0`.
+
+Returns a list of archives in the enterprise.
+
+## Create archive
+
+Creates an archive.
+
+This operation is performed by calling function `create_archive_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/post-archives/).
+
+
+
+```python
+client.archives.create_archive_v2025_r0(archive_name)
+```
+
+### Arguments
+
+- name `str`
+ - The name of the archive.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ArchiveV2025R0`.
+
+Returns a new archive object.
+
+## Delete archive
+
+Permanently deletes an archive.
+
+This operation is performed by calling function `delete_archive_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/delete-archives-id/).
+
+
+
+```python
+client.archives.delete_archive_by_id_v2025_r0(archive.id)
+```
+
+### Arguments
+
+- archive_id `str`
+ - The ID of the archive. Example: "982312"
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the archive has been deleted.
diff --git a/docs/authentication.md b/docs/authentication.md
new file mode 100644
index 000000000..cbe78f305
--- /dev/null
+++ b/docs/authentication.md
@@ -0,0 +1,501 @@
+# Authentication
+
+
+
+
+- [Authentication](#authentication)
+- [Authentication methods](#authentication-methods)
+ - [Developer Token](#developer-token)
+ - [JWT Auth](#jwt-auth)
+ - [Authenticate Enterprise](#authenticate-enterprise)
+ - [Authenticate user](#authenticate-user)
+ - [Client Credentials Grant](#client-credentials-grant)
+ - [Obtaining Service Account token](#obtaining-service-account-token)
+ - [Obtaining User token](#obtaining-user-token)
+ - [Switching between Service Account and User](#switching-between-service-account-and-user)
+ - [OAuth 2.0 Auth](#oauth-20-auth)
+ - [Authentication with OAuth2](#authentication-with-oauth2)
+ - [Injecting existing token into BoxOAuth](#injecting-existing-token-into-boxoauth)
+- [Retrieve current access token](#retrieve-current-access-token)
+- [Refresh access token](#refresh-access-token)
+- [Revoke token](#revoke-token)
+- [Downscope token](#downscope-token)
+- [Token storage](#token-storage)
+ - [In-memory token storage](#in-memory-token-storage)
+ - [File token storage](#file-token-storage)
+ - [File with in-memory token storage](#file-with-in-memory-token-storage)
+ - [Custom storage](#custom-storage)
+
+
+
+# Authentication methods
+
+## Developer Token
+
+The fastest way to get started using the API is with developer token. A
+developer token is simply a short-lived access token that cannot be refreshed
+and can only be used with your own account. Therefore, they're only useful for
+testing an app and aren't suitable for production. You can obtain a developer
+token from your application's [developer console][dev_console] page.
+
+To create a `BoxClient` with a developer token, construct an `BoxDeveloperTokenAuth`
+object with the `token` set to the developer token and construct the client with that.
+
+
+
+```python
+from box_sdk_gen import BoxClient, BoxDeveloperTokenAuth
+
+auth = BoxDeveloperTokenAuth(token="DEVELOPER_TOKEN_GOES_HERE")
+client = BoxClient(auth=auth)
+
+me = client.users.get_user_me()
+print(f"My user ID is {me.id}")
+```
+
+[dev_console]: https://app.box.com/developers/console
+
+## JWT Auth
+
+Authenticating with a JWT requires some extra dependencies. To get them, use
+
+```
+pip install "box-sdk-gen[jwt]"
+```
+
+Before using JWT Auth make sure you set up correctly your Box platform app.
+The guide with all required steps can be found here: [Setup with JWT][jwt_guide]
+
+### Authenticate Enterprise
+
+JWT auth allows your application to authenticate itself with the Box API
+for a given enterprise. By default, your application has a [Service Account][service_account]
+that represents it and can perform API calls. The Service Account is separate
+from the Box accounts of the application developer and the enterprise admin of
+any enterprise that has authorized the app — files stored in that account are
+not accessible in any other account by default, and vice versa.
+
+If you generated your public and private keys automatically through the
+[Box Developer Console][dev_console], you can use the JSON file created there
+to configure your SDK instance and create a client to make calls as the
+Service Account. Call one of static `BoxJWTAuth` method:
+`JWTConfig.from_config_file(config_file_path='/path/to/settings.json')` and pass JSON file local path
+or `JWTConfig.from_config_json_string(config_json_string)` and pass JSON config file content as string.
+
+```python
+from box_sdk_gen import BoxClient, BoxJWTAuth, JWTConfig
+
+jwt_config = JWTConfig.from_config_file(config_file_path="/path/to/settings.json")
+auth = BoxJWTAuth(config=jwt_config)
+client = BoxClient(auth=auth)
+
+service_account = client.users.get_user_me()
+print(f"Service Account user ID is {service_account.id}")
+```
+
+Otherwise, you'll need to provide the necessary configuration fields directly to the `JWTConfig` constructor:
+
+```python
+from box_sdk_gen import BoxClient, BoxJWTAuth, JWTConfig
+
+jwt_config = JWTConfig(
+ client_id="YOUR_CLIENT_ID",
+ client_secret="YOUR_CLIENT_SECRET",
+ jwt_key_id="YOUR_JWT_KEY_ID",
+ private_key="YOUR_PRIVATE_KEY",
+ private_key_passphrase="PASSPHRASE",
+ enterprise_id="YOUR_ENTERPRISE_ID",
+)
+
+auth = BoxJWTAuth(config=jwt_config)
+service_account_client = BoxClient(auth=auth)
+```
+
+### Authenticate user
+
+App auth applications also often have associated [App Users][app_user], which are
+created and managed directly by the application — they do not have normal login credentials,
+and can only be accessed through the Box API by the application that created them.
+You may authenticate as the Service Account to provision and manage users, or as an individual app user to
+make calls as that user. See the [API documentation](https://developer.box.com/)
+for detailed instructions on how to use app auth.
+
+Clients for making calls as an App User can be created with the same JSON JWT config file generated through the
+[Box Developer Console][dev_console]. Calling `auth.with_user_subject('USER_ID')` method will return a new auth object,
+which is authenticated as the user with provided id, leaving the original object unchanged.
+
+```python
+from box_sdk_gen import BoxClient, BoxJWTAuth, JWTConfig
+
+jwt_config = JWTConfig.from_config_file(config_file_path="/path/to/settings.json")
+auth = BoxJWTAuth(config=jwt_config)
+user_auth = auth.with_user_subject("USER_ID")
+user_client = BoxClient(auth=user_auth)
+```
+
+Alternatively, clients for making calls as an App User can be created with the same `JWTConfig`
+constructor as in the above examples, similarly to creating a Service Account client. Simply pass the
+`user_id` instead of `enterprise_id` when constructing the auth config instance:
+
+```python
+from box_sdk_gen import BoxClient, BoxJWTAuth, JWTConfig
+
+jwt_config = JWTConfig(
+ client_id="YOUR_CLIENT_ID",
+ client_secret="YOUR_CLIENT_SECRET",
+ jwt_key_id="YOUR_JWT_KEY_ID",
+ private_key="YOUR_PRIVATE_KEY",
+ private_key_passphrase="PASSPHRASE",
+ user_id="USER_ID",
+)
+
+auth = BoxJWTAuth(config=jwt_config)
+user_client = BoxClient(auth=auth)
+```
+
+[jwt_guide]: https://developer.box.com/guides/authentication/jwt/jwt-setup/
+[service_account]: https://developer.box.com/guides/getting-started/user-types/service-account/
+[app_user]: https://developer.box.com/guides/getting-started/user-types/app-users/
+
+## Client Credentials Grant
+
+Before using Client Credentials Grant Auth make sure you set up correctly your Box platform app.
+The guide with all required steps can be found here: [Setup with Client Credentials Grant][ccg_guide]
+
+Client Credentials Grant Auth method allows you to obtain an access token by having client credentials
+and secret with enterprise or user ID, which allows you to work using service or user account.
+
+You can use `BoxCCGAuth` to initialize a client object the same way as for other authentication types:
+
+```python
+from box_sdk_gen import BoxClient, BoxCCGAuth, CCGConfig
+
+ccg_config = CCGConfig(
+ client_id="YOUR_CLIENT_ID",
+ client_secret="YOUR_CLIENT_SECRET",
+ user_id="YOUR_USER_ID",
+)
+auth = BoxCCGAuth(config=ccg_config)
+client = BoxClient(auth=auth)
+
+print(f"Id of the authenticated user is: {client.users.get_user_me().id}")
+```
+
+Obtained token is valid for specified amount of time, it will be refreshed automatically by default.
+
+### Obtaining Service Account token
+
+The [Service Account](https://developer.box.com/guides/getting-started/user-types/service-account//)
+is separate from the Box accounts of the application developer and the
+enterprise admin of any enterprise that has authorized the app — files stored in that account
+are not accessible in any other account by default, and vice versa.
+To obtain service account you will have to provide enterprise ID with client id and secret:
+
+```python
+from box_sdk_gen import BoxClient, BoxCCGAuth, CCGConfig
+
+ccg_config = CCGConfig(
+ client_id="YOUR_CLIENT_ID",
+ client_secret="YOUR_CLIENT_SECRET",
+ enterprise_id="YOUR_ENTERPRISE_ID",
+)
+auth = BoxCCGAuth(config=ccg_config)
+client = BoxClient(auth=auth)
+```
+
+### Obtaining User token
+
+In order to enable obtaining user token you have to go to your application configuration that can be found
+[here][dev_console]. In `Configuration` tab, in section `Advanced Features`
+select `Generate user access tokens`. Do not forget to re-authorize application if it was already authorized.
+
+To obtain user account you will have to provide user ID with client id and secret.
+
+```python
+from box_sdk_gen import BoxClient, BoxCCGAuth, CCGConfig
+
+ccg_config = CCGConfig(
+ client_id="YOUR_CLIENT_ID",
+ client_secret="YOUR_CLIENT_SECRET",
+ user_id="YOUR_USER_ID",
+)
+auth = BoxCCGAuth(config=ccg_config)
+client = BoxClient(auth=auth)
+```
+
+### Switching between Service Account and User
+
+You can easily switch to be authenticated as a Service Account or as a User.
+To create a new auth object authenticated as Service Account you can call:
+
+```python
+enterprise_auth = auth.with_enterprise_subject(enterprise_id="YOUR_ENTERPRISE_ID")
+enterprise_client = BoxClient(auth=enterprise_auth)
+```
+
+To authenticate with user subject call:
+
+```python
+user_auth = auth.with_user_subject(user_id="YOUR_USER_ID")
+user_client = BoxClient(auth=user_auth)
+```
+
+The new token will be automatically fetched with a next API call.
+
+[ccg_guide]: https://developer.box.com/guides/authentication/client-credentials/client-credentials-setup/
+
+## OAuth 2.0 Auth
+
+### Authentication with OAuth2
+
+If your application needs to integrate with existing Box users who will provide
+their login credentials to grant your application access to their account, you
+will need to go through the standard OAuth2 login flow. A detailed guide for
+this process is available in the
+[Authentication with OAuth API documentation](https://developer.box.com/en/guides/authentication/oauth2/).
+
+Using an auth code is the most common way of authenticating with the Box API for
+existing Box users, to integrate with their accounts.
+Your application must provide a way for the user to login to Box (usually with a
+browser or web view) in order to obtain an auth code.
+
+
+
+```python
+from box_sdk_gen import BoxOAuth, OAuthConfig
+
+auth = BoxOAuth(
+ OAuthConfig(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")
+)
+auth_url = auth.get_authorize_url()
+```
+
+After a user logs in and grants your application access to their Box account,
+they will be redirected to your application's `redirect_uri` which will contain
+an auth code. This auth code can then be used along with your client ID and
+client secret to establish an API connection.
+You need to provide the auth code to the SDK to obtain an access token.
+Calling `auth.get_tokens_authorization_code_grant('YOUR_ACCESS_CODE')` will exchange the auth code for an access token
+and save it in the `BoxOAuth` token storage. The SDK will automatically refresh the token when needed.
+All you need to do is create a client object with the `BoxOAuth` object and start making API calls.
+
+
+
+```python
+from box_sdk_gen import BoxClient
+
+auth.get_tokens_authorization_code_grant("YOUR_ACCESS_CODE")
+client = BoxClient(auth=auth)
+```
+
+Here you can find a Flask app example, which handles complete BoxOAuth workflow to authenticate and
+list names of all items in a root folder.
+
+```python
+from flask import Flask, request, redirect
+
+from box_sdk_gen import BoxClient, BoxOAuth, OAuthConfig, GetAuthorizeUrlOptions
+
+app = Flask(__name__)
+
+AUTH = BoxOAuth(
+ OAuthConfig(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")
+)
+
+
+@app.route("/")
+def get_auth():
+ auth_url = AUTH.get_authorize_url(
+ options=GetAuthorizeUrlOptions(redirect_uri="YOUR_REDIRECT_URL")
+ )
+ return redirect(auth_url, code=302)
+
+
+@app.route("/oauth2callback")
+def callback():
+ AUTH.get_tokens_authorization_code_grant(request.args.get("code"))
+ client = BoxClient(auth=AUTH)
+
+ items_in_root_folder = [
+ item.name for item in client.folders.get_folder_items(folder_id="0").entries
+ ]
+ return ", ".join(items_in_root_folder)
+
+
+if __name__ == "__main__":
+ app.run(port=4999)
+```
+
+### Injecting existing token into BoxOAuth
+
+If you already have an access token and refresh token, you can inject them into the `BoxOAuth` token storage
+to avoid repeating the authentication process. This can be useful when you want to reuse the token
+between runs of your application.
+
+```python
+from box_sdk_gen import BoxClient, AccessToken
+
+access_token = AccessToken(accessToken="", refreshToken="")
+auth.token_storage.store(access_token)
+client = BoxClient(auth=auth)
+```
+
+Alternatively, you can create a custom implementation of `TokenStorage` interface and pass it to the `BoxOAuth` object.
+See the [Custom storage](#custom-storage) section for more information.
+
+# Retrieve current access token
+
+After initializing the authentication object, the SDK will be able to retrieve the access token.
+To retrieve the current access token you can use the following code:
+
+
+
+```python
+auth.retrieve_token()
+```
+
+# Refresh access token
+
+Access tokens are short-lived and need to be refreshed periodically. The SDK will automatically refresh the token when needed.
+If you want to manually refresh the token, you can use the following code:
+
+
+
+```python
+auth.refresh_token()
+```
+
+# Revoke token
+
+Access tokens for a client can be revoked when needed. This call invalidates old token.
+For BoxCCGAuth and BoxJWTAuth you can still reuse the `auth` object to retrieve a new token.
+If you make any new call after revoking the token, a new token will be automatically retrieved.
+For BoxOAuth it would be necessary to manually go through the authentication process again.
+For BoxDeveloperTokenAuth, it is necessary to provide a DeveloperTokenConfig during initialization,
+containing the client ID and client secret.
+
+To revoke current client's tokens in the storage use the following code:
+
+
+
+```python
+client.auth.revoke_token()
+```
+
+# Downscope token
+
+You can exchange a client's access token for one with a lower scope, in order
+to restrict the permissions for a child client or to pass to a less secure
+location (e.g. a browser-based app).
+
+A downscoped token does not include a refresh token.
+In such a scenario, to obtain a new downscoped token, refresh the original token
+and utilize the newly acquired token to obtain the downscoped token.
+
+More information about downscoping tokens can be found [here](https://developer.box.com/guides/authentication/tokens/downscope/).
+If you want to learn more about available scopes please go [here](https://developer.box.com/guides/api-calls/permissions-and-errors/scopes/#scopes-for-downscoping).
+
+For example to get a new token with only `item_preview` scope, restricted to a single file, suitable for the
+[Content Preview UI Element](https://developer.box.com/en/guides/embed/ui-elements/preview/) you can use the following code.
+You can also initialize `BoxDeveloperTokenAuth` with the retrieved access token and use it to create a new Client.
+
+
+
+```python
+from box_sdk_gen import BoxDeveloperTokenAuth, AccessToken, BoxClient
+
+resource = "https://api.box.com/2.0/files/123456789"
+downscoped_token: AccessToken = auth.downscope_token(
+ scopes=["item_preview"],
+ resource=resource,
+)
+downscoped_auth = BoxDeveloperTokenAuth(token=downscoped_token.access_token)
+client = BoxClient(auth=downscoped_auth)
+```
+
+# Token storage
+
+## In-memory token storage
+
+By default, the SDK stores the access token in volatile memory. When rerunning your application,
+the access token won't be reused from the previous run; a new token has to be obtained again.
+To use in-memory token storage, you don't need to do anything more than
+create an Auth class using AuthConfig, for example, for BoxOAuth:
+
+```python
+from box_sdk_gen import BoxOAuth, OAuthConfig
+
+auth = BoxOAuth(
+ OAuthConfig(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")
+)
+```
+
+## File token storage
+
+If you want to keep an up-to-date access token in a file, allowing it to be reused after rerunning your application,
+you can use the `FileTokenStorage` class. To enable storing the token in a file, you need to pass an object of type
+`FileTokenStorage` to the AuthConfig class. For example, for BoxOAuth:
+
+```python
+from box_sdk_gen import BoxOAuth, OAuthConfig, FileTokenStorage
+
+auth = BoxOAuth(
+ OAuthConfig(
+ client_id="YOUR_CLIENT_ID",
+ client_secret="YOUR_CLIENT_SECRET",
+ token_storage=FileTokenStorage(),
+ )
+)
+```
+
+## File with in-memory token storage
+
+If you want to keep an up-to-date access token in a file and also maintain a valid access token in in-memory cache,
+allowing you to reuse the token after rerunning your application while maintaining fast access times to the token,
+you can use the `FileWithInMemoryCacheTokenStorage` class. To enable storing the token in a file,
+you need to pass an object of type `FileWithInMemoryCacheTokenStorage` to the AuthConfig class. For example, for BoxOAuth:
+
+```python
+from box_sdk_gen import BoxOAuth, OAuthConfig, FileWithInMemoryCacheTokenStorage
+
+auth = BoxOAuth(
+ OAuthConfig(
+ client_id="YOUR_CLIENT_ID",
+ client_secret="YOUR_CLIENT_SECRET",
+ token_storage=FileWithInMemoryCacheTokenStorage(),
+ )
+)
+```
+
+## Custom storage
+
+You can also provide a custom token storage class. All you need to do is create a class that inherits from `TokenStorage`
+and implements all of its abstract methods. Then, pass an instance of your class to the AuthConfig constructor.
+
+```python
+from typing import Optional
+from box_sdk_gen import BoxOAuth, OAuthConfig, TokenStorage, AccessToken
+
+
+class MyCustomTokenStorage(TokenStorage):
+ def store(self, token: AccessToken) -> None:
+ # store token in your custom storage
+ pass
+
+ def get(self) -> Optional[AccessToken]:
+ # retrieve token from your custom storage
+ pass
+
+ def clear(self) -> None:
+ # clear token from your custom storage
+ pass
+
+
+auth = BoxOAuth(
+ OAuthConfig(
+ client_id="YOUR_CLIENT_ID",
+ client_secret="YOUR_CLIENT_SECRET",
+ token_storage=MyCustomTokenStorage(),
+ )
+)
+```
diff --git a/docs/authorization.md b/docs/authorization.md
new file mode 100644
index 000000000..65da2275c
--- /dev/null
+++ b/docs/authorization.md
@@ -0,0 +1,170 @@
+# 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
+
+Authorize a user by sending them through the [Box](https://box.com)
+website and request their permission to act on their behalf.
+
+This is the first step when authenticating a user using
+OAuth 2.0. To request a user's authorization to use the Box APIs
+on their behalf you will need to send a user to the URL with this
+format.
+
+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 `authorize_user` in integration tests_
+
+### Arguments
+
+- 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.
+- redirect_uri `Optional[str]`
+ - The URI to which Box redirects the browser after the user has granted or denied the application permission. This URI match one of the redirect URIs in the configuration of your application. It must be a valid HTTPS URI and it needs to be able to handle the redirection to complete the next step in the OAuth 2.0 flow. Although this parameter is optional, it must be a part of the authorization URL if you configured multiple redirect URIs for the application in the developer console. A missing parameter causes a `redirect_uri_missing` error after the user grants application access.
+- 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 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.
+
+### Returns
+
+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-oauth2-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-oauth2-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-oauth2-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/avatars.md b/docs/avatars.md
new file mode 100644
index 000000000..702da5049
--- /dev/null
+++ b/docs/avatars.md
@@ -0,0 +1,105 @@
+# AvatarsManager
+
+- [Get user avatar](#get-user-avatar)
+- [Add or update user avatar](#add-or-update-user-avatar)
+- [Delete user avatar](#delete-user-avatar)
+
+## Get user avatar
+
+Retrieves an image of a the user's avatar.
+
+This operation is performed by calling function `get_user_avatar`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-users-id-avatar/).
+
+
+
+```python
+client.avatars.get_user_avatar(user.id)
+```
+
+### Arguments
+
+- user_id `str`
+ - The ID of the user. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ByteStream`.
+
+When an avatar can be found for the user the
+image data will be returned in the body of the
+response.
+
+## Add or update user avatar
+
+Adds or updates a user avatar.
+
+This operation is performed by calling function `create_user_avatar`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-users-id-avatar/).
+
+
+
+```python
+client.avatars.create_user_avatar(
+ user.id,
+ decode_base_64_byte_stream(
+ "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEW10NBjBBbqAAAAH0lEQVRoge3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAvg0hAAABmmDh1QAAAABJRU5ErkJggg=="
+ ),
+ pic_file_name="avatar.png",
+ pic_content_type="image/png",
+)
+```
+
+### Arguments
+
+- user_id `str`
+ - The ID of the user. Example: "12345"
+- pic `ByteStream`
+ - The image file to be uploaded to Box. Accepted file extensions are `.jpg` or `.png`. The maximum file size is 1MB.
+- pic_file_name `Optional[str]`
+- pic_content_type `Optional[str]`
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UserAvatar`.
+
+`ok`: Returns the `pic_urls` object with URLs to existing
+user avatars that were updated.`created`: Returns the `pic_urls` object with URLS to user avatars
+uploaded to Box with the request.
+
+## Delete user avatar
+
+Removes an existing user avatar.
+You cannot reverse this operation.
+
+This operation is performed by calling function `delete_user_avatar`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-users-id-avatar/).
+
+
+
+```python
+client.avatars.delete_user_avatar(user.id)
+```
+
+### Arguments
+
+- user_id `str`
+ - The ID of the user. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+`no_content`: Removes the avatar and returns an empty response.
diff --git a/docs/chunked_uploads.md b/docs/chunked_uploads.md
new file mode 100644
index 000000000..2d965c739
--- /dev/null
+++ b/docs/chunked_uploads.md
@@ -0,0 +1,478 @@
+# ChunkedUploadsManager
+
+This is a manager for chunked uploads (allowed for files at least 20MB).
+
+- [Create upload session](#create-upload-session)
+- [Create upload session for existing file](#create-upload-session-for-existing-file)
+- [Get upload session by URL](#get-upload-session-by-url)
+- [Get upload session](#get-upload-session)
+- [Upload part of file by URL](#upload-part-of-file-by-url)
+- [Upload part of file](#upload-part-of-file)
+- [Remove upload session by URL](#remove-upload-session-by-url)
+- [Remove upload session](#remove-upload-session)
+- [List parts by URL](#list-parts-by-url)
+- [List parts](#list-parts)
+- [Commit upload session by URL](#commit-upload-session-by-url)
+- [Commit upload session](#commit-upload-session)
+- [Upload big file](#upload-big-file)
+
+## Create upload session
+
+Creates an upload session for a new file.
+
+This operation is performed by calling function `create_file_upload_session`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-upload-sessions/).
+
+
+
+```python
+client.chunked_uploads.create_file_upload_session(
+ parent_folder_id, file_size, file_name
+)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The ID of the folder to upload the new file to.
+- file_size `int`
+ - The total number of bytes of the file to be uploaded.
+- file_name `str`
+ - The name of new file.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UploadSession`.
+
+Returns a new upload session.
+
+## Create upload session for existing file
+
+Creates an upload session for an existing file.
+
+This operation is performed by calling function `create_file_upload_session_for_existing_file`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-id-upload-sessions/).
+
+_Currently we don't have an example for calling `create_file_upload_session_for_existing_file` in integration tests_
+
+### 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"
+- file_size `int`
+ - The total number of bytes of the file to be uploaded.
+- file_name `Optional[str]`
+ - The optional new name of new file.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UploadSession`.
+
+Returns a new upload session.
+
+## Get upload session by URL
+
+Return information about an upload session.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) endpoint.
+
+This operation is performed by calling function `get_file_upload_session_by_url`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-upload-sessions-id/).
+
+
+
+```python
+client.chunked_uploads.get_file_upload_session_by_url(status_url)
+```
+
+### Arguments
+
+- url `str`
+ - URL of getFileUploadSessionById method
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UploadSession`.
+
+Returns an upload session object.
+
+## Get upload session
+
+Return information about an upload session.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) endpoint.
+
+This operation is performed by calling function `get_file_upload_session_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-upload-sessions-id/).
+
+
+
+```python
+client.chunked_uploads.get_file_upload_session_by_id(upload_session_id)
+```
+
+### Arguments
+
+- upload_session_id `str`
+ - The ID of the upload session. Example: "D5E3F7A"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UploadSession`.
+
+Returns an upload session object.
+
+## Upload part of file by URL
+
+Uploads a chunk of a file for an upload session.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+This operation is performed by calling function `upload_file_part_by_url`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-files-upload-sessions-id/).
+
+
+
+```python
+client.chunked_uploads.upload_file_part_by_url(
+ acc.upload_part_url,
+ generate_byte_stream_from_buffer(chunk_buffer),
+ digest,
+ content_range,
+)
+```
+
+### Arguments
+
+- url `str`
+ - URL of uploadFilePart method
+- request_body `ByteStream`
+ - Request body of uploadFilePart method
+- digest `str`
+ - The [RFC3230][1] message digest of the chunk uploaded. Only SHA1 is supported. The SHA1 digest must be base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. To get the value for the `SHA` digest, use the openSSL command to encode the file part: `openssl sha1 -binary | base64`. [1]: https://tools.ietf.org/html/rfc3230
+- content_range `str`
+ - The byte range of the chunk. Must not overlap with the range of a part already uploaded this session. Each part’s size must be exactly equal in size to the part size specified in the upload session that you created. One exception is the last part of the file, as this can be smaller. When providing the value for `content-range`, remember that: _ The lower bound of each part's byte range must be a multiple of the part size. _ The higher bound must be a multiple of the part size - 1.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UploadedPart`.
+
+Chunk has been uploaded successfully.
+
+## Upload part of file
+
+Uploads a chunk of a file for an upload session.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+This operation is performed by calling function `upload_file_part`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-files-upload-sessions-id/).
+
+
+
+```python
+client.chunked_uploads.upload_file_part(
+ acc.upload_session_id,
+ generate_byte_stream_from_buffer(chunk_buffer),
+ digest,
+ content_range,
+)
+```
+
+### Arguments
+
+- upload_session_id `str`
+ - The ID of the upload session. Example: "D5E3F7A"
+- request_body `ByteStream`
+ - Request body of uploadFilePart method
+- digest `str`
+ - The [RFC3230][1] message digest of the chunk uploaded. Only SHA1 is supported. The SHA1 digest must be base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. To get the value for the `SHA` digest, use the openSSL command to encode the file part: `openssl sha1 -binary | base64`. [1]: https://tools.ietf.org/html/rfc3230
+- content_range `str`
+ - The byte range of the chunk. Must not overlap with the range of a part already uploaded this session. Each part’s size must be exactly equal in size to the part size specified in the upload session that you created. One exception is the last part of the file, as this can be smaller. When providing the value for `content-range`, remember that: _ The lower bound of each part's byte range must be a multiple of the part size. _ The higher bound must be a multiple of the part size - 1.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UploadedPart`.
+
+Chunk has been uploaded successfully.
+
+## Remove upload session by URL
+
+Abort an upload session and discard all data uploaded.
+
+This cannot be reversed.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+This operation is performed by calling function `delete_file_upload_session_by_url`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-files-upload-sessions-id/).
+
+
+
+```python
+client.chunked_uploads.delete_file_upload_session_by_url(abort_url)
+```
+
+### Arguments
+
+- url `str`
+ - URL of deleteFileUploadSessionById method
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the session was
+successfully aborted.
+
+## Remove upload session
+
+Abort an upload session and discard all data uploaded.
+
+This cannot be reversed.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+This operation is performed by calling function `delete_file_upload_session_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-files-upload-sessions-id/).
+
+
+
+```python
+client.chunked_uploads.delete_file_upload_session_by_id(upload_session_id)
+```
+
+### Arguments
+
+- upload_session_id `str`
+ - The ID of the upload session. Example: "D5E3F7A"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the session was
+successfully aborted.
+
+## List parts by URL
+
+Return a list of the chunks uploaded to the upload session so far.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+This operation is performed by calling function `get_file_upload_session_parts_by_url`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-upload-sessions-id-parts/).
+
+
+
+```python
+client.chunked_uploads.get_file_upload_session_parts_by_url(list_parts_url)
+```
+
+### Arguments
+
+- url `str`
+ - URL of getFileUploadSessionParts method
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UploadParts`.
+
+Returns a list of parts that have been uploaded.
+
+## List parts
+
+Return a list of the chunks uploaded to the upload session so far.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+This operation is performed by calling function `get_file_upload_session_parts`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-upload-sessions-id-parts/).
+
+
+
+```python
+client.chunked_uploads.get_file_upload_session_parts(upload_session_id)
+```
+
+### Arguments
+
+- upload_session_id `str`
+ - The ID of the upload session. Example: "D5E3F7A"
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `UploadParts`.
+
+Returns a list of parts that have been uploaded.
+
+## Commit upload session by URL
+
+Close an upload session and create a file from the uploaded chunks.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+This operation is performed by calling function `create_file_upload_session_commit_by_url`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-upload-sessions-id-commit/).
+
+
+
+```python
+client.chunked_uploads.create_file_upload_session_commit_by_url(
+ commit_url, parts, digest
+)
+```
+
+### Arguments
+
+- url `str`
+ - URL of createFileUploadSessionCommit method
+- parts `List[UploadPart]`
+ - The list details for the uploaded parts.
+- digest `str`
+ - The [RFC3230][1] message digest of the whole file. Only SHA1 is supported. The SHA1 digest must be Base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. [1]: https://tools.ietf.org/html/rfc3230
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- if_none_match `Optional[str]`
+ - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since.
+- 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 `Optional[Files]`.
+
+Returns the file object in a list.Returns when all chunks have been uploaded but not yet processed.
+
+Inspect the upload session to get more information about the
+progress of processing the chunks, then retry committing the file
+when all chunks have processed.
+
+## Commit upload session
+
+Close an upload session and create a file from the uploaded chunks.
+
+The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions)
+and [`Get upload session`](e://get-files-upload-sessions-id) endpoints.
+
+This operation is performed by calling function `create_file_upload_session_commit`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-upload-sessions-id-commit/).
+
+
+
+```python
+client.chunked_uploads.create_file_upload_session_commit(
+ upload_session_id, parts, digest
+)
+```
+
+### Arguments
+
+- upload_session_id `str`
+ - The ID of the upload session. Example: "D5E3F7A"
+- parts `List[UploadPart]`
+ - The list details for the uploaded parts.
+- digest `str`
+ - The [RFC3230][1] message digest of the whole file. Only SHA1 is supported. The SHA1 digest must be Base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. [1]: https://tools.ietf.org/html/rfc3230
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- if_none_match `Optional[str]`
+ - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since.
+- 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 `Optional[Files]`.
+
+Returns the file object in a list.Returns when all chunks have been uploaded but not yet processed.
+
+Inspect the upload session to get more information about the
+progress of processing the chunks, then retry committing the file
+when all chunks have processed.
+
+## Upload big file
+
+Starts the process of chunk uploading a big file. Should return a File object representing uploaded file.
+
+This operation is performed by calling function `upload_big_file`.
+
+```python
+client.chunked_uploads.upload_big_file(
+ file_byte_stream, file_name, file_size, parent_folder_id
+)
+```
+
+### Arguments
+
+- file `ByteStream`
+ - The stream of the file to upload.
+- file_name `str`
+ - The name of the file, which will be used for storage in Box.
+- file_size `int`
+ - 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
new file mode 100644
index 000000000..dc49bd650
--- /dev/null
+++ b/docs/classifications.md
@@ -0,0 +1,179 @@
+# ClassificationsManager
+
+- [List all classifications](#list-all-classifications)
+- [Add classification](#add-classification)
+- [Update classification](#update-classification)
+- [Add initial classifications](#add-initial-classifications)
+
+## List all classifications
+
+Retrieves the classification metadata template and lists all the
+classifications available to this enterprise.
+
+This API can also be called by including the enterprise ID in the
+URL explicitly, for example
+`/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
+
+This operation is performed by calling function `get_classification_template`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-metadata-templates-enterprise-securityClassification-6VMVochwUWo-schema/).
+
+
+
+```python
+client.classifications.get_classification_template()
+```
+
+### Arguments
+
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ClassificationTemplate`.
+
+Returns the `securityClassification` metadata template, which contains
+a `Box__Security__Classification__Key` field that lists all the
+classifications available to this enterprise.
+
+## Add classification
+
+Adds one or more new classifications to the list of classifications
+available to the enterprise.
+
+This API can also be called by including the enterprise ID in the
+URL explicitly, for example
+`/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
+
+This operation is performed by calling function `add_classification`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-metadata-templates-enterprise-securityClassification-6VMVochwUWo-schema--add/).
+
+
+
+```python
+client.classifications.add_classification(
+ [
+ AddClassificationRequestBody(
+ data=AddClassificationRequestBodyDataField(
+ key=get_uuid(),
+ static_config=AddClassificationRequestBodyDataStaticConfigField(
+ classification=AddClassificationRequestBodyDataStaticConfigClassificationField(
+ color_id=4, classification_definition="Other description"
+ )
+ ),
+ )
+ )
+ ]
+)
+```
+
+### Arguments
+
+- 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.
+
+### Returns
+
+This function returns a value of type `ClassificationTemplate`.
+
+Returns the updated `securityClassification` metadata template, which
+contains a `Box__Security__Classification__Key` field that lists all
+the classifications available to this enterprise.
+
+## Update classification
+
+Updates the labels and descriptions of one or more classifications
+available to the enterprise.
+
+This API can also be called by including the enterprise ID in the
+URL explicitly, for example
+`/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
+
+This operation is performed by calling function `update_classification`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-metadata-templates-enterprise-securityClassification-6VMVochwUWo-schema--update/).
+
+
+
+```python
+client.classifications.update_classification(
+ [
+ UpdateClassificationRequestBody(
+ 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[UpdateClassificationRequestBody]`
+ - Request body of updateClassification method
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ClassificationTemplate`.
+
+Returns the updated `securityClassification` metadata template, which
+contains a `Box__Security__Classification__Key` field that lists all
+the classifications available to this enterprise.
+
+## Add initial classifications
+
+When an enterprise does not yet have any classifications, this API call
+initializes the classification template with an initial set of
+classifications.
+
+If an enterprise already has a classification, the template will already
+exist and instead an API call should be made to add additional
+classifications.
+
+This operation is performed by calling function `create_classification_template`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-metadata-templates-schema--classifications/).
+
+_Currently we don't have an example for calling `create_classification_template` in integration tests_
+
+### Arguments
+
+- 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 `CreateClassificationTemplateTemplateKey`
+ - Defines the list of metadata templates.
+- 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[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.
+
+### Returns
+
+This function returns a value of type `ClassificationTemplate`.
+
+Returns a new `securityClassification` metadata template, which
+contains a `Box__Security__Classification__Key` field that lists all
+the classifications available to this enterprise.
diff --git a/docs/client.md b/docs/client.md
new file mode 100644
index 000000000..48b11a454
--- /dev/null
+++ b/docs/client.md
@@ -0,0 +1,166 @@
+# Client
+
+This is the central entrypoint for all SDK interaction. The BoxClient houses all the API endpoints
+divided across resource managers.
+
+
+
+
+- [Make custom HTTP request](#make-custom-http-request)
+ - [JSON request](#json-request)
+ - [Multi-part request](#multi-part-request)
+ - [Binary response](#binary-response)
+- [Additional headers](#additional-headers)
+ - [As-User header](#as-user-header)
+ - [Suppress notifications](#suppress-notifications)
+ - [Custom headers](#custom-headers)
+- [Custom Base URLs](#custom-base-urls)
+- [Use Proxy for API calls](#use-proxy-for-api-calls)
+
+
+
+# Make custom HTTP request
+
+You can make custom HTTP requests using the `client.make_request()` method.
+This method allows you to make any HTTP request to the Box API. It will automatically use authentication and
+network configuration settings from the client.
+The method accepts a `FetchOptions` object as an argument and returns a `FetchResponse` object.
+
+## JSON request
+
+The following example demonstrates how to make a custom POST request to create a new folder in the root folder.
+
+```python
+from box_sdk_gen import FetchResponse, FetchOptions
+
+response: FetchResponse = client.make_request(
+ FetchOptions(
+ method="POST",
+ url="https://api.box.com/2.0/folders",
+ data={"name": "new_folder_name", "parent": {"id": "0"}},
+ )
+)
+print("Received status code: ", response.status)
+print("Created folder name: ", response.data["name"])
+```
+
+## Multi-part request
+
+The following example demonstrates how to make a custom multipart request that uploads a file to a folder.
+
+```python
+from box_sdk_gen import FetchResponse, FetchOptions, MultipartItem
+
+response: FetchResponse = client.make_request(
+ FetchOptions(
+ method="POST",
+ url="https://upload.box.com/api/2.0/files/content",
+ content_type="multipart/form-data",
+ multipart_data=[
+ MultipartItem(
+ part_name="attributes",
+ data={"name": "new_folder_name", "parent": {"id": "0"}},
+ ),
+ MultipartItem(part_name="file", file_stream=open("file.txt", "rb")),
+ ],
+ )
+)
+print("Received status code: ", response.status)
+```
+
+## Binary response
+
+The following example demonstrates how to make a custom request that expects a binary response.
+It is required to specify the `response_format` parameter in the `FetchOptions` object to `ResponseFormat.BINARY`.
+
+```python
+from box_sdk_gen import FetchResponse, FetchOptions, ResponseFormat
+
+file_id = "1234567"
+response: FetchResponse = client.make_request(
+ FetchOptions(
+ method="GET",
+ url="".join(["https://api.box.com/2.0/files/", file_id, "/content"]),
+ response_format=ResponseFormat.BINARY,
+ )
+)
+print("Received status code: ", response.status)
+with open("file.txt", "wb") as file:
+ file.write(response.content)
+```
+
+# Additional headers
+
+BoxClient provides a convenient methods, which allow passing additional headers, which will be included
+in every API call made by the client.
+
+## As-User header
+
+The As-User header is used by enterprise admins to make API calls on behalf of their enterprise's users.
+This requires the API request to pass an As-User: USER-ID header. For more details see the [documentation on As-User](https://developer.box.com/en/guides/authentication/oauth2/as-user/).
+
+The following example assume that the client has been instantiated with an access token belonging to an admin-level user
+or Service Account with appropriate privileges to make As-User calls.
+
+Calling the `client.with_as_user_header()` method creates a new client to impersonate user with the provided ID.
+All calls made with the new client will be made in context of the impersonated user, leaving the original client unmodified.
+
+
+
+```python
+user_client = client.with_as_user_header(user_id="1234567")
+```
+
+## Suppress notifications
+
+If you are making administrative API calls (that is, your application has “Manage an Enterprise”
+scope, and the user signing in is a co-admin with the correct "Edit settings for your company"
+permission) then you can suppress both email and webhook notifications. This can be used, for
+example, for a virus-scanning tool to download copies of everyone’s files in an enterprise,
+without every collaborator on the file getting an email. All actions will still appear in users'
+updates feed and audit logs.
+
+> **Note:** This functionality is only available for approved applications.
+
+Calling the `client.with_suppressed_notifications()` method creates a new client.
+For all calls made with the new client the notifications will be suppressed.
+
+```python
+new_client = client.with_suppressed_notifications()
+```
+
+## Custom headers
+
+You can also specify the custom set of headers, which will be included in every API call made by client.
+Calling the `client.with_extra_headers()` method creates a new client, leaving the original client unmodified.
+
+```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",
+ upload_url="https://upload.box.com/api",
+ oauth_2_url="https://account.box.com/api/oauth2",
+ )
+)
+```
+
+# Use Proxy for API calls
+
+In order to use a proxy for API calls, calling the `client.with_proxy(proxyConfig)` method creates a new client, leaving the original client unmodified, with the username and password being optional.
+
+**Note:** We are only supporting http/s proxies with basic authentication. NTLM and other authentication methods are not supported.
+
+```python
+new_client = client.with_proxy(
+ ProxyConfig(url="http://proxy.com", username="username", password="password")
+)
+```
diff --git a/docs/collaboration_allowlist_entries.md b/docs/collaboration_allowlist_entries.md
new file mode 100644
index 000000000..ff1b297b3
--- /dev/null
+++ b/docs/collaboration_allowlist_entries.md
@@ -0,0 +1,133 @@
+# CollaborationAllowlistEntriesManager
+
+- [List allowed collaboration domains](#list-allowed-collaboration-domains)
+- [Add domain to list of allowed collaboration domains](#add-domain-to-list-of-allowed-collaboration-domains)
+- [Get allowed collaboration domain](#get-allowed-collaboration-domain)
+- [Remove domain from list of allowed collaboration domains](#remove-domain-from-list-of-allowed-collaboration-domains)
+
+## List allowed collaboration domains
+
+Returns the list domains that have been deemed safe to create collaborations
+for within the current enterprise.
+
+This operation is performed by calling function `get_collaboration_whitelist_entries`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-collaboration-whitelist-entries/).
+
+
+
+```python
+client.collaboration_allowlist_entries.get_collaboration_whitelist_entries()
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CollaborationAllowlistEntries`.
+
+Returns a collection of domains that are allowed for collaboration.
+
+## Add domain to list of allowed collaboration domains
+
+Creates a new entry in the list of allowed domains to allow
+collaboration for.
+
+This operation is performed by calling function `create_collaboration_whitelist_entry`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-collaboration-whitelist-entries/).
+
+
+
+```python
+client.collaboration_allowlist_entries.create_collaboration_whitelist_entry(
+ domain, CreateCollaborationWhitelistEntryDirection.INBOUND
+)
+```
+
+### Arguments
+
+- domain `str`
+ - The domain to add to the list of allowed domains.
+- 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.
+
+### Returns
+
+This function returns a value of type `CollaborationAllowlistEntry`.
+
+Returns a new entry on the list of allowed domains.
+
+## Get allowed collaboration domain
+
+Returns a domain that has been deemed safe to create collaborations
+for within the current enterprise.
+
+This operation is performed by calling function `get_collaboration_whitelist_entry_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-collaboration-whitelist-entries-id/).
+
+
+
+```python
+client.collaboration_allowlist_entries.get_collaboration_whitelist_entry_by_id(
+ new_entry.id
+)
+```
+
+### Arguments
+
+- collaboration_whitelist_entry_id `str`
+ - The ID of the entry in the list. Example: "213123"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CollaborationAllowlistEntry`.
+
+Returns an entry on the list of allowed domains.
+
+## Remove domain from list of allowed collaboration domains
+
+Removes a domain from the list of domains that have been deemed safe to create
+collaborations for within the current enterprise.
+
+This operation is performed by calling function `delete_collaboration_whitelist_entry_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-collaboration-whitelist-entries-id/).
+
+
+
+```python
+client.collaboration_allowlist_entries.delete_collaboration_whitelist_entry_by_id(
+ entry.id
+)
+```
+
+### Arguments
+
+- collaboration_whitelist_entry_id `str`
+ - The ID of the entry in the list. Example: "213123"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the entry was
+successfully deleted.
diff --git a/docs/collaboration_allowlist_exempt_targets.md b/docs/collaboration_allowlist_exempt_targets.md
new file mode 100644
index 000000000..f5e4077fa
--- /dev/null
+++ b/docs/collaboration_allowlist_exempt_targets.md
@@ -0,0 +1,131 @@
+# CollaborationAllowlistExemptTargetsManager
+
+- [List users exempt from collaboration domain restrictions](#list-users-exempt-from-collaboration-domain-restrictions)
+- [Create user exemption from collaboration domain restrictions](#create-user-exemption-from-collaboration-domain-restrictions)
+- [Get user exempt from collaboration domain restrictions](#get-user-exempt-from-collaboration-domain-restrictions)
+- [Remove user from list of users exempt from domain restrictions](#remove-user-from-list-of-users-exempt-from-domain-restrictions)
+
+## List users exempt from collaboration domain restrictions
+
+Returns a list of users who have been exempt from the collaboration
+domain restrictions.
+
+This operation is performed by calling function `get_collaboration_whitelist_exempt_targets`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-collaboration-whitelist-exempt-targets/).
+
+
+
+```python
+client.collaboration_allowlist_exempt_targets.get_collaboration_whitelist_exempt_targets()
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CollaborationAllowlistExemptTargets`.
+
+Returns a collection of user exemptions.
+
+## Create user exemption from collaboration domain restrictions
+
+Exempts a user from the restrictions set out by the allowed list of domains
+for collaborations.
+
+This operation is performed by calling function `create_collaboration_whitelist_exempt_target`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-collaboration-whitelist-exempt-targets/).
+
+
+
+```python
+client.collaboration_allowlist_exempt_targets.create_collaboration_whitelist_exempt_target(
+ CreateCollaborationWhitelistExemptTargetUser(id=user.id)
+)
+```
+
+### Arguments
+
+- user `CreateCollaborationWhitelistExemptTargetUser`
+ - The user to exempt.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CollaborationAllowlistExemptTarget`.
+
+Returns a new exemption entry.
+
+## Get user exempt from collaboration domain restrictions
+
+Returns a users who has been exempt from the collaboration
+domain restrictions.
+
+This operation is performed by calling function `get_collaboration_whitelist_exempt_target_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-collaboration-whitelist-exempt-targets-id/).
+
+
+
+```python
+client.collaboration_allowlist_exempt_targets.get_collaboration_whitelist_exempt_target_by_id(
+ new_exempt_target.id
+)
+```
+
+### Arguments
+
+- collaboration_whitelist_exempt_target_id `str`
+ - The ID of the exemption to the list. Example: "984923"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CollaborationAllowlistExemptTarget`.
+
+Returns the user's exempted from the list of collaboration domains.
+
+## Remove user from list of users exempt from domain restrictions
+
+Removes a user's exemption from the restrictions set out by the allowed list
+of domains for collaborations.
+
+This operation is performed by calling function `delete_collaboration_whitelist_exempt_target_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-collaboration-whitelist-exempt-targets-id/).
+
+
+
+```python
+client.collaboration_allowlist_exempt_targets.delete_collaboration_whitelist_exempt_target_by_id(
+ exempt_target.id
+)
+```
+
+### Arguments
+
+- collaboration_whitelist_exempt_target_id `str`
+ - The ID of the exemption to the list. Example: "984923"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the exemption was
+successfully deleted.
diff --git a/docs/collections.md b/docs/collections.md
new file mode 100644
index 000000000..7de232627
--- /dev/null
+++ b/docs/collections.md
@@ -0,0 +1,103 @@
+# CollectionsManager
+
+- [List all collections](#list-all-collections)
+- [List collection items](#list-collection-items)
+- [Get collection by ID](#get-collection-by-id)
+
+## List all collections
+
+Retrieves all collections for a given user.
+
+Currently, only the `favorites` collection
+is supported.
+
+This operation is performed by calling function `get_collections`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-collections/).
+
+
+
+```python
+client.collections.get_collections()
+```
+
+### Arguments
+
+- 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.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Collections`.
+
+Returns all collections for the given user.
+
+## List collection items
+
+Retrieves the files and/or folders contained within
+this collection.
+
+This operation is performed by calling function `get_collection_items`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-collections-id-items/).
+
+
+
+```python
+client.collections.get_collection_items(favourite_collection.id)
+```
+
+### Arguments
+
+- collection_id `str`
+ - The ID of the collection. Example: "926489"
+- 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.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ItemsOffsetPaginated`.
+
+Returns an array of items in the collection.
+
+## Get collection by ID
+
+Retrieves a collection by its ID.
+
+This operation is performed by calling function `get_collection_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-collections-id/).
+
+
+
+```python
+client.collections.get_collection_by_id(collections.entries[0].id)
+```
+
+### Arguments
+
+- collection_id `str`
+ - The ID of the collection. Example: "926489"
+- 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 `Collection`.
+
+Returns an array of items in the collection.
diff --git a/docs/comments.md b/docs/comments.md
new file mode 100644
index 000000000..b5434eee3
--- /dev/null
+++ b/docs/comments.md
@@ -0,0 +1,174 @@
+# CommentsManager
+
+- [List file comments](#list-file-comments)
+- [Get comment](#get-comment)
+- [Update comment](#update-comment)
+- [Remove comment](#remove-comment)
+- [Create comment](#create-comment)
+
+## List file comments
+
+Retrieves a list of comments for a file.
+
+This operation is performed by calling function `get_file_comments`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-comments/).
+
+
+
+```python
+client.comments.get_file_comments(file_id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- 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.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Comments`.
+
+Returns a collection of comment objects. If there are no
+comments on this file an empty collection will be returned.
+
+## Get comment
+
+Retrieves the message and metadata for a specific comment, as well
+as information on the user who created the comment.
+
+This operation is performed by calling function `get_comment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-comments-id/).
+
+
+
+```python
+client.comments.get_comment_by_id(new_comment.id)
+```
+
+### Arguments
+
+- comment_id `str`
+ - The ID of the comment. Example: "12345"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CommentFull`.
+
+Returns a full comment object.
+
+## Update comment
+
+Update the message of a comment.
+
+This operation is performed by calling function `update_comment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-comments-id/).
+
+
+
+```python
+client.comments.update_comment_by_id(new_reply_comment.id, message=new_message)
+```
+
+### Arguments
+
+- comment_id `str`
+ - The ID of the comment. Example: "12345"
+- message `Optional[str]`
+ - The text of the comment to update.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CommentFull`.
+
+Returns the updated comment object.
+
+## Remove comment
+
+Permanently deletes a comment.
+
+This operation is performed by calling function `delete_comment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-comments-id/).
+
+
+
+```python
+client.comments.delete_comment_by_id(new_comment.id)
+```
+
+### Arguments
+
+- comment_id `str`
+ - The ID of the comment. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the comment has been deleted.
+
+## Create comment
+
+Adds a comment by the user to a specific file, or
+as a reply to an other comment.
+
+This operation is performed by calling function `create_comment`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-comments/).
+
+
+
+```python
+client.comments.create_comment(
+ message, CreateCommentItem(id=file_id, type=CreateCommentItemTypeField.FILE)
+)
+```
+
+### Arguments
+
+- message `str`
+ - 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 `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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CommentFull`.
+
+Returns the newly created comment object.
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
diff --git a/docs/configuration.md b/docs/configuration.md
new file mode 100644
index 000000000..4c10d7f8e
--- /dev/null
+++ b/docs/configuration.md
@@ -0,0 +1,66 @@
+# Configuration
+
+
+
+
+- [Max retry attempts](#max-retry-attempts)
+- [Custom retry strategy](#custom-retry-strategy)
+
+
+
+## Max retry attempts
+
+The default maximum number of retries in case of failed API call is 5.
+To change this number you should initialize `BoxRetryStrategy` with the new value and pass it to `NetworkSession`.
+
+```python
+from box_sdk_gen import (
+ BoxClient,
+ BoxDeveloperTokenAuth,
+ NetworkSession,
+ BoxRetryStrategy,
+)
+
+auth = BoxDeveloperTokenAuth(token="DEVELOPER_TOKEN_GOES_HERE")
+network_session = NetworkSession(retry_strategy=BoxRetryStrategy(max_attempts=6))
+client = BoxClient(auth=auth, network_session=network_session)
+```
+
+## Custom retry strategy
+
+You can also implement your own retry strategy by subclassing `RetryStrategy` and overriding `should_retry` and `retry_after` methods.
+This example shows how to set custom strategy that retries on 5xx status codes and waits 1 second between retries.
+
+```python
+from box_sdk_gen import (
+ BoxClient,
+ BoxDeveloperTokenAuth,
+ NetworkSession,
+ RetryStrategy,
+ FetchOptions,
+ FetchResponse,
+)
+
+
+class CustomRetryStrategy(RetryStrategy):
+ def should_retry(
+ self,
+ fetch_options: FetchOptions,
+ fetch_response: FetchResponse,
+ attempt_number: int,
+ ) -> bool:
+ return fetch_response.status_code >= 500
+
+ def retry_after(
+ self,
+ fetch_options: FetchOptions,
+ fetch_response: FetchResponse,
+ attempt_number: int,
+ ) -> float:
+ return 1.0
+
+
+auth = BoxDeveloperTokenAuth(token="DEVELOPER_TOKEN_GOES_HERE")
+network_session = NetworkSession(retry_strategy=CustomRetryStrategy())
+client = BoxClient(auth=auth, network_session=network_session)
+```
diff --git a/docs/device_pinners.md b/docs/device_pinners.md
new file mode 100644
index 000000000..77fd4ce41
--- /dev/null
+++ b/docs/device_pinners.md
@@ -0,0 +1,98 @@
+# DevicePinnersManager
+
+- [Get device pin](#get-device-pin)
+- [Remove device pin](#remove-device-pin)
+- [List enterprise device pins](#list-enterprise-device-pins)
+
+## Get device pin
+
+Retrieves information about an individual device pin.
+
+This operation is performed by calling function `get_device_pinner_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-device-pinners-id/).
+
+
+
+```python
+client.device_pinners.get_device_pinner_by_id(device_pinner_id)
+```
+
+### Arguments
+
+- device_pinner_id `str`
+ - The ID of the device pin. Example: "2324234"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DevicePinner`.
+
+Returns information about a single device pin.
+
+## Remove device pin
+
+Deletes an individual device pin.
+
+This operation is performed by calling function `delete_device_pinner_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-device-pinners-id/).
+
+
+
+```python
+client.device_pinners.delete_device_pinner_by_id(device_pinner_id)
+```
+
+### Arguments
+
+- device_pinner_id `str`
+ - The ID of the device pin. Example: "2324234"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the pin has been deleted.
+
+## List enterprise device pins
+
+Retrieves all the device pins within an enterprise.
+
+The user must have admin privileges, and the application
+needs the "manage enterprise" scope to make this call.
+
+This operation is performed by calling function `get_enterprise_device_pinners`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-enterprises-id-device-pinners/).
+
+
+
+```python
+client.device_pinners.get_enterprise_device_pinners(enterprise_id)
+```
+
+### Arguments
+
+- enterprise_id `str`
+ - The ID of the enterprise. Example: "3442311"
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- 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.
+
+### Returns
+
+This function returns a value of type `DevicePinners`.
+
+Returns a list of device pins for a given enterprise.
diff --git a/docs/docgen.md b/docs/docgen.md
new file mode 100644
index 000000000..6e2a00bac
--- /dev/null
+++ b/docs/docgen.md
@@ -0,0 +1,148 @@
+# DocgenManager
+
+- [Get Box Doc Gen job by ID](#get-box-doc-gen-job-by-id)
+- [List all Box Doc Gen jobs](#list-all-box-doc-gen-jobs)
+- [Get Box Doc Gen jobs by batch ID](#get-box-doc-gen-jobs-by-batch-id)
+- [Generate document using Box Doc Gen template](#generate-document-using-box-doc-gen-template)
+
+## Get Box Doc Gen job by ID
+
+Get details of the Box Doc Gen job.
+
+This operation is performed by calling function `get_docgen_job_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-docgen-jobs-id/).
+
+
+
+```python
+client.docgen.get_docgen_job_by_id_v2025_r0(docgen_job_item_from_list.id)
+```
+
+### Arguments
+
+- job_id `str`
+ - Box Doc Gen job ID. Example: 123
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenJobV2025R0`.
+
+Details of the Box Doc Gen job.
+
+## List all Box Doc Gen jobs
+
+Lists all Box Doc Gen jobs for a user.
+
+This operation is performed by calling function `get_docgen_jobs_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-docgen-jobs/).
+
+
+
+```python
+client.docgen.get_docgen_jobs_v2025_r0(limit=500)
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenJobsFullV2025R0`.
+
+A list of Box Doc Gen jobs.
+
+## Get Box Doc Gen jobs by batch ID
+
+Lists Box Doc Gen jobs in a batch.
+
+This operation is performed by calling function `get_docgen_batch_job_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-docgen-batch-jobs-id/).
+
+
+
+```python
+client.docgen.get_docgen_batch_job_by_id_v2025_r0(docgen_batch.id)
+```
+
+### Arguments
+
+- batch_id `str`
+ - Box Doc Gen batch ID. Example: 123
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenJobsV2025R0`.
+
+Returns a list of Box Doc Gen jobs in a Box Doc Gen batch.
+
+## Generate document using Box Doc Gen template
+
+Generates a document using a Box Doc Gen template.
+
+This operation is performed by calling function `create_docgen_batch_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/post-docgen-batches/).
+
+
+
+```python
+client.docgen.create_docgen_batch_v2025_r0(
+ FileReferenceV2025R0(id=uploaded_file.id),
+ "api",
+ CreateDocgenBatchV2025R0DestinationFolder(id=folder.id),
+ "pdf",
+ [
+ DocGenDocumentGenerationDataV2025R0(
+ generated_file_name="test", user_input={"abc": "xyz"}
+ )
+ ],
+)
+```
+
+### Arguments
+
+- file `FileReferenceV2025R0`
+- file_version `Optional[FileVersionBaseV2025R0]`
+- input_source `str`
+ - Source of input. The value has to be `api` for all the API-based document generation requests.
+- destination_folder `CreateDocgenBatchV2025R0DestinationFolder`
+- output_type `str`
+ - Type of the output file.
+- document_generation_data `List[DocGenDocumentGenerationDataV2025R0]`
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenBatchBaseV2025R0`.
+
+The created Batch ID.
diff --git a/docs/docgen_template.md b/docs/docgen_template.md
new file mode 100644
index 000000000..e9e979a55
--- /dev/null
+++ b/docs/docgen_template.md
@@ -0,0 +1,207 @@
+# DocgenTemplateManager
+
+- [Create Box Doc Gen template](#create-box-doc-gen-template)
+- [List Box Doc Gen templates](#list-box-doc-gen-templates)
+- [Delete Box Doc Gen template](#delete-box-doc-gen-template)
+- [Get Box Doc Gen template by ID](#get-box-doc-gen-template-by-id)
+- [List all Box Doc Gen template tags in template](#list-all-box-doc-gen-template-tags-in-template)
+- [Get list of all Box Doc Gen jobs for template](#get-list-of-all-box-doc-gen-jobs-for-template)
+
+## Create Box Doc Gen template
+
+Marks a file as a Box Doc Gen template.
+
+This operation is performed by calling function `create_docgen_template_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/post-docgen-templates/).
+
+
+
+```python
+client.docgen_template.create_docgen_template_v2025_r0(FileReferenceV2025R0(id=file.id))
+```
+
+### Arguments
+
+- file `FileReferenceV2025R0`
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenTemplateBaseV2025R0`.
+
+The file which has now been marked as a Box Doc Gen template.
+
+## List Box Doc Gen templates
+
+Lists Box Doc Gen templates on which the user is a collaborator.
+
+This operation is performed by calling function `get_docgen_templates_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-docgen-templates/).
+
+
+
+```python
+client.docgen_template.get_docgen_templates_v2025_r0()
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenTemplatesV2025R0`.
+
+Returns a collection of templates.
+
+## Delete Box Doc Gen template
+
+Unmarks file as Box Doc Gen template.
+
+This operation is performed by calling function `delete_docgen_template_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/delete-docgen-templates-id/).
+
+
+
+```python
+client.docgen_template.delete_docgen_template_by_id_v2025_r0(
+ created_docgen_template.file.id
+)
+```
+
+### Arguments
+
+- template_id `str`
+ - ID of the file which will no longer be marked as a Box Doc Gen template. Example: "123"
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when a file is no longer marked as a Box Doc Gen template.
+
+## Get Box Doc Gen template by ID
+
+Lists details of a specific Box Doc Gen template.
+
+This operation is performed by calling function `get_docgen_template_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-docgen-templates-id/).
+
+
+
+```python
+client.docgen_template.get_docgen_template_by_id_v2025_r0(
+ created_docgen_template.file.id
+)
+```
+
+### Arguments
+
+- template_id `str`
+ - The ID of a Box Doc Gen template. Example: 123
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenTemplateV2025R0`.
+
+Returns a template.
+
+## List all Box Doc Gen template tags in template
+
+Lists all tags in a Box Doc Gen template.
+
+This operation is performed by calling function `get_docgen_template_tags_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-docgen-templates-id-tags/).
+
+
+
+```python
+client.docgen_template.get_docgen_template_tags_v2025_r0(
+ fetched_docgen_template.file.id
+)
+```
+
+### Arguments
+
+- template_id `str`
+ - ID of template. Example: 123
+- template_version_id `Optional[str]`
+ - Id of template version.
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenTagsV2025R0`.
+
+A list of document generation template tags.Processing tags for the file.
+
+## Get list of all Box Doc Gen jobs for template
+
+Lists the users jobs which use this template.
+
+This operation is performed by calling function `get_docgen_template_job_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-docgen-template-jobs-id/).
+
+
+
+```python
+client.docgen_template.get_docgen_template_job_by_id_v2025_r0(
+ fetched_docgen_template.file.id
+)
+```
+
+### Arguments
+
+- template_id `str`
+ - Id of template to fetch jobs for. Example: 123
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `DocGenJobsV2025R0`.
+
+A single Box Doc Gen template.
diff --git a/docs/downloads.md b/docs/downloads.md
new file mode 100644
index 000000000..46ea036eb
--- /dev/null
+++ b/docs/downloads.md
@@ -0,0 +1,128 @@
+# DownloadsManager
+
+- [Download file URL](#download-file-url)
+- [Download file](#download-file)
+- [Download file](#download-file)
+
+## Download file URL
+
+Get the download URL without downloading the content.
+
+This operation is performed by calling function `get_download_file_url`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-content/).
+
+
+
+```python
+client.downloads.get_download_file_url(uploaded_file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- version `Optional[str]`
+ - The file version to download.
+- access_token `Optional[str]`
+ - An optional access token that can be used to pre-authenticate this request, which means that a download link can be shared with a browser or a third party service without them needing to know how to handle the authentication. When using this parameter, please make sure that the access token is sufficiently scoped down to only allow read access to that file and no other files or folders.
+- range `Optional[str]`
+ - The byte range of the content to download. The format `bytes={start_byte}-{end_byte}` can be used to specify what section of the file to download.
+- boxapi `Optional[str]`
+ - The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format `shared_link=[link]` or if a password is required then use `shared_link=[link]&shared_link_password=[password]`. This header can be used on the file or folder shared, as well as on any files or folders nested within the item.
+- 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 `str`.
+
+Returns the requested file if the client has the **follow
+redirects** setting enabled to automatically
+follow HTTP `3xx` responses as redirects. If not, the request
+will return `302` instead.
+For details, see
+the [download file guide](g://downloads/file#download-url).If the file is not ready to be downloaded yet `Retry-After` header will
+be returned indicating the time in seconds after which the file will
+be available for the client to download.
+
+This response can occur when the file was uploaded immediately before the
+download request.
+
+## Download file
+
+Returns the contents of a file in binary format.
+
+This operation is performed by calling function `download_file`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-content/).
+
+
+
+```python
+client.downloads.download_file(uploaded_file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- version `Optional[str]`
+ - The file version to download.
+- access_token `Optional[str]`
+ - An optional access token that can be used to pre-authenticate this request, which means that a download link can be shared with a browser or a third party service without them needing to know how to handle the authentication. When using this parameter, please make sure that the access token is sufficiently scoped down to only allow read access to that file and no other files or folders.
+- range `Optional[str]`
+ - The byte range of the content to download. The format `bytes={start_byte}-{end_byte}` can be used to specify what section of the file to download.
+- boxapi `Optional[str]`
+ - The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format `shared_link=[link]` or if a password is required then use `shared_link=[link]&shared_link_password=[password]`. This header can be used on the file or folder shared, as well as on any files or folders nested within the item.
+- 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 `Optional[ByteStream]`.
+
+Returns the requested file if the client has the **follow
+redirects** setting enabled to automatically
+follow HTTP `3xx` responses as redirects. If not, the request
+will return `302` instead.
+For details, see
+the [download file guide](g://downloads/file#download-url).If the file is not ready to be downloaded yet `Retry-After` header will
+be returned indicating the time in seconds after which the file will
+be available for the client to download.
+
+This response can occur when the file was uploaded immediately before the
+download request.
+
+## Download file
+
+Download file to a given output stream
+
+This operation is performed by calling function `download_file_to_output_stream`.
+
+```python
+client.downloads.download_file_to_output_stream(uploaded_file.id, file_output_stream)
+```
+
+### 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"
+- output_stream `OutputStream`
+ - Download file to a given output stream
+- version `Optional[str]`
+ - The file version to download.
+- access_token `Optional[str]`
+ - An optional access token that can be used to pre-authenticate this request, which means that a download link can be shared with a browser or a third party service without them needing to know how to handle the authentication. When using this parameter, please make sure that the access token is sufficiently scoped down to only allow read access to that file and no other files or folders.
+- range `Optional[str]`
+ - The byte range of the content to download. The format `bytes={start_byte}-{end_byte}` can be used to specify what section of the file to download.
+- boxapi `Optional[str]`
+ - The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format `shared_link=[link]` or if a password is required then use `shared_link=[link]&shared_link_password=[password]`. This header can be used on the file or folder shared, as well as on any files or folders nested within the item.
+- 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`.
diff --git a/docs/email_aliases.md b/docs/email_aliases.md
new file mode 100644
index 000000000..538ee43bf
--- /dev/null
+++ b/docs/email_aliases.md
@@ -0,0 +1,94 @@
+# EmailAliasesManager
+
+- [List user's email aliases](#list-users-email-aliases)
+- [Create email alias](#create-email-alias)
+- [Remove email alias](#remove-email-alias)
+
+## List user's email aliases
+
+Retrieves all email aliases for a user. The collection
+does not include the primary login for the user.
+
+This operation is performed by calling function `get_user_email_aliases`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-users-id-email-aliases/).
+
+
+
+```python
+client.email_aliases.get_user_email_aliases(new_user.id)
+```
+
+### Arguments
+
+- user_id `str`
+ - The ID of the user. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `EmailAliases`.
+
+Returns a collection of email aliases.
+
+## Create email alias
+
+Adds a new email alias to a user account..
+
+This operation is performed by calling function `create_user_email_alias`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-users-id-email-aliases/).
+
+
+
+```python
+client.email_aliases.create_user_email_alias(new_user.id, new_alias_email)
+```
+
+### Arguments
+
+- user_id `str`
+ - The ID of the user. Example: "12345"
+- email `str`
+ - The email address to add to the account as an alias. Note: The domain of the email alias needs to be registered to your enterprise. See the [domain verification guide](https://support.box.com/hc/en-us/articles/4408619650579-Domain-Verification) for steps to add a new domain.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `EmailAlias`.
+
+Returns the newly created email alias object.
+
+## Remove email alias
+
+Removes an email alias from a user.
+
+This operation is performed by calling function `delete_user_email_alias_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-users-id-email-aliases-id/).
+
+
+
+```python
+client.email_aliases.delete_user_email_alias_by_id(new_user.id, new_alias.id)
+```
+
+### Arguments
+
+- user_id `str`
+ - The ID of the user. Example: "12345"
+- email_alias_id `str`
+ - The ID of the email alias. Example: "23432"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Removes the alias and returns an empty response.
diff --git a/docs/events.md b/docs/events.md
new file mode 100644
index 000000000..4dcf3c644
--- /dev/null
+++ b/docs/events.md
@@ -0,0 +1,115 @@
+# EventsManager
+
+- [Get events long poll endpoint](#get-events-long-poll-endpoint)
+- [List user and enterprise events](#list-user-and-enterprise-events)
+
+## Get events long poll endpoint
+
+Returns a list of real-time servers that can be used for long-polling updates
+to the [event stream](#get-events).
+
+Long polling is the concept where a HTTP request is kept open until the
+server sends a response, then repeating the process over and over to receive
+updated responses.
+
+Long polling the event stream can only be used for user events, not for
+enterprise events.
+
+To use long polling, first use this endpoint to retrieve a list of long poll
+URLs. Next, make a long poll request to any of the provided URLs.
+
+When an event occurs in monitored account a response with the value
+`new_change` will be sent. The response contains no other details as
+it only serves as a prompt to take further action such as sending a
+request to the [events endpoint](#get-events) with the last known
+`stream_position`.
+
+After the server sends this response it closes the connection. You must now
+repeat the long poll process to begin listening for events again.
+
+If no events occur for a while and the connection times out you will
+receive a response with the value `reconnect`. When you receive this response
+you’ll make another call to this endpoint to restart the process.
+
+If you receive no events in `retry_timeout` seconds then you will need to
+make another request to the real-time server (one of the URLs in the response
+for this endpoint). This might be necessary due to network errors.
+
+Finally, if you receive a `max_retries` error when making a request to the
+real-time server, you should start over by making a call to this endpoint
+first.
+
+This operation is performed by calling function `get_events_with_long_polling`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/options-events/).
+
+
+
+```python
+client.events.get_events_with_long_polling()
+```
+
+### Arguments
+
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RealtimeServers`.
+
+Returns a paginated array of servers that can be used
+instead of the regular endpoints for long-polling events.
+
+## List user and enterprise events
+
+Returns up to a year of past events for a given user
+or for the entire enterprise.
+
+By default this returns events for the authenticated user. To retrieve events
+for the entire enterprise, set the `stream_type` to `admin_logs_streaming`
+for live monitoring of new events, or `admin_logs` for querying across
+historical events. The user making the API call will
+need to have admin privileges, and the application will need to have the
+scope `manage enterprise properties` checked.
+
+This operation is performed by calling function `get_events`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-events/).
+
+
+
+```python
+client.events.get_events()
+```
+
+### Arguments
+
+- 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[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[DateTime]`
+ - 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.
+- created_before `Optional[DateTime]`
+ - The upper 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Events`.
+
+Returns a list of event objects.
+
+Events objects are returned in pages, with each page (chunk)
+including a list of event objects. The response includes a
+`chunk_size` parameter indicating how many events were returned in this
+chunk, as well as the next `stream_position` that can be
+queried.
diff --git a/docs/file_classifications.md b/docs/file_classifications.md
new file mode 100644
index 000000000..113e50d7d
--- /dev/null
+++ b/docs/file_classifications.md
@@ -0,0 +1,149 @@
+# FileClassificationsManager
+
+- [Get classification on file](#get-classification-on-file)
+- [Add classification to file](#add-classification-to-file)
+- [Update classification on file](#update-classification-on-file)
+- [Remove classification from file](#remove-classification-from-file)
+
+## Get classification on file
+
+Retrieves the classification metadata instance that
+has been applied to a file.
+
+This API can also be called by including the enterprise ID in the
+URL explicitly, for example
+`/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`.
+
+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-securityClassification-6VMVochwUWo/).
+
+
+
+```python
+client.file_classifications.get_classification_on_file(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Classification`.
+
+Returns an instance of the `securityClassification` metadata
+template, which contains a `Box__Security__Classification__Key`
+field that lists all the classifications available to this
+enterprise.
+
+## Add classification to file
+
+Adds a classification to a file by specifying the label of the
+classification to add.
+
+This API can also be called by including the enterprise ID in the
+URL explicitly, for example
+`/files/:id//enterprise_12345/securityClassification-6VMVochwUWo`.
+
+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-securityClassification-6VMVochwUWo/).
+
+
+
+```python
+client.file_classifications.add_classification_to_file(
+ file.id, box_security_classification_key=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"
+- box_security_classification_key `Optional[str]`
+ - The name of the classification to apply to this file. To list the available classifications in an enterprise, use the classification API to retrieve the [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema) which lists all available classification keys.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Classification`.
+
+Returns the classification template instance
+that was applied to the file.
+
+## Update classification on file
+
+Updates a classification on a file.
+
+The classification can only be updated if a classification has already been
+applied to the file before. When editing classifications, only values are
+defined for the enterprise will be accepted.
+
+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-securityClassification-6VMVochwUWo/).
+
+
+
+```python
+client.file_classifications.update_classification_on_file(
+ file.id, [UpdateClassificationOnFileRequestBody(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[UpdateClassificationOnFileRequestBody]`
+ - Request body of updateClassificationOnFile method
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Classification`.
+
+Returns the updated classification metadata template instance.
+
+## Remove classification from file
+
+Removes any classifications from a file.
+
+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_classification_from_file`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-files-id-metadata-enterprise-securityClassification-6VMVochwUWo/).
+
+
+
+```python
+client.file_classifications.delete_classification_from_file(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the classification is
+successfully deleted.
diff --git a/docs/file_metadata.md b/docs/file_metadata.md
new file mode 100644
index 000000000..5f611f001
--- /dev/null
+++ b/docs/file_metadata.md
@@ -0,0 +1,231 @@
+# FileMetadataManager
+
+- [List metadata instances on file](#list-metadata-instances-on-file)
+- [Get metadata instance on file](#get-metadata-instance-on-file)
+- [Create metadata instance on file](#create-metadata-instance-on-file)
+- [Update metadata instance on file](#update-metadata-instance-on-file)
+- [Remove metadata instance from file](#remove-metadata-instance-from-file)
+
+## List metadata instances on file
+
+Retrieves all metadata for a given file.
+
+This operation is performed by calling function `get_file_metadata`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-metadata/).
+
+
+
+```python
+client.file_metadata.get_file_metadata(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Metadatas`.
+
+Returns all the metadata associated with a file.
+
+This API does not support pagination and will therefore always return
+all of the metadata associated to the file.
+
+## Get metadata instance on file
+
+Retrieves the instance of a metadata template that has been applied to a
+file.
+
+This operation is performed by calling function `get_file_metadata_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-metadata-id-id/).
+
+
+
+```python
+client.file_metadata.get_file_metadata_by_id(
+ file.id, GetFileMetadataByIdScope.GLOBAL, "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 `GetFileMetadataByIdScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataFull`.
+
+An instance of the metadata template that includes
+additional "key:value" pairs defined by the user or
+an application.
+
+## Create metadata instance on file
+
+Applies an instance of a metadata template to a file.
+
+In most cases only values that are present in the metadata template
+will be accepted, except for the `global.properties` template which accepts
+any key-value pair.
+
+This operation is performed by calling function `create_file_metadata_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-id-metadata-id-id/).
+
+
+
+```python
+client.file_metadata.create_file_metadata_by_id(
+ file.id,
+ CreateFileMetadataByIdScope.ENTERPRISE,
+ template_key,
+ {
+ "name": "John",
+ "age": 23,
+ "birthDate": "2001-01-03T02:20:50.520Z",
+ "countryCode": "US",
+ "sports": ["basketball", "tennis"],
+ },
+)
+```
+
+### 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 `CreateFileMetadataByIdScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- request_body `Dict`
+ - Request body of createFileMetadataById method
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataFull`.
+
+Returns the instance of the template that was applied to the file,
+including the data that was applied to the template.
+
+## Update metadata instance on file
+
+Updates a piece of metadata on a file.
+
+The metadata instance can only be updated if the template has already been
+applied to the file before. When editing metadata, only values that match
+the metadata template schema will be accepted.
+
+The update is applied atomically. If any errors occur during the
+application of the operations, the metadata instance will not be changed.
+
+This operation is performed by calling function `update_file_metadata_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-files-id-metadata-id-id/).
+
+
+
+```python
+client.file_metadata.update_file_metadata_by_id(
+ file.id,
+ UpdateFileMetadataByIdScope.ENTERPRISE,
+ template_key,
+ [
+ UpdateFileMetadataByIdRequestBody(
+ op=UpdateFileMetadataByIdRequestBodyOpField.REPLACE,
+ path="/name",
+ value="Jack",
+ ),
+ UpdateFileMetadataByIdRequestBody(
+ op=UpdateFileMetadataByIdRequestBodyOpField.REPLACE, path="/age", value=24
+ ),
+ UpdateFileMetadataByIdRequestBody(
+ op=UpdateFileMetadataByIdRequestBodyOpField.REPLACE,
+ path="/birthDate",
+ value="2000-01-03T02:20:50.520Z",
+ ),
+ UpdateFileMetadataByIdRequestBody(
+ op=UpdateFileMetadataByIdRequestBodyOpField.REPLACE,
+ path="/countryCode",
+ value="CA",
+ ),
+ UpdateFileMetadataByIdRequestBody(
+ op=UpdateFileMetadataByIdRequestBodyOpField.REPLACE,
+ path="/sports",
+ value=["football"],
+ ),
+ ],
+)
+```
+
+### 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 `UpdateFileMetadataByIdScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- 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.
+
+### Returns
+
+This function returns a value of type `MetadataFull`.
+
+Returns the updated metadata template instance, with the
+custom template data included.
+
+## Remove metadata instance from file
+
+Deletes a piece of file metadata.
+
+This operation is performed by calling function `delete_file_metadata_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-files-id-metadata-id-id/).
+
+
+
+```python
+client.file_metadata.delete_file_metadata_by_id(
+ file.id, DeleteFileMetadataByIdScope.ENTERPRISE, 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 `DeleteFileMetadataByIdScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the metadata is
+successfully deleted.
diff --git a/docs/file_requests.md b/docs/file_requests.md
new file mode 100644
index 000000000..3c77125f2
--- /dev/null
+++ b/docs/file_requests.md
@@ -0,0 +1,156 @@
+# FileRequestsManager
+
+- [Get file request](#get-file-request)
+- [Update file request](#update-file-request)
+- [Delete file request](#delete-file-request)
+- [Copy file request](#copy-file-request)
+
+## Get file request
+
+Retrieves the information about a file request.
+
+This operation is performed by calling function `get_file_request_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-file-requests-id/).
+
+
+
+```python
+client.file_requests.get_file_request_by_id(file_request_id)
+```
+
+### 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"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileRequest`.
+
+Returns a file request object.
+
+## Update file request
+
+Updates a file request. This can be used to activate or
+deactivate a file request.
+
+This operation is performed by calling function `update_file_request_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-file-requests-id/).
+
+
+
+```python
+client.file_requests.update_file_request_by_id(
+ copied_file_request.id, title="updated title", description="updated description"
+)
+```
+
+### 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"
+- 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[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.
+- is_description_required `Optional[bool]`
+ - Whether a file request submitter is required to provide a description of the files they are submitting. When this setting is set to true, the Box UI will show a description field on the file request form. This will default to the value on the existing file request.
+- expires_at `Optional[DateTime]`
+ - The date after which a file request will no longer accept new submissions. After this date, the `status` will automatically be set to `inactive`. This will default to the value on the existing file request.
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileRequest`.
+
+Returns the updated file request object.
+
+## Delete file request
+
+Deletes a file request permanently.
+
+This operation is performed by calling function `delete_file_request_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-file-requests-id/).
+
+
+
+```python
+client.file_requests.delete_file_request_by_id(updated_file_request.id)
+```
+
+### 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"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the file request has been successfully
+deleted.
+
+## Copy file request
+
+Copies an existing file request that is already present on one folder,
+and applies it to another folder.
+
+This operation is performed by calling function `create_file_request_copy`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-file-requests-id-copy/).
+
+
+
+```python
+client.file_requests.create_file_request_copy(
+ file_request_id,
+ CreateFileRequestCopyFolder(
+ id=file_request.folder.id, type=CreateFileRequestCopyFolderTypeField.FOLDER
+ ),
+)
+```
+
+### 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 `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[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.
+- is_description_required `Optional[bool]`
+ - Whether a file request submitter is required to provide a description of the files they are submitting. When this setting is set to true, the Box UI will show a description field on the file request form. This will default to the value on the existing file request.
+- expires_at `Optional[DateTime]`
+ - The date after which a file request will no longer accept new submissions. After this date, the `status` will automatically be set to `inactive`. This will default to the value on the existing file request.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileRequest`.
+
+Returns updated file request object.
diff --git a/docs/file_version_legal_holds.md b/docs/file_version_legal_holds.md
new file mode 100644
index 000000000..7026d2234
--- /dev/null
+++ b/docs/file_version_legal_holds.md
@@ -0,0 +1,87 @@
+# FileVersionLegalHoldsManager
+
+- [Get file version legal hold](#get-file-version-legal-hold)
+- [List file version legal holds](#list-file-version-legal-holds)
+
+## Get file version legal hold
+
+Retrieves information about the legal hold policies
+assigned to a file version.
+
+This operation is performed by calling function `get_file_version_legal_hold_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-file-version-legal-holds-id/).
+
+
+
+```python
+client.file_version_legal_holds.get_file_version_legal_hold_by_id(
+ file_version_legal_hold_id
+)
+```
+
+### Arguments
+
+- file_version_legal_hold_id `str`
+ - The ID of the file version legal hold. Example: "2348213"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileVersionLegalHold`.
+
+Returns the legal hold policy assignments for the file version.
+
+## List file version legal holds
+
+Get a list of file versions on legal hold for a legal hold
+assignment.
+
+Due to ongoing re-architecture efforts this API might not return all file
+versions for this policy ID.
+
+Instead, this API will only return file versions held in the legacy
+architecture. Two new endpoints will available to request any file versions
+held in the new architecture.
+
+For file versions held in the new architecture, the `GET
+/legal_hold_policy_assignments/:id/file_versions_on_hold` API can be used to
+return all past file versions available for this policy assignment, and the
+`GET /legal_hold_policy_assignments/:id/files_on_hold` API can be used to
+return any current (latest) versions of a file under legal hold.
+
+The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to
+find a list of policy assignments for a given policy ID.
+
+Once the re-architecture is completed this API will be deprecated.
+
+This operation is performed by calling function `get_file_version_legal_holds`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-file-version-legal-holds/).
+
+
+
+```python
+client.file_version_legal_holds.get_file_version_legal_holds(policy_id)
+```
+
+### Arguments
+
+- policy_id `str`
+ - The ID of the legal hold policy to get the file version legal holds for.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileVersionLegalHolds`.
+
+Returns the list of file version legal holds for a specific legal
+hold policy.
diff --git a/docs/file_version_retentions.md b/docs/file_version_retentions.md
new file mode 100644
index 000000000..890fac999
--- /dev/null
+++ b/docs/file_version_retentions.md
@@ -0,0 +1,86 @@
+# FileVersionRetentionsManager
+
+- [List file version retentions](#list-file-version-retentions)
+- [Get retention on file](#get-retention-on-file)
+
+## List file version retentions
+
+Retrieves all file version retentions for the given enterprise.
+
+**Note**:
+File retention API is now **deprecated**.
+To get information about files and file versions under retention,
+see [files under retention](e://get-retention-policy-assignments-id-files-under-retention) or [file versions under retention](e://get-retention-policy-assignments-id-file-versions-under-retention) endpoints.
+
+This operation is performed by calling function `get_file_version_retentions`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-file-version-retentions/).
+
+
+
+```python
+client.file_version_retentions.get_file_version_retentions()
+```
+
+### Arguments
+
+- file_id `Optional[str]`
+ - Filters results by files with this ID.
+- file_version_id `Optional[str]`
+ - Filters results by file versions with this ID.
+- policy_id `Optional[str]`
+ - Filters results by the retention policy with this ID.
+- 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.
+- disposition_after `Optional[str]`
+ - Filters results by files that will have their disposition come into effect after this date.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileVersionRetentions`.
+
+Returns a list of all file version retentions for the enterprise.
+
+## Get retention on file
+
+Returns information about a file version retention.
+
+**Note**:
+File retention API is now **deprecated**.
+To get information about files and file versions under retention,
+see [files under retention](e://get-retention-policy-assignments-id-files-under-retention) or [file versions under retention](e://get-retention-policy-assignments-id-file-versions-under-retention) endpoints.
+
+This operation is performed by calling function `get_file_version_retention_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-file-version-retentions-id/).
+
+
+
+```python
+client.file_version_retentions.get_file_version_retention_by_id(
+ file_version_retention.id
+)
+```
+
+### Arguments
+
+- file_version_retention_id `str`
+ - The ID of the file version retention. Example: "3424234"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileVersionRetention`.
+
+Returns a file version retention object.
diff --git a/docs/file_versions.md b/docs/file_versions.md
new file mode 100644
index 000000000..dbd919f82
--- /dev/null
+++ b/docs/file_versions.md
@@ -0,0 +1,205 @@
+# FileVersionsManager
+
+- [List all file versions](#list-all-file-versions)
+- [Get file version](#get-file-version)
+- [Remove file version](#remove-file-version)
+- [Restore file version](#restore-file-version)
+- [Promote file version](#promote-file-version)
+
+## List all file versions
+
+Retrieve a list of the past versions for a file.
+
+Versions are only tracked by Box users with premium accounts. To fetch the ID
+of the current version of a file, use the `GET /file/:id` API.
+
+This operation is performed by calling function `get_file_versions`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-versions/).
+
+
+
+```python
+client.file_versions.get_file_versions(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- 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.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileVersions`.
+
+Returns an array of past versions for this file.
+
+## Get file version
+
+Retrieve a specific version of a file.
+
+Versions are only tracked for Box users with premium accounts.
+
+This operation is performed by calling function `get_file_version_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-versions-id/).
+
+
+
+```python
+client.file_versions.get_file_version_by_id(file.id, file_versions.entries[0].id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- file_version_id `str`
+ - The ID of the file version. Example: "1234"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileVersionFull`.
+
+Returns a specific version of a file.
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
+
+## Remove file version
+
+Move a file version to the trash.
+
+Versions are only tracked for Box users with premium accounts.
+
+This operation is performed by calling function `delete_file_version_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-files-id-versions-id/).
+
+
+
+```python
+client.file_versions.delete_file_version_by_id(file.id, file_version.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- file_version_id `str`
+ - The ID of the file version. Example: "1234"
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the file has been successfully
+deleted.
+
+## Restore file version
+
+Restores a specific version of a file after it was deleted.
+Don't use this endpoint to restore Box Notes,
+as it works with file formats such as PDF, DOC,
+PPTX or similar.
+
+This operation is performed by calling function `update_file_version_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-files-id-versions-id/).
+
+
+
+```python
+client.file_versions.update_file_version_by_id(
+ file.id, file_version.id, trashed_at=create_null()
+)
+```
+
+### 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"
+- file_version_id `str`
+ - The ID of the file version. Example: "1234"
+- trashed_at `Optional[str]`
+ - Set this to `null` to clear the date and restore the file.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileVersionFull`.
+
+Returns a restored file version object.
+
+## Promote file version
+
+Promote a specific version of a file.
+
+If previous versions exist, this method can be used to
+promote one of the older versions to the top of the version history.
+
+This creates a new copy of the old version and puts it at the
+top of the versions history. The file will have the exact same contents
+as the older version, with the the same hash digest, `etag`, and
+name as the original.
+
+Other properties such as comments do not get updated to their
+former values.
+
+Don't use this endpoint to restore Box Notes,
+as it works with file formats such as PDF, DOC,
+PPTX or similar.
+
+This operation is performed by calling function `promote_file_version`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-id-versions-current/).
+
+
+
+```python
+client.file_versions.promote_file_version(
+ file.id, id=file_versions.entries[0].id, type=PromoteFileVersionType.FILE_VERSION
+)
+```
+
+### 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"
+- id `Optional[str]`
+ - The file version ID.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileVersionFull`.
+
+Returns a newly created file version object.
diff --git a/docs/file_watermarks.md b/docs/file_watermarks.md
new file mode 100644
index 000000000..3ef0f6d54
--- /dev/null
+++ b/docs/file_watermarks.md
@@ -0,0 +1,99 @@
+# FileWatermarksManager
+
+- [Get watermark on file](#get-watermark-on-file)
+- [Apply watermark to file](#apply-watermark-to-file)
+- [Remove watermark from file](#remove-watermark-from-file)
+
+## Get watermark on file
+
+Retrieve the watermark for a file.
+
+This operation is performed by calling function `get_file_watermark`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-watermark/).
+
+
+
+```python
+client.file_watermarks.get_file_watermark(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Watermark`.
+
+Returns an object containing information about the
+watermark associated for to this file.
+
+## Apply watermark to file
+
+Applies or update a watermark on a file.
+
+This operation is performed by calling function `update_file_watermark`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-files-id-watermark/).
+
+
+
+```python
+client.file_watermarks.update_file_watermark(
+ file.id,
+ UpdateFileWatermarkWatermark(
+ imprint=UpdateFileWatermarkWatermarkImprintField.DEFAULT
+ ),
+)
+```
+
+### 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 `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.
+
+### Returns
+
+This function returns a value of type `Watermark`.
+
+Returns an updated watermark if a watermark already
+existed on this file.Returns a new watermark if no watermark existed on
+this file yet.
+
+## Remove watermark from file
+
+Removes the watermark from a file.
+
+This operation is performed by calling function `delete_file_watermark`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-files-id-watermark/).
+
+
+
+```python
+client.file_watermarks.delete_file_watermark(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Removes the watermark and returns an empty response.
diff --git a/docs/files.md b/docs/files.md
new file mode 100644
index 000000000..9ce0de627
--- /dev/null
+++ b/docs/files.md
@@ -0,0 +1,283 @@
+# FilesManager
+
+- [Get file information](#get-file-information)
+- [Update file](#update-file)
+- [Delete file](#delete-file)
+- [Copy file](#copy-file)
+- [Get file thumbnail URL](#get-file-thumbnail-url)
+- [Get file thumbnail](#get-file-thumbnail)
+
+## Get file information
+
+Retrieves the details about a file.
+
+This operation is performed by calling function `get_file_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id/).
+
+
+
+```python
+client.files.get_file_by_id(
+ uploaded_file.id, fields=["is_externally_owned", "has_collaborations"]
+)
+```
+
+### 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"
+- 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. Additionally this field can be used to query any metadata applied to the file by specifying the `metadata` field as well as the scope and key of the template to retrieve, for example `?fields=metadata.enterprise_12345.contractTemplate`.
+- if_none_match `Optional[str]`
+ - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since.
+- boxapi `Optional[str]`
+ - The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format `shared_link=[link]` or if a password is required then use `shared_link=[link]&shared_link_password=[password]`. This header can be used on the file or folder shared, as well as on any files or folders nested within the item.
+- x_rep_hints `Optional[str]`
+ - A header required to request specific `representations` of a file. Use this in combination with the `fields` query parameter to request a specific file representation. The general format for these representations is `X-Rep-Hints: [...]` where `[...]` is one or many hints in the format `[fileType?query]`. For example, to request a `png` representation in `32x32` as well as `64x64` pixel dimensions provide the following hints. `x-rep-hints: [jpg?dimensions=32x32][jpg?dimensions=64x64]` Additionally, a `text` representation is available for all document file types in Box using the `[extracted_text]` representation. `x-rep-hints: [extracted_text]`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileFull`.
+
+Returns a file object.
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
+
+## Update file
+
+Updates a file. This can be used to rename or move a file,
+create a shared link, or lock a file.
+
+This operation is performed by calling function `update_file_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-files-id/).
+
+
+
+```python
+client.files.update_file_by_id(
+ file_to_update.id, name=updated_name, description="Updated description"
+)
+```
+
+### 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"
+- name `Optional[str]`
+ - An optional different name for the file. This can be used to rename the file. File names must be unique within their parent folder. The name check is case-insensitive, so a file named `New File` cannot be created in a parent folder that already contains a folder named `new file`.
+- description `Optional[str]`
+ - The description for a file. This can be seen in the right-hand sidebar panel when viewing a file in the Box web app. Additionally, this index is used in the search index of the file, allowing users to find the file by the content in the description.
+- parent `Optional[UpdateFileByIdParent]`
+- shared_link `Optional[UpdateFileByIdSharedLink]`
+- lock `Optional[UpdateFileByIdLock]`
+ - Defines a lock on an item. This prevents the item from being moved, renamed, or otherwise changed by anyone other than the user who created the lock. Set this to `null` to remove the lock.
+- disposition_at `Optional[DateTime]`
+ - The retention expiration timestamp for the given file. This date cannot be shortened once set on a file.
+- permissions `Optional[UpdateFileByIdPermissions]`
+ - Defines who can download a file.
+- collections `Optional[List[UpdateFileByIdCollections]]`
+ - An array of collections to make this file a member of. Currently we only support the `favorites` collection. To get the ID for a collection, use the [List all collections][1] endpoint. Passing an empty array `[]` or `null` will remove the file from all collections. [1]: e://get-collections
+- tags `Optional[List[str]]`
+ - 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, modify them, and then update this field. There is a limit of 100 tags per item, and 10,000 unique tags per 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.
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileFull`.
+
+Returns a file object.
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
+
+## Delete file
+
+Deletes a file, either permanently or by moving it to
+the trash.
+
+The the enterprise settings determine whether the item will
+be permanently deleted from Box or moved to the trash.
+
+This operation is performed by calling function `delete_file_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-files-id/).
+
+
+
+```python
+client.files.delete_file_by_id(thumbnail_file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the file has been successfully
+deleted.
+
+## Copy file
+
+Creates a copy of a file.
+
+This operation is performed by calling function `copy_file`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-id-copy/).
+
+
+
+```python
+client.files.copy_file(file_origin.id, CopyFileParent(id="0"), name=copied_file_name)
+```
+
+### 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"
+- name `Optional[str]`
+ - 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 (`/`, `\`), and protected names like `.` and `..` are automatically sanitized by removing the non-allowed characters.
+- version `Optional[str]`
+ - An optional ID of the specific file version to copy.
+- parent `CopyFileParent`
+ - The destination folder to copy the file 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileFull`.
+
+Returns a new file object representing the copied file.
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
+
+## Get file thumbnail URL
+
+Get the download URL without downloading the content.
+
+This operation is performed by calling function `get_file_thumbnail_url`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-thumbnail-id/).
+
+
+
+```python
+client.files.get_file_thumbnail_url(thumbnail_file.id, GetFileThumbnailUrlExtension.PNG)
+```
+
+### 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"
+- extension `GetFileThumbnailUrlExtension`
+ - The file format for the thumbnail. Example: "png"
+- min_height `Optional[int]`
+ - The minimum height of the thumbnail.
+- min_width `Optional[int]`
+ - The minimum width of the thumbnail.
+- max_height `Optional[int]`
+ - The maximum height of the thumbnail.
+- max_width `Optional[int]`
+ - The maximum width of the thumbnail.
+- 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 `str`.
+
+When a thumbnail can be created the thumbnail data will be
+returned in the body of the response.Sometimes generating a thumbnail can take a few seconds. In these
+situations the API returns a `Location`-header pointing to a
+placeholder graphic for this file type.
+
+The placeholder graphic can be used in a user interface until the
+thumbnail generation has completed. The `Retry-After`-header indicates
+when to the thumbnail will be ready. At that time, retry this endpoint
+to retrieve the thumbnail.
+
+## Get file thumbnail
+
+Retrieves a thumbnail, or smaller image representation, of a file.
+
+Sizes of `32x32`,`64x64`, `128x128`, and `256x256` can be returned in
+the `.png` format and sizes of `32x32`, `160x160`, and `320x320`
+can be returned in the `.jpg` format.
+
+Thumbnails can be generated for the image and video file formats listed
+[found on our community site][1].
+
+[1]: https://community.box.com/t5/Migrating-and-Previewing-Content/File-Types-and-Fonts-Supported-in-Box-Content-Preview/ta-p/327
+
+This operation is performed by calling function `get_file_thumbnail_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-thumbnail-id/).
+
+
+
+```python
+client.files.get_file_thumbnail_by_id(
+ thumbnail_file.id, GetFileThumbnailByIdExtension.PNG
+)
+```
+
+### 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"
+- extension `GetFileThumbnailByIdExtension`
+ - The file format for the thumbnail. Example: "png"
+- min_height `Optional[int]`
+ - The minimum height of the thumbnail.
+- min_width `Optional[int]`
+ - The minimum width of the thumbnail.
+- max_height `Optional[int]`
+ - The maximum height of the thumbnail.
+- max_width `Optional[int]`
+ - The maximum width of the thumbnail.
+- 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 `Optional[ByteStream]`.
+
+When a thumbnail can be created the thumbnail data will be
+returned in the body of the response.Sometimes generating a thumbnail can take a few seconds. In these
+situations the API returns a `Location`-header pointing to a
+placeholder graphic for this file type.
+
+The placeholder graphic can be used in a user interface until the
+thumbnail generation has completed. The `Retry-After`-header indicates
+when to the thumbnail will be ready. At that time, retry this endpoint
+to retrieve the thumbnail.
diff --git a/docs/folder_classifications.md b/docs/folder_classifications.md
new file mode 100644
index 000000000..a10765c44
--- /dev/null
+++ b/docs/folder_classifications.md
@@ -0,0 +1,150 @@
+# FolderClassificationsManager
+
+- [Get classification on folder](#get-classification-on-folder)
+- [Add classification to folder](#add-classification-to-folder)
+- [Update classification on folder](#update-classification-on-folder)
+- [Remove classification from folder](#remove-classification-from-folder)
+
+## Get classification on folder
+
+Retrieves the classification metadata instance that
+has been applied to a folder.
+
+This API can also be called by including the enterprise ID in the
+URL explicitly, for example
+`/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
+
+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-securityClassification-6VMVochwUWo/).
+
+
+
+```python
+client.folder_classifications.get_classification_on_folder(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Classification`.
+
+Returns an instance of the `securityClassification` metadata
+template, which contains a `Box__Security__Classification__Key`
+field that lists all the classifications available to this
+enterprise.
+
+## Add classification to folder
+
+Adds a classification to a folder by specifying the label of the
+classification to add.
+
+This API can also be called by including the enterprise ID in the
+URL explicitly, for example
+`/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
+
+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-securityClassification-6VMVochwUWo/).
+
+
+
+```python
+client.folder_classifications.add_classification_to_folder(
+ folder.id, box_security_classification_key=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"
+- box_security_classification_key `Optional[str]`
+ - The name of the classification to apply to this folder. To list the available classifications in an enterprise, use the classification API to retrieve the [classification template](e://get_metadata_templates_enterprise_securityClassification-6VMVochwUWo_schema) which lists all available classification keys.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Classification`.
+
+Returns the classification template instance
+that was applied to the folder.
+
+## Update classification on folder
+
+Updates a classification on a folder.
+
+The classification can only be updated if a classification has already been
+applied to the folder before. When editing classifications, only values are
+defined for the enterprise will be accepted.
+
+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-securityClassification-6VMVochwUWo/).
+
+
+
+```python
+client.folder_classifications.update_classification_on_folder(
+ folder.id,
+ [UpdateClassificationOnFolderRequestBody(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[UpdateClassificationOnFolderRequestBody]`
+ - Request body of updateClassificationOnFolder method
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Classification`.
+
+Returns the updated classification metadata template instance.
+
+## Remove classification from folder
+
+Removes any classifications from a folder.
+
+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_classification_from_folder`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-folders-id-metadata-enterprise-securityClassification-6VMVochwUWo/).
+
+
+
+```python
+client.folder_classifications.delete_classification_from_folder(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the classification is
+successfully deleted.
diff --git a/docs/folder_locks.md b/docs/folder_locks.md
new file mode 100644
index 000000000..85fa46614
--- /dev/null
+++ b/docs/folder_locks.md
@@ -0,0 +1,106 @@
+# FolderLocksManager
+
+- [List folder locks](#list-folder-locks)
+- [Create folder lock](#create-folder-lock)
+- [Delete folder lock](#delete-folder-lock)
+
+## List folder locks
+
+Retrieves folder lock details for a given folder.
+
+You must be authenticated as the owner or co-owner of the folder to
+use this endpoint.
+
+This operation is performed by calling function `get_folder_locks`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-folder-locks/).
+
+
+
+```python
+client.folder_locks.get_folder_locks(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderLocks`.
+
+Returns details for all folder locks applied to the folder, including the
+lock type and user that applied the lock.
+
+## Create folder lock
+
+Creates a folder lock on a folder, preventing it from being moved and/or
+deleted.
+
+You must be authenticated as the owner or co-owner of the folder to
+use this endpoint.
+
+This operation is performed by calling function `create_folder_lock`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-folder-locks/).
+
+
+
+```python
+client.folder_locks.create_folder_lock(
+ CreateFolderLockFolder(id=folder.id, type="folder"),
+ locked_operations=CreateFolderLockLockedOperations(move=True, delete=True),
+)
+```
+
+### Arguments
+
+- 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 `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.
+
+### Returns
+
+This function returns a value of type `FolderLock`.
+
+Returns the instance of the folder lock that was applied to the folder,
+including the user that applied the lock and the operations set.
+
+## Delete folder lock
+
+Deletes a folder lock on a given folder.
+
+You must be authenticated as the owner or co-owner of the folder to
+use this endpoint.
+
+This operation is performed by calling function `delete_folder_lock_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-folder-locks-id/).
+
+
+
+```python
+client.folder_locks.delete_folder_lock_by_id(folder_lock.id)
+```
+
+### Arguments
+
+- folder_lock_id `str`
+ - The ID of the folder lock. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the folder lock is successfully deleted.
diff --git a/docs/folder_metadata.md b/docs/folder_metadata.md
new file mode 100644
index 000000000..0f6b729cb
--- /dev/null
+++ b/docs/folder_metadata.md
@@ -0,0 +1,236 @@
+# FolderMetadataManager
+
+- [List metadata instances on folder](#list-metadata-instances-on-folder)
+- [Get metadata instance on folder](#get-metadata-instance-on-folder)
+- [Create metadata instance on folder](#create-metadata-instance-on-folder)
+- [Update metadata instance on folder](#update-metadata-instance-on-folder)
+- [Remove metadata instance from folder](#remove-metadata-instance-from-folder)
+
+## List metadata instances on folder
+
+Retrieves all metadata for a given folder. This can not be used on the root
+folder with ID `0`.
+
+This operation is performed by calling function `get_folder_metadata`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-folders-id-metadata/).
+
+
+
+```python
+client.folder_metadata.get_folder_metadata(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Metadatas`.
+
+Returns all the metadata associated with a folder.
+
+This API does not support pagination and will therefore always return
+all of the metadata associated to the folder.
+
+## Get metadata instance on folder
+
+Retrieves the instance of a metadata template that has been applied to a
+folder. This can not be used on the root folder with ID `0`.
+
+This operation is performed by calling function `get_folder_metadata_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-folders-id-metadata-id-id/).
+
+
+
+```python
+client.folder_metadata.get_folder_metadata_by_id(
+ folder.id, GetFolderMetadataByIdScope.GLOBAL, "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 `GetFolderMetadataByIdScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataFull`.
+
+An instance of the metadata template that includes
+additional "key:value" pairs defined by the user or
+an application.
+
+## Create metadata instance on folder
+
+Applies an instance of a metadata template to a folder.
+
+In most cases only values that are present in the metadata template
+will be accepted, except for the `global.properties` template which accepts
+any key-value pair.
+
+To display the metadata template in the Box web app the enterprise needs to be
+configured to enable **Cascading Folder Level Metadata** for the user in the
+admin console.
+
+This operation is performed by calling function `create_folder_metadata_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-folders-id-metadata-id-id/).
+
+
+
+```python
+client.folder_metadata.create_folder_metadata_by_id(
+ folder.id,
+ CreateFolderMetadataByIdScope.ENTERPRISE,
+ template_key,
+ {
+ "name": "John",
+ "age": 23,
+ "birthDate": "2001-01-03T02:20:50.520Z",
+ "countryCode": "US",
+ "sports": ["basketball", "tennis"],
+ },
+)
+```
+
+### 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 `CreateFolderMetadataByIdScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- request_body `Dict`
+ - Request body of createFolderMetadataById method
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataFull`.
+
+Returns the instance of the template that was applied to the folder,
+including the data that was applied to the template.
+
+## Update metadata instance on folder
+
+Updates a piece of metadata on a folder.
+
+The metadata instance can only be updated if the template has already been
+applied to the folder before. When editing metadata, only values that match
+the metadata template schema will be accepted.
+
+The update is applied atomically. If any errors occur during the
+application of the operations, the metadata instance will not be changed.
+
+This operation is performed by calling function `update_folder_metadata_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-folders-id-metadata-id-id/).
+
+
+
+```python
+client.folder_metadata.update_folder_metadata_by_id(
+ folder.id,
+ UpdateFolderMetadataByIdScope.ENTERPRISE,
+ template_key,
+ [
+ UpdateFolderMetadataByIdRequestBody(
+ op=UpdateFolderMetadataByIdRequestBodyOpField.REPLACE,
+ path="/name",
+ value="Jack",
+ ),
+ UpdateFolderMetadataByIdRequestBody(
+ op=UpdateFolderMetadataByIdRequestBodyOpField.REPLACE, path="/age", value=24
+ ),
+ UpdateFolderMetadataByIdRequestBody(
+ op=UpdateFolderMetadataByIdRequestBodyOpField.REPLACE,
+ path="/birthDate",
+ value="2000-01-03T02:20:50.520Z",
+ ),
+ UpdateFolderMetadataByIdRequestBody(
+ op=UpdateFolderMetadataByIdRequestBodyOpField.REPLACE,
+ path="/countryCode",
+ value="CA",
+ ),
+ UpdateFolderMetadataByIdRequestBody(
+ op=UpdateFolderMetadataByIdRequestBodyOpField.REPLACE,
+ path="/sports",
+ value=["football"],
+ ),
+ ],
+)
+```
+
+### 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 `UpdateFolderMetadataByIdScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- 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.
+
+### Returns
+
+This function returns a value of type `MetadataFull`.
+
+Returns the updated metadata template instance, with the
+custom template data included.
+
+## Remove metadata instance from folder
+
+Deletes a piece of folder metadata.
+
+This operation is performed by calling function `delete_folder_metadata_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-folders-id-metadata-id-id/).
+
+
+
+```python
+client.folder_metadata.delete_folder_metadata_by_id(
+ folder.id, DeleteFolderMetadataByIdScope.ENTERPRISE, template_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"
+- scope `DeleteFolderMetadataByIdScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the metadata is
+successfully deleted.
diff --git a/docs/folder_watermarks.md b/docs/folder_watermarks.md
new file mode 100644
index 000000000..dc23285e4
--- /dev/null
+++ b/docs/folder_watermarks.md
@@ -0,0 +1,100 @@
+# FolderWatermarksManager
+
+- [Get watermark for folder](#get-watermark-for-folder)
+- [Apply watermark to folder](#apply-watermark-to-folder)
+- [Remove watermark from folder](#remove-watermark-from-folder)
+
+## Get watermark for folder
+
+Retrieve the watermark for a folder.
+
+This operation is performed by calling function `get_folder_watermark`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-folders-id-watermark/).
+
+
+
+```python
+client.folder_watermarks.get_folder_watermark(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Watermark`.
+
+Returns an object containing information about the
+watermark associated for to this folder.
+
+## Apply watermark to folder
+
+Applies or update a watermark on a folder.
+
+This operation is performed by calling function `update_folder_watermark`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-folders-id-watermark/).
+
+
+
+```python
+client.folder_watermarks.update_folder_watermark(
+ folder.id,
+ UpdateFolderWatermarkWatermark(
+ imprint=UpdateFolderWatermarkWatermarkImprintField.DEFAULT
+ ),
+)
+```
+
+### 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 `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.
+
+### Returns
+
+This function returns a value of type `Watermark`.
+
+Returns an updated watermark if a watermark already
+existed on this folder.Returns a new watermark if no watermark existed on
+this folder yet.
+
+## Remove watermark from folder
+
+Removes the watermark from a folder.
+
+This operation is performed by calling function `delete_folder_watermark`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-folders-id-watermark/).
+
+
+
+```python
+client.folder_watermarks.delete_folder_watermark(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+An empty response will be returned when the watermark
+was successfully deleted.
diff --git a/docs/folders.md b/docs/folders.md
new file mode 100644
index 000000000..fa2d33321
--- /dev/null
+++ b/docs/folders.md
@@ -0,0 +1,295 @@
+# FoldersManager
+
+- [Get folder information](#get-folder-information)
+- [Update folder](#update-folder)
+- [Delete folder](#delete-folder)
+- [List items in folder](#list-items-in-folder)
+- [Create folder](#create-folder)
+- [Copy folder](#copy-folder)
+
+## Get folder information
+
+Retrieves details for a folder, including the first 100 entries
+in the folder.
+
+Passing `sort`, `direction`, `offset`, and `limit`
+parameters in query allows you to manage the
+list of returned
+[folder items](r://folder--full#param-item-collection).
+
+To fetch more items within the folder, use the
+[Get items in a folder](e://get-folders-id-items) endpoint.
+
+This operation is performed by calling function `get_folder_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-folders-id/).
+
+
+
+```python
+client.folders.get_folder_by_id("0")
+```
+
+### 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"
+- 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. Additionally this field can be used to query any metadata applied to the file by specifying the `metadata` field as well as the scope and key of the template to retrieve, for example `?fields=metadata.enterprise_12345.contractTemplate`.
+- sort `Optional[GetFolderByIdSort]`
+ - Defines the **second** attribute by which items are sorted. The folder type affects the way the items are sorted: _ **Standard folder**: Items are always sorted by their `type` first, with folders listed before files, and files listed before web links. _ **Root folder**: This parameter is not supported for marker-based pagination on the root folder (the folder with an `id` of `0`). \* **Shared folder with parent path to the associated folder visible to the collaborator**: Items are always sorted by their `type` first, with folders listed before files, and files listed before web links.
+- direction `Optional[GetFolderByIdDirection]`
+ - The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- if_none_match `Optional[str]`
+ - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since.
+- boxapi `Optional[str]`
+ - The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format `shared_link=[link]` or if a password is required then use `shared_link=[link]&shared_link_password=[password]`. This header can be used on the file or folder shared, as well as on any files or folders nested within the item.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns a folder, including the first 100 entries in the folder.
+If you used query parameters like
+`sort`, `direction`, `offset`, or `limit`
+the _folder items list_ will be affected accordingly.
+
+To fetch more items within the folder, use the
+[Get items in a folder](e://get-folders-id-items)) endpoint.
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
+
+## Update folder
+
+Updates a folder. This can be also be used to move the folder,
+create shared links, update collaborations, and more.
+
+This operation is performed by calling function `update_folder_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-folders-id/).
+
+
+
+```python
+client.folders.update_folder_by_id(
+ folder_to_update.id, name=updated_name, description="Updated description"
+)
+```
+
+### 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"
+- name `Optional[str]`
+ - The optional new name for this folder. The following restrictions to folder names apply: names containing non-printable ASCII characters, forward and backward slashes (`/`, `\`), names with trailing spaces, and names `.` and `..` are not allowed. Folder names must be unique within their parent folder. The name check is case-insensitive, so a folder named `New Folder` cannot be created in a parent folder that already contains a folder named `new folder`.
+- description `Optional[str]`
+ - The optional description of this folder.
+- sync_state `Optional[UpdateFolderByIdSyncState]`
+ - 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.
+- can_non_owners_invite `Optional[bool]`
+ - Specifies if users who are not the owner of the folder can invite new collaborators to the folder.
+- parent `Optional[UpdateFolderByIdParent]`
+- shared_link `Optional[UpdateFolderByIdSharedLink]`
+- folder_upload_email `Optional[UpdateFolderByIdFolderUploadEmail]`
+- tags `Optional[List[str]]`
+ - 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, modify them, and then update this field. There is a limit of 100 tags per item, and 10,000 unique tags per enterprise.
+- is_collaboration_restricted_to_enterprise `Optional[bool]`
+ - Specifies if new invites to this folder are restricted to users within the enterprise. This does not affect existing collaborations.
+- collections `Optional[List[UpdateFolderByIdCollections]]`
+ - An array of collections to make this folder a member of. Currently we only support the `favorites` collection. To get the ID for a collection, use the [List all collections][1] endpoint. Passing an empty array `[]` or `null` will remove the folder from all collections. [1]: e://get-collections
+- can_non_owners_view_collaborators `Optional[bool]`
+ - Restricts collaborators who are not the owner of this folder from viewing other collaborations on this folder. It also restricts non-owners from inviting new collaborators. When setting this field to `false`, it is required to also set `can_non_owners_invite_collaborators` to `false` if it has not already been set.
+- 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.
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns a folder object for the updated folder
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
+
+If the user is moving folders with a large number of items in all of
+their descendants, the call will be run asynchronously. If the
+operation is not completed within 10 minutes, the user will receive
+a 200 OK response, and the operation will continue running.
+
+## Delete folder
+
+Deletes a folder, either permanently or by moving it to
+the trash.
+
+This operation is performed by calling function `delete_folder_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-folders-id/).
+
+
+
+```python
+client.folders.delete_folder_by_id(new_folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- recursive `Optional[bool]`
+ - Delete a folder that is not empty by recursively deleting the folder and all of its content.
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the folder is successfully deleted
+or moved to the trash.
+
+## List items in folder
+
+Retrieves a page of items in a folder. These items can be files,
+folders, and web links.
+
+To request more information about the folder itself, like its size,
+use the [Get a folder](#get-folders-id) endpoint instead.
+
+This operation is performed by calling function `get_folder_items`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-folders-id-items/).
+
+
+
+```python
+client.folders.get_folder_items(folder_origin.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- 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. Additionally this field can be used to query any metadata applied to the file by specifying the `metadata` field as well as the scope and key of the template to retrieve, for example `?fields=metadata.enterprise_12345.contractTemplate`.
+- usemarker `Optional[bool]`
+ - Specifies whether to use marker-based pagination instead of offset-based pagination. Only one pagination method can be used at a time. By setting this value to true, the API will return a `marker` field that can be passed as a parameter to this endpoint to get the next page of the response.
+- 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`.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- sort `Optional[GetFolderItemsSort]`
+ - Defines the **second** attribute by which items are sorted. The folder type affects the way the items are sorted: _ **Standard folder**: Items are always sorted by their `type` first, with folders listed before files, and files listed before web links. _ **Root folder**: This parameter is not supported for marker-based pagination on the root folder (the folder with an `id` of `0`). \* **Shared folder with parent path to the associated folder visible to the collaborator**: Items are always sorted by their `type` first, with folders listed before files, and files listed before web links.
+- direction `Optional[GetFolderItemsDirection]`
+ - The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order.
+- boxapi `Optional[str]`
+ - The URL, and optional password, for the shared link of this item. This header can be used to access items that have not been explicitly shared with a user. Use the format `shared_link=[link]` or if a password is required then use `shared_link=[link]&shared_link_password=[password]`. This header can be used on the file or folder shared, as well as on any files or folders nested within the item.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Items`.
+
+Returns a collection of files, folders, and web links contained in a folder.
+
+## Create folder
+
+Creates a new empty folder within the specified parent folder.
+
+This operation is performed by calling function `create_folder`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-folders/).
+
+
+
+```python
+client.folders.create_folder(new_folder_name, CreateFolderParent(id="0"))
+```
+
+### Arguments
+
+- name `str`
+ - The name for the new folder. The following restrictions to folder names apply: names containing non-printable ASCII characters, forward and backward slashes (`/`, `\`), names with trailing spaces, and names `.` and `..` are not allowed. Folder names must be unique within their parent folder. The name check is case-insensitive, so a folder named `New Folder` cannot be created in a parent folder that already contains a folder named `new folder`.
+- parent `CreateFolderParent`
+ - The parent folder to create the new folder within.
+- folder_upload_email `Optional[CreateFolderFolderUploadEmail]`
+- sync_state `Optional[CreateFolderSyncState]`
+ - 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.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns a folder object.
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
+
+## Copy folder
+
+Creates a copy of a folder within a destination folder.
+
+The original folder will not be changed.
+
+This operation is performed by calling function `copy_folder`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-folders-id-copy/).
+
+
+
+```python
+client.folders.copy_folder(
+ folder_origin.id, CopyFolderParent(id="0"), name=copied_folder_name
+)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier of the folder to copy. 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 with the ID `0` can not be copied. Example: "0"
+- name `Optional[str]`
+ - 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 (`/`, `\`), as well as names with trailing spaces are prohibited. Additionally, the names `.` and `..` are not allowed either.
+- parent `CopyFolderParent`
+ - The destination folder to copy the folder 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns a new folder object representing the copied folder.
+
+Not all available fields are returned by default. Use the
+[fields](#param-fields) query parameter to explicitly request
+any specific fields.
diff --git a/docs/groups.md b/docs/groups.md
new file mode 100644
index 000000000..6f1143c33
--- /dev/null
+++ b/docs/groups.md
@@ -0,0 +1,192 @@
+# GroupsManager
+
+- [List groups for enterprise](#list-groups-for-enterprise)
+- [Create group](#create-group)
+- [Get group](#get-group)
+- [Update group](#update-group)
+- [Remove group](#remove-group)
+
+## List groups for enterprise
+
+Retrieves all of the groups for a given enterprise. The user
+must have admin permissions to inspect enterprise's groups.
+
+This operation is performed by calling function `get_groups`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-groups/).
+
+
+
+```python
+client.groups.get_groups()
+```
+
+### Arguments
+
+- filter_term `Optional[str]`
+ - Limits the results to only groups whose `name` starts with the search term.
+- 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.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Groups`.
+
+Returns a collection of group objects. If there are no groups, an
+empty collection will be returned.
+
+## Create group
+
+Creates a new group of users in an enterprise. Only users with admin
+permissions can create new groups.
+
+This operation is performed by calling function `create_group`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-groups/).
+
+
+
+```python
+client.groups.create_group(group_name, description=group_description)
+```
+
+### Arguments
+
+- name `str`
+ - The name of the new group to be created. This name must be unique within the enterprise.
+- provenance `Optional[str]`
+ - Keeps track of which external source this group is coming, for example `Active Directory`, or `Okta`. Setting this will also prevent Box admins from editing the group name and its members directly via the Box web application. This is desirable for one-way syncing of groups.
+- external_sync_identifier `Optional[str]`
+ - An arbitrary identifier that can be used by external group sync tools to link this Box Group to an external group. Example values of this field could be an **Active Directory Object ID** or a **Google Group ID**. We recommend you use of this field in order to avoid issues when group names are updated in either Box or external systems.
+- description `Optional[str]`
+ - A human readable description of the group.
+- 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[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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `GroupFull`.
+
+Returns the new group object.
+
+## Get group
+
+Retrieves information about a group. Only members of this
+group or users with admin-level permissions will be able to
+use this API.
+
+This operation is performed by calling function `get_group_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-groups-id/).
+
+
+
+```python
+client.groups.get_group_by_id(
+ group.id, fields=["id", "name", "description", "group_type"]
+)
+```
+
+### Arguments
+
+- group_id `str`
+ - The ID of the group. Example: "57645"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `GroupFull`.
+
+Returns the group object.
+
+## Update group
+
+Updates a specific group. Only admins of this
+group or users with admin-level permissions will be able to
+use this API.
+
+This operation is performed by calling function `update_group_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-groups-id/).
+
+
+
+```python
+client.groups.update_group_by_id(group.id, name=updated_group_name)
+```
+
+### Arguments
+
+- group_id `str`
+ - The ID of the group. Example: "57645"
+- name `Optional[str]`
+ - The name of the new group to be created. Must be unique within the enterprise.
+- provenance `Optional[str]`
+ - Keeps track of which external source this group is coming, for example `Active Directory`, or `Okta`. Setting this will also prevent Box admins from editing the group name and its members directly via the Box web application. This is desirable for one-way syncing of groups.
+- external_sync_identifier `Optional[str]`
+ - An arbitrary identifier that can be used by external group sync tools to link this Box Group to an external group. Example values of this field could be an **Active Directory Object ID** or a **Google Group ID**. We recommend you use of this field in order to avoid issues when group names are updated in either Box or external systems.
+- description `Optional[str]`
+ - A human readable description of the group.
+- 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[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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `GroupFull`.
+
+Returns the updated group object.
+
+## Remove group
+
+Permanently deletes a group. Only users with
+admin-level permissions will be able to use this API.
+
+This operation is performed by calling function `delete_group_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-groups-id/).
+
+
+
+```python
+client.groups.delete_group_by_id(group.id)
+```
+
+### Arguments
+
+- group_id `str`
+ - The ID of the group. Example: "57645"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the group was
+successfully deleted.
diff --git a/docs/hub_collaborations.md b/docs/hub_collaborations.md
new file mode 100644
index 000000000..5859f6a7e
--- /dev/null
+++ b/docs/hub_collaborations.md
@@ -0,0 +1,179 @@
+# HubCollaborationsManager
+
+- [Get hub collaborations](#get-hub-collaborations)
+- [Create hub collaboration](#create-hub-collaboration)
+- [Get hub collaboration by collaboration ID](#get-hub-collaboration-by-collaboration-id)
+- [Update hub collaboration](#update-hub-collaboration)
+- [Remove hub collaboration](#remove-hub-collaboration)
+
+## Get hub collaborations
+
+Retrieves all collaborations for a hub.
+
+This operation is performed by calling function `get_hub_collaborations_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-hub-collaborations/).
+
+
+
+```python
+client.hub_collaborations.get_hub_collaborations_v2025_r0(hub.id)
+```
+
+### Arguments
+
+- hub_id `str`
+ - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`.
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubCollaborationsV2025R0`.
+
+Retrieves the collaborations associated with the specified hub.
+
+## Create hub collaboration
+
+Adds a collaboration for a single user or a single group to a hub.
+
+Collaborations can be created using email address, user IDs, or group IDs.
+
+This operation is performed by calling function `create_hub_collaboration_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/post-hub-collaborations/).
+
+
+
+```python
+client.hub_collaborations.create_hub_collaboration_v2025_r0(
+ CreateHubCollaborationV2025R0Hub(id=hub.id),
+ CreateHubCollaborationV2025R0AccessibleBy(type="user", id=user.id),
+ "viewer",
+)
+```
+
+### Arguments
+
+- hub `CreateHubCollaborationV2025R0Hub`
+ - Hubs reference.
+- accessible_by `CreateHubCollaborationV2025R0AccessibleBy`
+ - The user or group who gets access to the item.
+- role `str`
+ - The level of access granted to hub. Possible values are `editor`, `viewer`, and `co-owner`.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubCollaborationV2025R0`.
+
+Returns a new hub collaboration object.
+
+## Get hub collaboration by collaboration ID
+
+Retrieves details for a hub collaboration by collaboration ID.
+
+This operation is performed by calling function `get_hub_collaboration_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-hub-collaborations-id/).
+
+
+
+```python
+client.hub_collaborations.get_hub_collaboration_by_id_v2025_r0(created_collaboration.id)
+```
+
+### Arguments
+
+- hub_collaboration_id `str`
+ - The ID of the hub collaboration. Example: "1234"
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubCollaborationV2025R0`.
+
+Returns a hub collaboration object.
+
+## Update hub collaboration
+
+Updates a hub collaboration.
+Can be used to change the hub role.
+
+This operation is performed by calling function `update_hub_collaboration_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/put-hub-collaborations-id/).
+
+
+
+```python
+client.hub_collaborations.update_hub_collaboration_by_id_v2025_r0(
+ created_collaboration.id, role="editor"
+)
+```
+
+### Arguments
+
+- hub_collaboration_id `str`
+ - The ID of the hub collaboration. Example: "1234"
+- role `Optional[str]`
+ - The level of access granted to hub. Possible values are `editor`, `viewer`, and `co-owner`.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubCollaborationV2025R0`.
+
+Returns an updated hub collaboration object.
+
+## Remove hub collaboration
+
+Deletes a single hub collaboration.
+
+This operation is performed by calling function `delete_hub_collaboration_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/delete-hub-collaborations-id/).
+
+
+
+```python
+client.hub_collaborations.delete_hub_collaboration_by_id_v2025_r0(
+ created_collaboration.id
+)
+```
+
+### Arguments
+
+- hub_collaboration_id `str`
+ - The ID of the hub collaboration. Example: "1234"
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the hub collaboration was
+successfully deleted.
diff --git a/docs/hub_items.md b/docs/hub_items.md
new file mode 100644
index 000000000..cca06abca
--- /dev/null
+++ b/docs/hub_items.md
@@ -0,0 +1,76 @@
+# HubItemsManager
+
+- [Get hub items](#get-hub-items)
+- [Manage hub items](#manage-hub-items)
+
+## Get hub items
+
+Retrieves all items associated with a Hub.
+
+This operation is performed by calling function `get_hub_items_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-hub-items/).
+
+
+
+```python
+client.hub_items.get_hub_items_v2025_r0(created_hub.id)
+```
+
+### Arguments
+
+- hub_id `str`
+ - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`.
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubItemsV2025R0`.
+
+Retrieves the items associated with the specified Hub.
+
+## Manage hub items
+
+Adds and/or removes Hub items from a Hub.
+
+This operation is performed by calling function `manage_hub_items_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/post-hubs-id-manage-items/).
+
+
+
+```python
+client.hub_items.manage_hub_items_v2025_r0(
+ created_hub.id,
+ operations=[
+ HubItemOperationV2025R0(
+ action=HubItemOperationV2025R0ActionField.ADD,
+ item=FolderReferenceV2025R0(id=folder.id),
+ )
+ ],
+)
+```
+
+### Arguments
+
+- hub_id `str`
+ - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`. Example: "12345"
+- operations `Optional[List[HubItemOperationV2025R0]]`
+ - List of operations to perform on Hub items.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubItemsManageResponseV2025R0`.
diff --git a/docs/hubs.md b/docs/hubs.md
new file mode 100644
index 000000000..c31652d30
--- /dev/null
+++ b/docs/hubs.md
@@ -0,0 +1,269 @@
+# HubsManager
+
+- [List all hubs](#list-all-hubs)
+- [Create hub](#create-hub)
+- [List all hubs for requesting enterprise](#list-all-hubs-for-requesting-enterprise)
+- [Get hub information by ID](#get-hub-information-by-id)
+- [Update hub information by ID](#update-hub-information-by-id)
+- [Delete hub](#delete-hub)
+- [Copy hub](#copy-hub)
+
+## List all hubs
+
+Retrieves all hubs for requesting user.
+
+This operation is performed by calling function `get_hubs_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-hubs/).
+
+
+
+```python
+client.hubs.get_hubs_v2025_r0(
+ scope="all", sort="name", direction=GetHubsV2025R0Direction.ASC
+)
+```
+
+### Arguments
+
+- query `Optional[str]`
+ - The query string to search for hubs.
+- scope `Optional[str]`
+ - The scope of the hubs to retrieve. Possible values include `editable`, `view_only`, and `all`. Default is `all`.
+- sort `Optional[str]`
+ - The field to sort results by. Possible values include `name`, `updated_at`, `last_accessed_at`, `view_count`, and `relevance`. Default is `relevance`.
+- direction `Optional[GetHubsV2025R0Direction]`
+ - The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubsV2025R0`.
+
+Returns all hubs for the given user or enterprise.
+
+## Create hub
+
+Creates a new Hub.
+
+This operation is performed by calling function `create_hub_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/post-hubs/).
+
+
+
+```python
+client.hubs.create_hub_v2025_r0(hub_title, description=hub_description)
+```
+
+### Arguments
+
+- title `str`
+ - Title of the Hub. It cannot be empty and should be less than 50 characters.
+- description `Optional[str]`
+ - Description of the Hub.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubV2025R0`.
+
+Returns a new Hub object.
+
+## List all hubs for requesting enterprise
+
+Retrieves all hubs for a given enterprise.
+
+Admins or Hub Co-admins of an enterprise
+with GCM scope can make this call.
+
+This operation is performed by calling function `get_enterprise_hubs_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-enterprise-hubs/).
+
+
+
+```python
+client.hubs.get_enterprise_hubs_v2025_r0(
+ sort="name", direction=GetEnterpriseHubsV2025R0Direction.ASC
+)
+```
+
+### Arguments
+
+- query `Optional[str]`
+ - The query string to search for hubs.
+- sort `Optional[str]`
+ - The field to sort results by. Possible values include `name`, `updated_at`, `last_accessed_at`, `view_count`, and `relevance`. Default is `relevance`.
+- direction `Optional[GetEnterpriseHubsV2025R0Direction]`
+ - The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubsV2025R0`.
+
+Returns all hubs for the given user or enterprise.
+
+## Get hub information by ID
+
+Retrieves details for a hub by its ID.
+
+This operation is performed by calling function `get_hub_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-hubs-id/).
+
+
+
+```python
+client.hubs.get_hub_by_id_v2025_r0(hub_id)
+```
+
+### Arguments
+
+- hub_id `str`
+ - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`. Example: "12345"
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubV2025R0`.
+
+Returns a hub object.
+
+## Update hub information by ID
+
+Updates a Hub. Can be used to change title, description, or Hub settings.
+
+This operation is performed by calling function `update_hub_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/put-hubs-id/).
+
+
+
+```python
+client.hubs.update_hub_by_id_v2025_r0(
+ hub_id, title=new_hub_title, description=new_hub_description
+)
+```
+
+### Arguments
+
+- hub_id `str`
+ - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`. Example: "12345"
+- title `Optional[str]`
+ - Title of the Hub. It cannot be empty and should be less than 50 characters.
+- description `Optional[str]`
+ - Description of the Hub.
+- is_ai_enabled `Optional[bool]`
+ - Indicates if AI features are enabled for the Hub.
+- is_collaboration_restricted_to_enterprise `Optional[bool]`
+ - Indicates if collaboration is restricted to the enterprise.
+- can_non_owners_invite `Optional[bool]`
+ - Indicates if non-owners can invite others to the Hub.
+- can_shared_link_be_created `Optional[bool]`
+ - Indicates if a shared link can be created for the Hub.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubV2025R0`.
+
+Returns a Hub object.
+
+## Delete hub
+
+Deletes a single hub.
+
+This operation is performed by calling function `delete_hub_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/delete-hubs-id/).
+
+
+
+```python
+client.hubs.delete_hub_by_id_v2025_r0(hub_id)
+```
+
+### Arguments
+
+- hub_id `str`
+ - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`. Example: "12345"
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the hub was
+successfully deleted.
+
+## Copy hub
+
+Creates a copy of a Hub.
+
+The original Hub will not be modified.
+
+This operation is performed by calling function `copy_hub_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/post-hubs-id-copy/).
+
+
+
+```python
+client.hubs.copy_hub_v2025_r0(
+ created_hub.id, title=copied_hub_title, description=copied_hub_description
+)
+```
+
+### Arguments
+
+- hub_id `str`
+ - The unique identifier that represent a hub. The ID for any hub can be determined by visiting this hub in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is `123`. Example: "12345"
+- title `Optional[str]`
+ - Title of the Hub. It cannot be empty and should be less than 50 characters.
+- description `Optional[str]`
+ - Description of the Hub.
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `HubV2025R0`.
+
+Returns a new Hub object.
diff --git a/docs/integration_mappings.md b/docs/integration_mappings.md
new file mode 100644
index 000000000..1b48ead7e
--- /dev/null
+++ b/docs/integration_mappings.md
@@ -0,0 +1,301 @@
+# IntegrationMappingsManager
+
+- [List Slack integration mappings](#list-slack-integration-mappings)
+- [Create Slack integration mapping](#create-slack-integration-mapping)
+- [Update Slack integration mapping](#update-slack-integration-mapping)
+- [Delete Slack integration mapping](#delete-slack-integration-mapping)
+- [List Teams integration mappings](#list-teams-integration-mappings)
+- [Create Teams integration mapping](#create-teams-integration-mapping)
+- [Update Teams integration mapping](#update-teams-integration-mapping)
+- [Delete Teams integration mapping](#delete-teams-integration-mapping)
+
+## List Slack integration mappings
+
+Lists [Slack integration mappings](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack) in a users' enterprise.
+
+You need Admin or Co-Admin role to
+use this endpoint.
+
+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/).
+
+
+
+```python
+user_client.integration_mappings.get_slack_integration_mapping()
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- 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[GetSlackIntegrationMappingBoxItemType]`
+ - Box item type, for which the mappings should be returned.
+- is_manually_created `Optional[bool]`
+ - Whether the mapping has been manually created.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `IntegrationMappings`.
+
+Returns a collection of integration mappings.
+
+## Create Slack integration mapping
+
+Creates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack)
+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_slack_integration_mapping`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-integration-mappings-slack/).
+
+
+
+```python
+user_client.integration_mappings.create_slack_integration_mapping(
+ IntegrationMappingPartnerItemSlack(
+ id=slack_partner_item_id, slack_org_id=slack_org_id
+ ),
+ IntegrationMappingBoxItemSlack(id=folder.id),
+)
+```
+
+### Arguments
+
+- partner_item `IntegrationMappingPartnerItemSlack`
+- box_item `IntegrationMappingBoxItemSlack`
+- options `Optional[IntegrationMappingSlackOptions]`
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `IntegrationMapping`.
+
+Returns the created integration mapping.
+
+## Update Slack integration mapping
+
+Updates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack).
+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_slack_integration_mapping_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-integration-mappings-slack-id/).
+
+
+
+```python
+user_client.integration_mappings.update_slack_integration_mapping_by_id(
+ slack_integration_mapping.id, box_item=IntegrationMappingBoxItemSlack(id=folder.id)
+)
+```
+
+### Arguments
+
+- integration_mapping_id `str`
+ - An ID of an integration mapping. Example: "11235432"
+- box_item `Optional[IntegrationMappingBoxItemSlack]`
+- options `Optional[IntegrationMappingSlackOptions]`
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `IntegrationMapping`.
+
+Returns the updated integration mapping object.
+
+## Delete Slack integration mapping
+
+Deletes a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack).
+
+You need Admin or Co-Admin role to
+use this endpoint.
+
+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/).
+
+
+
+```python
+user_client.integration_mappings.delete_slack_integration_mapping_by_id(
+ slack_integration_mapping.id
+)
+```
+
+### Arguments
+
+- integration_mapping_id `str`
+ - An ID of an integration mapping. Example: "11235432"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Empty body in response.
+
+## List Teams integration mappings
+
+Lists [Teams integration mappings](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams) in a users' enterprise.
+You need Admin or Co-Admin role to
+use this endpoint.
+
+This operation is performed by calling function `get_teams_integration_mapping`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-integration-mappings-teams/).
+
+
+
+```python
+user_client.integration_mappings.get_teams_integration_mapping()
+```
+
+### Arguments
+
+- partner_item_type `Optional[GetTeamsIntegrationMappingPartnerItemType]`
+ - 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[GetTeamsIntegrationMappingBoxItemType]`
+ - Box item type, for which the mappings should be returned.
+- 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 `IntegrationMappingsTeams`.
+
+Returns a collection of integration mappings.
+
+## Create Teams integration mapping
+
+Creates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams)
+by mapping a Teams channel to a Box item.
+You need Admin or Co-Admin role to
+use this endpoint.
+
+This operation is performed by calling function `create_teams_integration_mapping`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-integration-mappings-teams/).
+
+
+
+```python
+user_client.integration_mappings.create_teams_integration_mapping(
+ IntegrationMappingPartnerItemTeamsCreateRequest(
+ type=IntegrationMappingPartnerItemTeamsCreateRequestTypeField.CHANNEL,
+ id=partner_item_id,
+ tenant_id=tenant_id,
+ team_id=team_id,
+ ),
+ FolderReference(id=folder.id),
+)
+```
+
+### Arguments
+
+- partner_item `IntegrationMappingPartnerItemTeamsCreateRequest`
+- box_item `FolderReference`
+- 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 `IntegrationMappingTeams`.
+
+Returns the created integration mapping.
+
+## Update Teams integration mapping
+
+Updates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams).
+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_teams_integration_mapping_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-integration-mappings-teams-id/).
+
+
+
+```python
+user_client.integration_mappings.update_teams_integration_mapping_by_id(
+ integration_mapping_id, box_item=FolderReference(id="1234567")
+)
+```
+
+### Arguments
+
+- integration_mapping_id `str`
+ - An ID of an integration mapping. Example: "11235432"
+- box_item `Optional[FolderReference]`
+- 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 `IntegrationMappingTeams`.
+
+Returns the updated integration mapping object.
+
+## Delete Teams integration mapping
+
+Deletes a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams).
+You need Admin or Co-Admin role to
+use this endpoint.
+
+This operation is performed by calling function `delete_teams_integration_mapping_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-integration-mappings-teams-id/).
+
+
+
+```python
+user_client.integration_mappings.delete_teams_integration_mapping_by_id(
+ integration_mapping_id
+)
+```
+
+### Arguments
+
+- integration_mapping_id `str`
+ - An ID of an integration mapping. Example: "11235432"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Empty body in response.
diff --git a/docs/invites.md b/docs/invites.md
new file mode 100644
index 000000000..5cfa00488
--- /dev/null
+++ b/docs/invites.md
@@ -0,0 +1,77 @@
+# InvitesManager
+
+- [Create user invite](#create-user-invite)
+- [Get user invite status](#get-user-invite-status)
+
+## Create user invite
+
+Invites an existing external user to join an enterprise.
+
+The existing user can not be part of another enterprise and
+must already have a Box account. Once invited, the user will receive an
+email and are prompted to accept the invitation within the
+Box web application.
+
+This method requires the "Manage An Enterprise" scope enabled for
+the application, which can be enabled within the developer console.
+
+This operation is performed by calling function `create_invite`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-invites/).
+
+
+
+```python
+client.invites.create_invite(
+ CreateInviteEnterprise(id=current_user.enterprise.id),
+ CreateInviteActionableBy(login=email),
+)
+```
+
+### Arguments
+
+- enterprise `CreateInviteEnterprise`
+ - The enterprise to invite the user to.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Invite`.
+
+Returns a new invite object.
+
+## Get user invite status
+
+Returns the status of a user invite.
+
+This operation is performed by calling function `get_invite_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-invites-id/).
+
+
+
+```python
+client.invites.get_invite_by_id(invitation.id)
+```
+
+### Arguments
+
+- invite_id `str`
+ - The ID of an invite. Example: "213723"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Invite`.
+
+Returns an invite object.
diff --git a/docs/legal_hold_policies.md b/docs/legal_hold_policies.md
new file mode 100644
index 000000000..361ab5b38
--- /dev/null
+++ b/docs/legal_hold_policies.md
@@ -0,0 +1,180 @@
+# LegalHoldPoliciesManager
+
+- [List all legal hold policies](#list-all-legal-hold-policies)
+- [Create legal hold policy](#create-legal-hold-policy)
+- [Get legal hold policy](#get-legal-hold-policy)
+- [Update legal hold policy](#update-legal-hold-policy)
+- [Remove legal hold policy](#remove-legal-hold-policy)
+
+## List all legal hold policies
+
+Retrieves a list of legal hold policies that belong to
+an enterprise.
+
+This operation is performed by calling function `get_legal_hold_policies`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-legal-hold-policies/).
+
+
+
+```python
+client.legal_hold_policies.get_legal_hold_policies()
+```
+
+### Arguments
+
+- policy_name `Optional[str]`
+ - Limits results to policies for which the names start with this search term. This is a case-insensitive prefix.
+- fields `Optional[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.
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `LegalHoldPolicies`.
+
+Returns a list of legal hold policies.
+
+## Create legal hold policy
+
+Create a new legal hold policy.
+
+This operation is performed by calling function `create_legal_hold_policy`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-legal-hold-policies/).
+
+
+
+```python
+client.legal_hold_policies.create_legal_hold_policy(
+ legal_hold_policy_name,
+ description=legal_hold_description,
+ filter_started_at=filter_started_at,
+ filter_ended_at=filter_ended_at,
+ is_ongoing=False,
+)
+```
+
+### Arguments
+
+- policy_name `str`
+ - The name of the policy.
+- description `Optional[str]`
+ - A description for the policy.
+- filter_started_at `Optional[DateTime]`
+ - The filter start date. When this policy is applied using a `custodian` legal hold assignments, it will only apply to file versions created or uploaded inside of the date range. Other assignment types, such as folders and files, will ignore the date filter. Required if `is_ongoing` is set to `false`.
+- filter_ended_at `Optional[DateTime]`
+ - The filter end date. When this policy is applied using a `custodian` legal hold assignments, it will only apply to file versions created or uploaded inside of the date range. Other assignment types, such as folders and files, will ignore the date filter. Required if `is_ongoing` is set to `false`.
+- is_ongoing `Optional[bool]`
+ - Whether new assignments under this policy should continue applying to files even after initialization. When this policy is applied using a legal hold assignment, it will continue applying the policy to any new file versions even after it has been applied. For example, if a legal hold assignment is placed on a user today, and that user uploads a file tomorrow, that file will get held. This will continue until the policy is retired. Required if no filter dates are set.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `LegalHoldPolicy`.
+
+Returns a new legal hold policy object.
+
+## Get legal hold policy
+
+Retrieve a legal hold policy.
+
+This operation is performed by calling function `get_legal_hold_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-legal-hold-policies-id/).
+
+
+
+```python
+client.legal_hold_policies.get_legal_hold_policy_by_id(legal_hold_policy_id)
+```
+
+### Arguments
+
+- legal_hold_policy_id `str`
+ - The ID of the legal hold policy. Example: "324432"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `LegalHoldPolicy`.
+
+Returns a legal hold policy object.
+
+## Update legal hold policy
+
+Update legal hold policy.
+
+This operation is performed by calling function `update_legal_hold_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-legal-hold-policies-id/).
+
+
+
+```python
+client.legal_hold_policies.update_legal_hold_policy_by_id(
+ legal_hold_policy_id, policy_name=updated_legal_hold_policy_name
+)
+```
+
+### Arguments
+
+- legal_hold_policy_id `str`
+ - The ID of the legal hold policy. Example: "324432"
+- policy_name `Optional[str]`
+ - The name of the policy.
+- description `Optional[str]`
+ - A description for the policy.
+- release_notes `Optional[str]`
+ - Notes around why the policy was released.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `LegalHoldPolicy`.
+
+Returns a new legal hold policy object.
+
+## Remove legal hold policy
+
+Delete an existing legal hold policy.
+
+This is an asynchronous process. The policy will not be
+fully deleted yet when the response returns.
+
+This operation is performed by calling function `delete_legal_hold_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-legal-hold-policies-id/).
+
+
+
+```python
+client.legal_hold_policies.delete_legal_hold_policy_by_id(legal_hold_policy.id)
+```
+
+### Arguments
+
+- legal_hold_policy_id `str`
+ - The ID of the legal hold policy. Example: "324432"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the policy was
+successfully deleted.
diff --git a/docs/legal_hold_policy_assignments.md b/docs/legal_hold_policy_assignments.md
new file mode 100644
index 000000000..cd14c2aef
--- /dev/null
+++ b/docs/legal_hold_policy_assignments.md
@@ -0,0 +1,201 @@
+# LegalHoldPolicyAssignmentsManager
+
+- [List legal hold policy assignments](#list-legal-hold-policy-assignments)
+- [Assign legal hold policy](#assign-legal-hold-policy)
+- [Get legal hold policy assignment](#get-legal-hold-policy-assignment)
+- [Unassign legal hold policy](#unassign-legal-hold-policy)
+- [List files with current file versions for legal hold policy assignment](#list-files-with-current-file-versions-for-legal-hold-policy-assignment)
+
+## List legal hold policy assignments
+
+Retrieves a list of items a legal hold policy has been assigned to.
+
+This operation is performed by calling function `get_legal_hold_policy_assignments`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-legal-hold-policy-assignments/).
+
+
+
+```python
+client.legal_hold_policy_assignments.get_legal_hold_policy_assignments(
+ legal_hold_policy_id
+)
+```
+
+### Arguments
+
+- policy_id `str`
+ - The ID of the legal hold policy.
+- 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.
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `LegalHoldPolicyAssignments`.
+
+Returns a list of legal hold policy assignments.
+
+## Assign legal hold policy
+
+Assign a legal hold to a file, file version, folder, or user.
+
+This operation is performed by calling function `create_legal_hold_policy_assignment`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-legal-hold-policy-assignments/).
+
+
+
+```python
+client.legal_hold_policy_assignments.create_legal_hold_policy_assignment(
+ legal_hold_policy_id,
+ CreateLegalHoldPolicyAssignmentAssignTo(
+ type=CreateLegalHoldPolicyAssignmentAssignToTypeField.FILE, id=file_id
+ ),
+)
+```
+
+### Arguments
+
+- policy_id `str`
+ - The ID of the policy to assign.
+- 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.
+
+### Returns
+
+This function returns a value of type `LegalHoldPolicyAssignment`.
+
+Returns a new legal hold policy assignment.
+
+## Get legal hold policy assignment
+
+Retrieve a legal hold policy assignment.
+
+This operation is performed by calling function `get_legal_hold_policy_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-legal-hold-policy-assignments-id/).
+
+
+
+```python
+client.legal_hold_policy_assignments.get_legal_hold_policy_assignment_by_id(
+ legal_hold_policy_assignment_id
+)
+```
+
+### Arguments
+
+- legal_hold_policy_assignment_id `str`
+ - The ID of the legal hold policy assignment. Example: "753465"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `LegalHoldPolicyAssignment`.
+
+Returns a legal hold policy object.
+
+## Unassign legal hold policy
+
+Remove a legal hold from an item.
+
+This is an asynchronous process. The policy will not be
+fully removed yet when the response returns.
+
+This operation is performed by calling function `delete_legal_hold_policy_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-legal-hold-policy-assignments-id/).
+
+
+
+```python
+client.legal_hold_policy_assignments.delete_legal_hold_policy_assignment_by_id(
+ legal_hold_policy_assignment_id
+)
+```
+
+### Arguments
+
+- legal_hold_policy_assignment_id `str`
+ - The ID of the legal hold policy assignment. Example: "753465"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the assignment was
+successfully deleted.
+
+## List files with current file versions for legal hold policy assignment
+
+Get a list of files with current file versions for a legal hold
+assignment.
+
+In some cases you may want to get previous file versions instead. In these
+cases, use the `GET /legal_hold_policy_assignments/:id/file_versions_on_hold`
+API instead to return any previous versions of a file for this legal hold
+policy assignment.
+
+Due to ongoing re-architecture efforts this API might not return all file
+versions held for this policy ID. Instead, this API will only return the
+latest file version held in the newly developed architecture. The `GET
+/file_version_legal_holds` API can be used to fetch current and past versions
+of files held within the legacy architecture.
+
+This endpoint does not support returning any content that is on hold due to
+a Custodian collaborating on a Hub.
+
+The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to
+find a list of policy assignments for a given policy ID.
+
+This operation is performed by calling function `get_legal_hold_policy_assignment_file_on_hold`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-legal-hold-policy-assignments-id-files-on-hold/).
+
+
+
+```python
+client.legal_hold_policy_assignments.get_legal_hold_policy_assignment_file_on_hold(
+ legal_hold_policy_assignment_id
+)
+```
+
+### Arguments
+
+- legal_hold_policy_assignment_id `str`
+ - The ID of the legal hold policy assignment. Example: "753465"
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- 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.
+- 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 `FilesOnHold`.
+
+Returns the list of current file versions held under legal hold for a
+specific legal hold policy assignment.
diff --git a/docs/list_collaborations.md b/docs/list_collaborations.md
new file mode 100644
index 000000000..e27227955
--- /dev/null
+++ b/docs/list_collaborations.md
@@ -0,0 +1,162 @@
+# ListCollaborationsManager
+
+- [List file collaborations](#list-file-collaborations)
+- [List folder collaborations](#list-folder-collaborations)
+- [List pending collaborations](#list-pending-collaborations)
+- [List group collaborations](#list-group-collaborations)
+
+## List file collaborations
+
+Retrieves a list of pending and active collaborations for a
+file. This returns all the users that have access to the file
+or have been invited to the file.
+
+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/).
+
+
+
+```python
+client.list_collaborations.get_file_collaborations(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- 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.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Collaborations`.
+
+Returns a collection of collaboration objects. If there are no
+collaborations on this file an empty collection will be returned.
+
+This list includes pending collaborations, for which the `status`
+is set to `pending`, indicating invitations that have been sent but not
+yet accepted.
+
+## List folder collaborations
+
+Retrieves a list of pending and active collaborations for a
+folder. This returns all the users that have access to the folder
+or have been invited to the folder.
+
+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/).
+
+
+
+```python
+client.list_collaborations.get_folder_collaborations(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. Example: "12345"
+- 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.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Collaborations`.
+
+Returns a collection of collaboration objects. If there are no
+collaborations on this folder an empty collection will be returned.
+
+This list includes pending collaborations, for which the `status`
+is set to `pending`, indicating invitations that have been sent but not
+yet accepted.
+
+## List pending collaborations
+
+Retrieves all pending collaboration invites for this user.
+
+This operation is performed by calling function `get_collaborations`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-collaborations/).
+
+
+
+```python
+client.list_collaborations.get_collaborations(GetCollaborationsStatus.PENDING)
+```
+
+### Arguments
+
+- 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.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `CollaborationsOffsetPaginated`.
+
+Returns a collection of pending collaboration objects.
+
+If the user has no pending collaborations, the collection
+will be empty.
+
+## List group collaborations
+
+Retrieves all the collaborations for a group. The user
+must have admin permissions to inspect enterprise's groups.
+
+Each collaboration object has details on which files or
+folders the group has access to and with what role.
+
+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/).
+
+
+
+```python
+client.list_collaborations.get_group_collaborations(group.id)
+```
+
+### Arguments
+
+- group_id `str`
+ - The ID of the group. Example: "57645"
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- 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 `CollaborationsOffsetPaginated`.
+
+Returns a collection of collaboration objects. If there are no
+collaborations, an empty collection will be returned.
diff --git a/docs/make.bat b/docs/make.bat
deleted file mode 100644
index 8e916f75a..000000000
--- a/docs/make.bat
+++ /dev/null
@@ -1,263 +0,0 @@
-@ECHO OFF
-
-REM Command file for Sphinx documentation
-
-if "%SPHINXBUILD%" == "" (
- set SPHINXBUILD=sphinx-build
-)
-set BUILDDIR=_build
-set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
-set I18NSPHINXOPTS=%SPHINXOPTS% .
-if NOT "%PAPER%" == "" (
- set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
- set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
-)
-
-if "%1" == "" goto help
-
-if "%1" == "help" (
- :help
- echo.Please use `make ^` where ^ is one of
- echo. html to make standalone HTML files
- echo. dirhtml to make HTML files named index.html in directories
- echo. singlehtml to make a single large HTML file
- echo. pickle to make pickle files
- echo. json to make JSON files
- echo. htmlhelp to make HTML files and a HTML help project
- echo. qthelp to make HTML files and a qthelp project
- echo. devhelp to make HTML files and a Devhelp project
- echo. epub to make an epub
- echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
- echo. text to make text files
- echo. man to make manual pages
- echo. texinfo to make Texinfo files
- echo. gettext to make PO message catalogs
- echo. changes to make an overview over all changed/added/deprecated items
- echo. xml to make Docutils-native XML files
- echo. pseudoxml to make pseudoxml-XML files for display purposes
- echo. linkcheck to check all external links for integrity
- echo. doctest to run all doctests embedded in the documentation if enabled
- echo. coverage to run coverage check of the documentation if enabled
- goto end
-)
-
-if "%1" == "clean" (
- for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
- del /q /s %BUILDDIR%\*
- goto end
-)
-
-
-REM Check if sphinx-build is available and fallback to Python version if any
-%SPHINXBUILD% 2> nul
-if errorlevel 9009 goto sphinx_python
-goto sphinx_ok
-
-:sphinx_python
-
-set SPHINXBUILD=python -m sphinx.__init__
-%SPHINXBUILD% 2> nul
-if errorlevel 9009 (
- echo.
- echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
- echo.installed, then set the SPHINXBUILD environment variable to point
- echo.to the full path of the 'sphinx-build' executable. Alternatively you
- echo.may add the Sphinx directory to PATH.
- echo.
- echo.If you don't have Sphinx installed, grab it from
- echo.http://sphinx-doc.org/
- exit /b 1
-)
-
-:sphinx_ok
-
-
-if "%1" == "html" (
- %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/html.
- goto end
-)
-
-if "%1" == "dirhtml" (
- %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
- goto end
-)
-
-if "%1" == "singlehtml" (
- %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
- goto end
-)
-
-if "%1" == "pickle" (
- %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can process the pickle files.
- goto end
-)
-
-if "%1" == "json" (
- %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can process the JSON files.
- goto end
-)
-
-if "%1" == "htmlhelp" (
- %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can run HTML Help Workshop with the ^
-.hhp project file in %BUILDDIR%/htmlhelp.
- goto end
-)
-
-if "%1" == "qthelp" (
- %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can run "qcollectiongenerator" with the ^
-.qhcp project file in %BUILDDIR%/qthelp, like this:
- echo.^> qcollectiongenerator %BUILDDIR%\qthelp\boxsdk.qhcp
- echo.To view the help file:
- echo.^> assistant -collectionFile %BUILDDIR%\qthelp\boxsdk.ghc
- goto end
-)
-
-if "%1" == "devhelp" (
- %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished.
- goto end
-)
-
-if "%1" == "epub" (
- %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The epub file is in %BUILDDIR%/epub.
- goto end
-)
-
-if "%1" == "latex" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
- goto end
-)
-
-if "%1" == "latexpdf" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- cd %BUILDDIR%/latex
- make all-pdf
- cd %~dp0
- echo.
- echo.Build finished; the PDF files are in %BUILDDIR%/latex.
- goto end
-)
-
-if "%1" == "latexpdfja" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- cd %BUILDDIR%/latex
- make all-pdf-ja
- cd %~dp0
- echo.
- echo.Build finished; the PDF files are in %BUILDDIR%/latex.
- goto end
-)
-
-if "%1" == "text" (
- %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The text files are in %BUILDDIR%/text.
- goto end
-)
-
-if "%1" == "man" (
- %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The manual pages are in %BUILDDIR%/man.
- goto end
-)
-
-if "%1" == "texinfo" (
- %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
- goto end
-)
-
-if "%1" == "gettext" (
- %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
- goto end
-)
-
-if "%1" == "changes" (
- %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
- if errorlevel 1 exit /b 1
- echo.
- echo.The overview file is in %BUILDDIR%/changes.
- goto end
-)
-
-if "%1" == "linkcheck" (
- %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
- if errorlevel 1 exit /b 1
- echo.
- echo.Link check complete; look for any errors in the above output ^
-or in %BUILDDIR%/linkcheck/output.txt.
- goto end
-)
-
-if "%1" == "doctest" (
- %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
- if errorlevel 1 exit /b 1
- echo.
- echo.Testing of doctests in the sources finished, look at the ^
-results in %BUILDDIR%/doctest/output.txt.
- goto end
-)
-
-if "%1" == "coverage" (
- %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
- if errorlevel 1 exit /b 1
- echo.
- echo.Testing of coverage in the sources finished, look at the ^
-results in %BUILDDIR%/coverage/python.txt.
- goto end
-)
-
-if "%1" == "xml" (
- %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The XML files are in %BUILDDIR%/xml.
- goto end
-)
-
-if "%1" == "pseudoxml" (
- %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
- goto end
-)
-
-:end
diff --git a/docs/memberships.md b/docs/memberships.md
new file mode 100644
index 000000000..2bb9c8ea3
--- /dev/null
+++ b/docs/memberships.md
@@ -0,0 +1,218 @@
+# MembershipsManager
+
+- [List user's groups](#list-users-groups)
+- [List members of group](#list-members-of-group)
+- [Add user to group](#add-user-to-group)
+- [Get group membership](#get-group-membership)
+- [Update group membership](#update-group-membership)
+- [Remove user from group](#remove-user-from-group)
+
+## List user's groups
+
+Retrieves all the groups for a user. Only members of this
+group or users with admin-level permissions will be able to
+use this API.
+
+This operation is performed by calling function `get_user_memberships`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-users-id-memberships/).
+
+
+
+```python
+client.memberships.get_user_memberships(user.id)
+```
+
+### Arguments
+
+- user_id `str`
+ - The ID of the user. Example: "12345"
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `GroupMemberships`.
+
+Returns a collection of membership objects. If there are no
+memberships, an empty collection will be returned.
+
+## List members of group
+
+Retrieves all the members for a group. Only members of this
+group or users with admin-level permissions will be able to
+use this API.
+
+This operation is performed by calling function `get_group_memberships`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-groups-id-memberships/).
+
+
+
+```python
+client.memberships.get_group_memberships(group.id)
+```
+
+### Arguments
+
+- group_id `str`
+ - The ID of the group. Example: "57645"
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `GroupMemberships`.
+
+Returns a collection of membership objects. If there are no
+memberships, an empty collection will be returned.
+
+## Add user to group
+
+Creates a group membership. Only users with
+admin-level permissions will be able to use this API.
+
+This operation is performed by calling function `create_group_membership`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-group-memberships/).
+
+
+
+```python
+client.memberships.create_group_membership(
+ CreateGroupMembershipUser(id=user.id), CreateGroupMembershipGroup(id=group.id)
+)
+```
+
+### Arguments
+
+- user `CreateGroupMembershipUser`
+ - The user to add to the group.
+- group `CreateGroupMembershipGroup`
+ - The group to add the user to.
+- 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.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `GroupMembership`.
+
+Returns a new group membership object.
+
+## Get group membership
+
+Retrieves a specific group membership. Only admins of this
+group or users with admin-level permissions will be able to
+use this API.
+
+This operation is performed by calling function `get_group_membership_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-group-memberships-id/).
+
+
+
+```python
+client.memberships.get_group_membership_by_id(group_membership.id)
+```
+
+### Arguments
+
+- group_membership_id `str`
+ - The ID of the group membership. Example: "434534"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `GroupMembership`.
+
+Returns the group membership object.
+
+## Update group membership
+
+Updates a user's group membership. Only admins of this
+group or users with admin-level permissions will be able to
+use this API.
+
+This operation is performed by calling function `update_group_membership_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-group-memberships-id/).
+
+
+
+```python
+client.memberships.update_group_membership_by_id(
+ group_membership.id, role=UpdateGroupMembershipByIdRole.ADMIN
+)
+```
+
+### Arguments
+
+- group_membership_id `str`
+ - The ID of the group membership. Example: "434534"
+- 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.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `GroupMembership`.
+
+Returns a new group membership object.
+
+## Remove user from group
+
+Deletes a specific group membership. Only admins of this
+group or users with admin-level permissions will be able to
+use this API.
+
+This operation is performed by calling function `delete_group_membership_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-group-memberships-id/).
+
+
+
+```python
+client.memberships.delete_group_membership_by_id(group_membership.id)
+```
+
+### Arguments
+
+- group_membership_id `str`
+ - The ID of the group membership. Example: "434534"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+A blank response is returned if the membership was
+successfully deleted.
diff --git a/docs/metadata_cascade_policies.md b/docs/metadata_cascade_policies.md
new file mode 100644
index 000000000..0f7604fe2
--- /dev/null
+++ b/docs/metadata_cascade_policies.md
@@ -0,0 +1,179 @@
+# MetadataCascadePoliciesManager
+
+- [List metadata cascade policies](#list-metadata-cascade-policies)
+- [Create metadata cascade policy](#create-metadata-cascade-policy)
+- [Get metadata cascade policy](#get-metadata-cascade-policy)
+- [Remove metadata cascade policy](#remove-metadata-cascade-policy)
+- [Force-apply metadata cascade policy to folder](#force-apply-metadata-cascade-policy-to-folder)
+
+## List metadata cascade policies
+
+Retrieves a list of all the metadata cascade policies
+that are applied to a given folder. This can not be used on the root
+folder with ID `0`.
+
+This operation is performed by calling function `get_metadata_cascade_policies`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-metadata-cascade-policies/).
+
+
+
+```python
+client.metadata_cascade_policies.get_metadata_cascade_policies(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - Specifies which folder to return policies for. This can not be used on the root folder with ID `0`.
+- owner_enterprise_id `Optional[str]`
+ - The ID of the enterprise ID for which to find metadata cascade policies. If not specified, it defaults to the current enterprise.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataCascadePolicies`.
+
+Returns a list of metadata cascade policies.
+
+## Create metadata cascade policy
+
+Creates a new metadata cascade policy that applies a given
+metadata template to a given folder and automatically
+cascades it down to any files within that folder.
+
+In order for the policy to be applied a metadata instance must first
+be applied to the folder the policy is to be applied to.
+
+This operation is performed by calling function `create_metadata_cascade_policy`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-metadata-cascade-policies/).
+
+
+
+```python
+client.metadata_cascade_policies.create_metadata_cascade_policy(
+ folder.id, CreateMetadataCascadePolicyScope.ENTERPRISE, 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 `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
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataCascadePolicy`.
+
+Returns a new of metadata cascade policy.
+
+## Get metadata cascade policy
+
+Retrieve a specific metadata cascade policy assigned to a folder.
+
+This operation is performed by calling function `get_metadata_cascade_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-metadata-cascade-policies-id/).
+
+
+
+```python
+client.metadata_cascade_policies.get_metadata_cascade_policy_by_id(cascade_policy_id)
+```
+
+### Arguments
+
+- metadata_cascade_policy_id `str`
+ - The ID of the metadata cascade policy. Example: "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataCascadePolicy`.
+
+Returns a metadata cascade policy.
+
+## Remove metadata cascade policy
+
+Deletes a metadata cascade policy.
+
+This operation is performed by calling function `delete_metadata_cascade_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-metadata-cascade-policies-id/).
+
+
+
+```python
+client.metadata_cascade_policies.delete_metadata_cascade_policy_by_id(cascade_policy_id)
+```
+
+### Arguments
+
+- metadata_cascade_policy_id `str`
+ - The ID of the metadata cascade policy. Example: "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the policy
+is successfully deleted.
+
+## Force-apply metadata cascade policy to folder
+
+Force the metadata on a folder with a metadata cascade policy to be applied to
+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 `apply_metadata_cascade_policy`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-metadata-cascade-policies-id-apply/).
+
+
+
+```python
+client.metadata_cascade_policies.apply_metadata_cascade_policy(
+ cascade_policy_id, ApplyMetadataCascadePolicyConflictResolution.OVERWRITE
+)
+```
+
+### Arguments
+
+- metadata_cascade_policy_id `str`
+ - The ID of the cascade policy to force-apply. Example: "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7"
+- 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.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the API call was successful. The metadata
+cascade operation will be performed asynchronously.
+
+The API call will return directly, before the cascade operation
+is complete. There is currently no API to check for the status of this
+operation.
diff --git a/docs/metadata_templates.md b/docs/metadata_templates.md
new file mode 100644
index 000000000..56b848c47
--- /dev/null
+++ b/docs/metadata_templates.md
@@ -0,0 +1,336 @@
+# MetadataTemplatesManager
+
+- [Find metadata template by instance ID](#find-metadata-template-by-instance-id)
+- [Get metadata template by name](#get-metadata-template-by-name)
+- [Update metadata template](#update-metadata-template)
+- [Remove metadata template](#remove-metadata-template)
+- [Get metadata template by ID](#get-metadata-template-by-id)
+- [List all global metadata templates](#list-all-global-metadata-templates)
+- [List all metadata templates for enterprise](#list-all-metadata-templates-for-enterprise)
+- [Create metadata template](#create-metadata-template)
+
+## Find metadata template by instance ID
+
+Finds a metadata template by searching for the ID of an instance of the
+template.
+
+This operation is performed by calling function `get_metadata_templates_by_instance_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-metadata-templates/).
+
+
+
+```python
+client.metadata_templates.get_metadata_templates_by_instance_id(
+ created_metadata_instance.id
+)
+```
+
+### Arguments
+
+- metadata_instance_id `str`
+ - The ID of an instance of the metadata template to find.
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataTemplates`.
+
+Returns a list containing the 1 metadata template that matches the
+instance ID.
+
+## Get metadata template by name
+
+Retrieves a metadata template by its `scope` and `templateKey` values.
+
+To find the `scope` and `templateKey` for a template, list all templates for
+an enterprise or globally, or list all templates applied to a file or folder.
+
+This operation is performed by calling function `get_metadata_template`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-metadata-templates-id-id-schema/).
+
+
+
+```python
+client.metadata_templates.get_metadata_template(
+ GetMetadataTemplateScope.ENTERPRISE, template.template_key
+)
+```
+
+### Arguments
+
+- scope `GetMetadataTemplateScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataTemplate`.
+
+Returns the metadata template matching the `scope`
+and `template` name.
+
+## Update metadata template
+
+Updates a metadata template.
+
+The metadata template can only be updated if the template
+already exists.
+
+The update is applied atomically. If any errors occur during the
+application of the operations, the metadata template will not be changed.
+
+This operation is performed by calling function `update_metadata_template`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-metadata-templates-id-id-schema/).
+
+
+
+```python
+client.metadata_templates.update_metadata_template(
+ UpdateMetadataTemplateScope.ENTERPRISE,
+ template_key,
+ [
+ UpdateMetadataTemplateRequestBody(
+ op=UpdateMetadataTemplateRequestBodyOpField.ADDFIELD,
+ field_key="newfieldname",
+ data={"type": "string", "displayName": "newFieldName"},
+ )
+ ],
+)
+```
+
+### Arguments
+
+- scope `UpdateMetadataTemplateScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- 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.
+
+### Returns
+
+This function returns a value of type `MetadataTemplate`.
+
+Returns the updated metadata template, with the
+custom template data included.
+
+## Remove metadata template
+
+Delete a metadata template and its instances.
+This deletion is permanent and can not be reversed.
+
+This operation is performed by calling function `delete_metadata_template`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-metadata-templates-id-id-schema/).
+
+
+
+```python
+client.metadata_templates.delete_metadata_template(
+ DeleteMetadataTemplateScope.ENTERPRISE, template.template_key
+)
+```
+
+### Arguments
+
+- scope `DeleteMetadataTemplateScope`
+ - The scope of the metadata template. Example: "global"
+- template_key `str`
+ - The name of the metadata template. Example: "properties"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the metadata
+template is successfully deleted.
+
+## Get metadata template by ID
+
+Retrieves a metadata template by its ID.
+
+This operation is performed by calling function `get_metadata_template_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-metadata-templates-id/).
+
+
+
+```python
+client.metadata_templates.get_metadata_template_by_id(template.id)
+```
+
+### Arguments
+
+- template_id `str`
+ - The ID of the template. Example: "f7a9891f"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataTemplate`.
+
+Returns the metadata template that matches the ID.
+
+## List all global metadata templates
+
+Used to retrieve all generic, global metadata templates available to all
+enterprises using Box.
+
+This operation is performed by calling function `get_global_metadata_templates`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-metadata-templates-global/).
+
+
+
+```python
+client.metadata_templates.get_global_metadata_templates()
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataTemplates`.
+
+Returns all of the metadata templates available to all enterprises
+and their corresponding schema.
+
+## List all metadata templates for enterprise
+
+Used to retrieve all metadata templates created to be used specifically within
+the user's enterprise.
+
+This operation is performed by calling function `get_enterprise_metadata_templates`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-metadata-templates-enterprise/).
+
+
+
+```python
+client.metadata_templates.get_enterprise_metadata_templates()
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataTemplates`.
+
+Returns all of the metadata templates within an enterprise
+and their corresponding schema.
+
+## Create metadata template
+
+Creates a new metadata template that can be applied to
+files and folders.
+
+This operation is performed by calling function `create_metadata_template`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-metadata-templates-schema/).
+
+
+
+```python
+client.metadata_templates.create_metadata_template(
+ "enterprise",
+ template_key,
+ template_key=template_key,
+ fields=[
+ CreateMetadataTemplateFields(
+ type=CreateMetadataTemplateFieldsTypeField.STRING,
+ key="testName",
+ display_name="testName",
+ ),
+ CreateMetadataTemplateFields(
+ type=CreateMetadataTemplateFieldsTypeField.FLOAT,
+ key="age",
+ display_name="age",
+ ),
+ CreateMetadataTemplateFields(
+ type=CreateMetadataTemplateFieldsTypeField.DATE,
+ key="birthDate",
+ display_name="birthDate",
+ ),
+ CreateMetadataTemplateFields(
+ type=CreateMetadataTemplateFieldsTypeField.ENUM,
+ key="countryCode",
+ display_name="countryCode",
+ options=[
+ CreateMetadataTemplateFieldsOptionsField(key="US"),
+ CreateMetadataTemplateFieldsOptionsField(key="CA"),
+ ],
+ ),
+ CreateMetadataTemplateFields(
+ type=CreateMetadataTemplateFieldsTypeField.MULTISELECT,
+ key="sports",
+ display_name="sports",
+ options=[
+ CreateMetadataTemplateFieldsOptionsField(key="basketball"),
+ CreateMetadataTemplateFieldsOptionsField(key="football"),
+ CreateMetadataTemplateFieldsOptionsField(key="tennis"),
+ ],
+ ),
+ ],
+)
+```
+
+### Arguments
+
+- scope `str`
+ - The scope of the metadata template to create. Applications can only create templates for use within the authenticated user's enterprise. This value needs to be set to `enterprise`, as `global` scopes can not be created by applications.
+- template_key `Optional[str]`
+ - A unique identifier for the template. This identifier needs to be unique across the enterprise for which the metadata template is being created. When not provided, the API will create a unique `templateKey` based on the value of the `displayName`.
+- display_name `str`
+ - 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[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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataTemplate`.
+
+The schema representing the metadata template created.
diff --git a/docs/recent_items.md b/docs/recent_items.md
new file mode 100644
index 000000000..4f1c86562
--- /dev/null
+++ b/docs/recent_items.md
@@ -0,0 +1,37 @@
+# RecentItemsManager
+
+- [List recently accessed items](#list-recently-accessed-items)
+
+## List recently accessed items
+
+Returns information about the recent items accessed
+by a user, either in the last 90 days or up to the last
+1000 items accessed.
+
+This operation is performed by calling function `get_recent_items`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-recent-items/).
+
+
+
+```python
+client.recent_items.get_recent_items()
+```
+
+### Arguments
+
+- 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.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RecentItems`.
+
+Returns a list recent items access by a user.
diff --git a/docs/retention_policies.md b/docs/retention_policies.md
new file mode 100644
index 000000000..d92ba85bb
--- /dev/null
+++ b/docs/retention_policies.md
@@ -0,0 +1,204 @@
+# RetentionPoliciesManager
+
+- [List retention policies](#list-retention-policies)
+- [Create retention policy](#create-retention-policy)
+- [Get retention policy](#get-retention-policy)
+- [Update retention policy](#update-retention-policy)
+- [Delete retention policy](#delete-retention-policy)
+
+## List retention policies
+
+Retrieves all of the retention policies for an enterprise.
+
+This operation is performed by calling function `get_retention_policies`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-retention-policies/).
+
+
+
+```python
+client.retention_policies.get_retention_policies()
+```
+
+### Arguments
+
+- policy_name `Optional[str]`
+ - Filters results by a case sensitive prefix of the name of retention policies.
+- 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.
+- 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.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RetentionPolicies`.
+
+Returns a list retention policies in the enterprise.
+
+## Create retention policy
+
+Creates a retention policy.
+
+This operation is performed by calling function `create_retention_policy`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-retention-policies/).
+
+
+
+```python
+client.retention_policies.create_retention_policy(
+ retention_policy_name,
+ CreateRetentionPolicyPolicyType.FINITE,
+ CreateRetentionPolicyDispositionAction.REMOVE_RETENTION,
+ description=retention_description,
+ retention_length="1",
+ retention_type=CreateRetentionPolicyRetentionType.MODIFIABLE,
+ can_owner_extend_retention=True,
+ are_owners_notified=True,
+)
+```
+
+### Arguments
+
+- policy_name `str`
+ - The name for the retention policy.
+- description `Optional[str]`
+ - The additional text description of the retention policy.
+- 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 `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[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.
+- are_owners_notified `Optional[bool]`
+ - Whether owner and co-owners of a file are notified when the policy nears expiration.
+- custom_notification_recipients `Optional[List[UserMini]]`
+ - A list of users notified when the retention policy duration is about to end.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RetentionPolicy`.
+
+Returns a new retention policy object.
+
+## Get retention policy
+
+Retrieves a retention policy.
+
+This operation is performed by calling function `get_retention_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-retention-policies-id/).
+
+
+
+```python
+client.retention_policies.get_retention_policy_by_id(retention_policy.id)
+```
+
+### Arguments
+
+- retention_policy_id `str`
+ - The ID of the retention policy. Example: "982312"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RetentionPolicy`.
+
+Returns the retention policy object.
+
+## Update retention policy
+
+Updates a retention policy.
+
+This operation is performed by calling function `update_retention_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-retention-policies-id/).
+
+
+
+```python
+client.retention_policies.update_retention_policy_by_id(
+ retention_policy.id, policy_name=updated_retention_policy_name
+)
+```
+
+### Arguments
+
+- retention_policy_id `str`
+ - The ID of the retention policy. Example: "982312"
+- policy_name `Optional[str]`
+ - The name for the retention policy.
+- description `Optional[str]`
+ - The additional text description of the retention policy.
+- disposition_action `Optional[str]`
+ - The disposition action of the retention policy. This action can be `permanently_delete`, which will cause the content retained by the policy to be permanently deleted, or `remove_retention`, which will lift the retention policy from the content, allowing it to be deleted by users, once the retention policy has expired. You can use `null` if you don't want to change `disposition_action`.
+- retention_type `Optional[str]`
+ - Specifies the retention type: _ `modifiable`: You can modify the retention policy. For example, you can add or remove folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if your retention policy is not related to any regulatory purposes. _ `non-modifiable`: You can modify the retention policy only in a limited way: add a folder, lengthen the duration, retire the policy, change the disposition action or notification settings. You cannot perform other actions, such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies. When updating a retention policy, you can use `non-modifiable` type only. You can convert a `modifiable` policy to `non-modifiable`, but not the other way around.
+- 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`.
+- status `Optional[str]`
+ - Used to retire a retention policy. If not retiring a policy, do not include this parameter or set it to `null`.
+- can_owner_extend_retention `Optional[bool]`
+ - Determines if the owner of items under the policy can extend the retention when the original retention duration is about to end.
+- are_owners_notified `Optional[bool]`
+ - Determines if owners and co-owners of items under the policy are notified when the retention duration is about to end.
+- custom_notification_recipients `Optional[List[UserBase]]`
+ - A list of users notified when the retention duration is about to end.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RetentionPolicy`.
+
+Returns the updated retention policy object.
+
+## Delete retention policy
+
+Permanently deletes a retention policy.
+
+This operation is performed by calling function `delete_retention_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-retention-policies-id/).
+
+
+
+```python
+client.retention_policies.delete_retention_policy_by_id(retention_policy.id)
+```
+
+### Arguments
+
+- retention_policy_id `str`
+ - The ID of the retention policy. Example: "982312"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the policy has been deleted.
diff --git a/docs/retention_policy_assignments.md b/docs/retention_policy_assignments.md
new file mode 100644
index 000000000..d1249371b
--- /dev/null
+++ b/docs/retention_policy_assignments.md
@@ -0,0 +1,185 @@
+# RetentionPolicyAssignmentsManager
+
+- [List retention policy assignments](#list-retention-policy-assignments)
+- [Assign retention policy](#assign-retention-policy)
+- [Get retention policy assignment](#get-retention-policy-assignment)
+- [Remove retention policy assignment](#remove-retention-policy-assignment)
+- [Get files under retention](#get-files-under-retention)
+
+## List retention policy assignments
+
+Returns a list of all retention policy assignments associated with a specified
+retention policy.
+
+This operation is performed by calling function `get_retention_policy_assignments`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-retention-policies-id-assignments/).
+
+
+
+```python
+client.retention_policy_assignments.get_retention_policy_assignments(
+ retention_policy.id
+)
+```
+
+### Arguments
+
+- retention_policy_id `str`
+ - The ID of the retention policy. Example: "982312"
+- 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.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RetentionPolicyAssignments`.
+
+Returns a list of the retention policy assignments associated with the
+specified retention policy.
+
+## Assign retention policy
+
+Assigns a retention policy to an item.
+
+This operation is performed by calling function `create_retention_policy_assignment`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-retention-policy-assignments/).
+
+
+
+```python
+client.retention_policy_assignments.create_retention_policy_assignment(
+ retention_policy.id,
+ CreateRetentionPolicyAssignmentAssignTo(
+ type=CreateRetentionPolicyAssignmentAssignToTypeField.FOLDER, id=folder.id
+ ),
+)
+```
+
+### Arguments
+
+- policy_id `str`
+ - The ID of the retention policy to assign.
+- assign_to `CreateRetentionPolicyAssignmentAssignTo`
+ - The item to assign the policy to.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RetentionPolicyAssignment`.
+
+Returns a new retention policy assignment object.
+
+## Get retention policy assignment
+
+Retrieves a retention policy assignment.
+
+This operation is performed by calling function `get_retention_policy_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-retention-policy-assignments-id/).
+
+
+
+```python
+client.retention_policy_assignments.get_retention_policy_assignment_by_id(
+ retention_policy_assignment.id
+)
+```
+
+### Arguments
+
+- retention_policy_assignment_id `str`
+ - The ID of the retention policy assignment. Example: "1233123"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `RetentionPolicyAssignment`.
+
+Returns the retention policy assignment object.
+
+## Remove retention policy assignment
+
+Removes a retention policy assignment
+applied to content.
+
+This operation is performed by calling function `delete_retention_policy_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-retention-policy-assignments-id/).
+
+
+
+```python
+client.retention_policy_assignments.delete_retention_policy_assignment_by_id(
+ retention_policy_assignment.id
+)
+```
+
+### Arguments
+
+- retention_policy_assignment_id `str`
+ - The ID of the retention policy assignment. Example: "1233123"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the policy assignment
+is successfully deleted.
+
+## Get files under retention
+
+Returns a list of files under retention for a retention policy assignment.
+
+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/).
+
+
+
+```python
+client.retention_policy_assignments.get_files_under_retention_policy_assignment(
+ retention_policy_assignment.id
+)
+```
+
+### Arguments
+
+- retention_policy_assignment_id `str`
+ - The ID of the retention policy assignment. Example: "1233123"
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FilesUnderRetention`.
+
+Returns a list of files under retention that are associated with the
+specified retention policy assignment.
diff --git a/docs/search.md b/docs/search.md
new file mode 100644
index 000000000..580dcab9e
--- /dev/null
+++ b/docs/search.md
@@ -0,0 +1,141 @@
+# SearchManager
+
+- [Query files/folders by metadata](#query-files-folders-by-metadata)
+- [Search for content](#search-for-content)
+
+## Query files/folders by metadata
+
+Create a search using SQL-like syntax to return items that match specific
+metadata.
+
+By default, this endpoint returns only the most basic info about the items for
+which the query matches. To get additional fields for each item, including any
+of the metadata, use the `fields` attribute in the query.
+
+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/).
+
+
+
+```python
+client.search.search_by_metadata_query(
+ search_from,
+ "0",
+ query="name = :name AND age < :age AND birthDate >= :birthDate AND countryCode = :countryCode AND sports = :sports",
+ query_params={
+ "name": "John",
+ "age": 50,
+ "birthDate": "2001-01-01T02:20:10.120Z",
+ "countryCode": "US",
+ "sports": ["basketball", "tennis"],
+ },
+)
+```
+
+### Arguments
+
+- from\_ `str`
+ - Specifies the template used in the query. Must be in the form `scope.templateKey`. Not all templates can be used in this field, most notably the built-in, Box-provided classification templates can not be used in a query.
+- query `Optional[str]`
+ - The query to perform. A query is a logical expression that is very similar to a SQL `SELECT` statement. Values in the search query can be turned into parameters specified in the `query_param` arguments list to prevent having to manually insert search values into the query string. For example, a value of `:amount` would represent the `amount` value in `query_params` object.
+- query_params `Optional[Dict]`
+ - 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[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.
+- marker `Optional[str]`
+ - Marker to use for requesting the next page.
+- fields `Optional[List[str]]`
+ - By default, this endpoint returns only the most basic info about the items for which the query matches. This attribute can be used to specify a list of additional attributes to return for any item, including its metadata. This attribute takes a list of item fields, metadata template identifiers, or metadata template field identifiers. For example: _ `created_by` will add the details of the user who created the item to the response. _ `metadata..` will return the mini-representation of the metadata instance identified by the `scope` and `templateKey`. \* `metadata...` will return all the mini-representation of the metadata instance identified by the `scope` and `templateKey` plus the field specified by the `field` name. Multiple fields for the same `scope` and `templateKey` can be defined.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `MetadataQueryResults`.
+
+Returns a list of files and folders that match this metadata query.
+
+## Search for content
+
+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 `search_for_content`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-search/).
+
+
+
+```python
+client.search.search_for_content(
+ ancestor_folder_ids=["0"],
+ mdfilters=[
+ MetadataFilter(
+ filters=search_filters,
+ scope=MetadataFilterScopeField.ENTERPRISE,
+ template_key=template_key,
+ )
+ ],
+)
+```
+
+### 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[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.
+- created_at_range `Optional[List[str]]`
+ - Limits the search results to any items created within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the the start date is omitted (`,2014-05-17T13:35:01-07:00`) anything created before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the current date will be used as the end date instead.
+- updated_at_range `Optional[List[str]]`
+ - Limits the search results to any items updated within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the start date is omitted (`,2014-05-17T13:35:01-07:00`) anything updated before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the current date will be used as the end date instead.
+- size_range `Optional[List[int]]`
+ - Limits the search results to any items with a size within a given file size range. This applied to files and folders. Size ranges are defined as comma separated list of a lower and upper byte size limit (inclusive). The upper and lower bound can be omitted to create open ranges.
+- owner_user_ids `Optional[List[str]]`
+ - Limits the search results to any items that are owned by the given list of owners, defined as a list of comma separated user IDs. The items still need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users an empty result set will be returned. To search across an entire enterprise, we recommend using the `enterprise_content` scope parameter which can be requested with our support team.
+- recent_updater_user_ids `Optional[List[str]]`
+ - Limits the search results to any items that have been updated by the given list of users, defined as a list of comma separated user IDs. The items still need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users an empty result set will be returned. This feature only searches back to the last 10 versions of an item.
+- 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[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[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[SearchForContentTrashContent]`
+ - Determines if the search should look in the trash for items. By default, this API only returns search results for items not currently in the trash (`non_trashed_only`). _ `trashed_only` - Only searches for items currently in the trash _ `non_trashed_only` - Only searches for items currently not in the trash \* `all_items` - Searches for both trashed and non-trashed items.
+- mdfilters `Optional[List[MetadataFilter]]`
+ - Limits the search results to any items for which the metadata matches the provided filter. This parameter is a list that specifies exactly **one** metadata template used to filter the search results. The parameter is required unless the `query` parameter is provided.
+- sort `Optional[SearchForContentSort]`
+ - Defines the order in which search results are returned. This API defaults to returning items by relevance unless this parameter is explicitly specified. _ `relevance` (default) returns the results sorted by relevance to the query search term. The relevance is based on the occurrence of the search term in the items name, description, content, and additional properties. _ `modified_at` returns the results ordered in descending order by date at which the item was last modified.
+- direction `Optional[SearchForContentDirection]`
+ - Defines the direction in which search results are ordered. This API defaults to returning items in descending (`DESC`) order unless this parameter is explicitly specified. When results are sorted by `relevance` the ordering is locked to returning items in descending order of relevance, and this parameter is ignored.
+- limit `Optional[int]`
+ - Defines the maximum number of items to return as part of a page of results.
+- include_recent_shared_links `Optional[bool]`
+ - Defines whether the search results should include any items that the user recently accessed through a shared link. When this parameter has been set to true, the format of the response of this API changes to return a list of [Search Results with Shared Links](r://search_results_with_shared_links).
+- 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.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- deleted_user_ids `Optional[List[str]]`
+ - Limits the search results to items that were deleted by the given list of users, defined as a list of comma separated user IDs. The `trash_content` parameter needs to be set to `trashed_only`. If searching in trash is not performed, an empty result set is returned. The items need to be owned or shared with the currently authenticated user for them to show up in the search results. If the user does not have access to any files owned by any of the users, an empty result set is returned. Data available from 2023-02-01 onwards.
+- deleted_at_range `Optional[List[str]]`
+ - Limits the search results to any items deleted within a given date range. Date ranges are defined as comma separated RFC3339 timestamps. If the the start date is omitted (`2014-05-17T13:35:01-07:00`), anything deleted before the end date will be returned. If the end date is omitted (`2014-05-15T13:35:01-07:00`), the current date will be used as the end date instead. The `trash_content` parameter needs to be set to `trashed_only`. If searching in trash is not performed, then an empty result is returned. Data available from 2023-02-01 onwards.
+- 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 `Union[SearchResults, SearchResultsWithSharedLinks]`.
+
+Returns a collection of search results. If there are no matching
+search results, the `entries` array will be empty.
diff --git a/docs/session_termination.md b/docs/session_termination.md
new file mode 100644
index 000000000..5e05aed07
--- /dev/null
+++ b/docs/session_termination.md
@@ -0,0 +1,70 @@
+# SessionTerminationManager
+
+- [Create jobs to terminate users session](#create-jobs-to-terminate-users-session)
+- [Create jobs to terminate user group session](#create-jobs-to-terminate-user-group-session)
+
+## Create jobs to terminate users session
+
+Validates the roles and permissions of the user,
+and creates asynchronous jobs
+to terminate the user's sessions.
+Returns the status for the POST request.
+
+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/).
+
+
+
+```python
+client.session_termination.terminate_users_sessions(
+ [get_env_var("USER_ID")], [user.login]
+)
+```
+
+### Arguments
+
+- user_ids `List[str]`
+ - A list of user IDs.
+- user_logins `List[str]`
+ - A list of user logins.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `SessionTerminationMessage`.
+
+Returns a message about the request status.
+
+## Create jobs to terminate user group session
+
+Validates the roles and permissions of the group,
+and creates asynchronous jobs
+to terminate the group's sessions.
+Returns the status for the POST request.
+
+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/).
+
+
+
+```python
+client.session_termination.terminate_groups_sessions([group.id])
+```
+
+### Arguments
+
+- group_ids `List[str]`
+ - A list of group IDs.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `SessionTerminationMessage`.
+
+Returns a message about the request status.
diff --git a/docs/shared_links_app_items.md b/docs/shared_links_app_items.md
new file mode 100644
index 000000000..740ab9ad7
--- /dev/null
+++ b/docs/shared_links_app_items.md
@@ -0,0 +1,36 @@
+# SharedLinksAppItemsManager
+
+- [Find app item for shared link](#find-app-item-for-shared-link)
+
+## Find app item for shared link
+
+Returns the app item represented by a shared link.
+
+The link can originate from the current enterprise or another.
+
+This operation is performed by calling function `find_app_item_for_shared_link`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shared-items--app-items/).
+
+
+
+```python
+client.shared_links_app_items.find_app_item_for_shared_link(
+ "".join(["shared_link=", app_item_shared_link])
+)
+```
+
+### Arguments
+
+- boxapi `str`
+ - A header containing the shared link and optional password for the shared link. The format for this header is `shared_link=[link]&shared_link_password=[password]`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `AppItem`.
+
+Returns a full app item resource if the shared link is valid and
+the user has access to it.
diff --git a/docs/shared_links_files.md b/docs/shared_links_files.md
new file mode 100644
index 000000000..4d9bb23f9
--- /dev/null
+++ b/docs/shared_links_files.md
@@ -0,0 +1,200 @@
+# SharedLinksFilesManager
+
+- [Find file for shared link](#find-file-for-shared-link)
+- [Get shared link for file](#get-shared-link-for-file)
+- [Add shared link to file](#add-shared-link-to-file)
+- [Update shared link on file](#update-shared-link-on-file)
+- [Remove shared link from file](#remove-shared-link-from-file)
+
+## Find file for shared link
+
+Returns the file represented by a shared link.
+
+A shared file can be represented by a shared link,
+which can originate within the current enterprise or within another.
+
+This endpoint allows an application to retrieve information about a
+shared file when only given a shared link.
+
+The `shared_link_permission_options` array field can be returned
+by requesting it in the `fields` query parameter.
+
+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/).
+
+
+
+```python
+user_client.shared_links_files.find_file_for_shared_link(
+ "".join(
+ [
+ "shared_link=",
+ file_from_api.shared_link.url,
+ "&shared_link_password=Secret123@",
+ ]
+ )
+)
+```
+
+### Arguments
+
+- 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.
+- if_none_match `Optional[str]`
+ - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since.
+- boxapi `str`
+ - A header containing the shared link and optional password for the shared link. The format for this header is as follows: `shared_link=[link]&shared_link_password=[password]`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileFull`.
+
+Returns a full file resource if the shared link is valid and
+the user has access to it.
+
+## Get shared link for file
+
+Gets the information for a shared link on a file.
+
+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/).
+
+
+
+```python
+client.shared_links_files.get_shared_link_for_file(file_id, "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"
+- fields `str`
+ - Explicitly request the `shared_link` fields to be returned for this item.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileFull`.
+
+Returns the base representation of a file with the
+additional shared link information.
+
+## Add shared link to file
+
+Adds a shared link to a file.
+
+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/).
+
+
+
+```python
+client.shared_links_files.add_share_link_to_file(
+ file_id,
+ "shared_link",
+ shared_link=AddShareLinkToFileSharedLink(
+ access=AddShareLinkToFileSharedLinkAccessField.OPEN, password="Secret123@"
+ ),
+)
+```
+
+### 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[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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileFull`.
+
+Returns the base representation of a file with a new shared
+link attached.
+
+## Update shared link on file
+
+Updates a shared link on a file.
+
+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/).
+
+
+
+```python
+client.shared_links_files.update_shared_link_on_file(
+ file_id,
+ "shared_link",
+ shared_link=UpdateSharedLinkOnFileSharedLink(
+ access=UpdateSharedLinkOnFileSharedLinkAccessField.COLLABORATORS
+ ),
+)
+```
+
+### 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[UpdateSharedLinkOnFileSharedLink]`
+ - The settings for the shared link to update.
+- fields `str`
+ - Explicitly request the `shared_link` fields to be returned for this item.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileFull`.
+
+Returns a basic representation of the file, with the updated shared
+link attached.
+
+## Remove shared link from file
+
+Removes a shared link from a file.
+
+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/).
+
+
+
+```python
+client.shared_links_files.remove_shared_link_from_file(
+ file_id, "shared_link", shared_link=create_null()
+)
+```
+
+### 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[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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FileFull`.
+
+Returns a basic representation of a file, with the shared link removed.
diff --git a/docs/shared_links_folders.md b/docs/shared_links_folders.md
new file mode 100644
index 000000000..487793219
--- /dev/null
+++ b/docs/shared_links_folders.md
@@ -0,0 +1,197 @@
+# SharedLinksFoldersManager
+
+- [Find folder for shared link](#find-folder-for-shared-link)
+- [Get shared link for folder](#get-shared-link-for-folder)
+- [Add shared link to folder](#add-shared-link-to-folder)
+- [Update shared link on folder](#update-shared-link-on-folder)
+- [Remove shared link from folder](#remove-shared-link-from-folder)
+
+## Find folder for shared link
+
+Return the folder represented by a shared link.
+
+A shared folder can be represented by a shared link,
+which can originate within the current enterprise or within another.
+
+This endpoint allows an application to retrieve information about a
+shared folder when only given a shared link.
+
+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/).
+
+
+
+```python
+user_client.shared_links_folders.find_folder_for_shared_link(
+ "".join(
+ [
+ "shared_link=",
+ folder_from_api.shared_link.url,
+ "&shared_link_password=Secret123@",
+ ]
+ )
+)
+```
+
+### Arguments
+
+- 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.
+- if_none_match `Optional[str]`
+ - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since.
+- boxapi `str`
+ - A header containing the shared link and optional password for the shared link. The format for this header is as follows: `shared_link=[link]&shared_link_password=[password]`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns a full folder resource if the shared link is valid and
+the user has access to it.
+
+## Get shared link for folder
+
+Gets the information for a shared link on a folder.
+
+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/).
+
+
+
+```python
+client.shared_links_folders.get_shared_link_for_folder(folder.id, "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"
+- fields `str`
+ - Explicitly request the `shared_link` fields to be returned for this item.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns the base representation of a folder with the
+additional shared link information.
+
+## Add shared link to folder
+
+Adds a shared link to a folder.
+
+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/).
+
+
+
+```python
+client.shared_links_folders.add_share_link_to_folder(
+ folder.id,
+ "shared_link",
+ shared_link=AddShareLinkToFolderSharedLink(
+ access=AddShareLinkToFolderSharedLinkAccessField.OPEN, password="Secret123@"
+ ),
+)
+```
+
+### 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[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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns the base representation of a folder with a new shared
+link attached.
+
+## Update shared link on folder
+
+Updates a shared link on a folder.
+
+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/).
+
+
+
+```python
+client.shared_links_folders.update_shared_link_on_folder(
+ folder.id,
+ "shared_link",
+ shared_link=UpdateSharedLinkOnFolderSharedLink(
+ access=UpdateSharedLinkOnFolderSharedLinkAccessField.COLLABORATORS
+ ),
+)
+```
+
+### 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[UpdateSharedLinkOnFolderSharedLink]`
+ - The settings for the shared link to update.
+- fields `str`
+ - Explicitly request the `shared_link` fields to be returned for this item.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns a basic representation of the folder, with the updated shared
+link attached.
+
+## Remove shared link from folder
+
+Removes a shared link from a folder.
+
+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/).
+
+
+
+```python
+client.shared_links_folders.remove_shared_link_from_folder(
+ folder.id, "shared_link", shared_link=create_null()
+)
+```
+
+### 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[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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns a basic representation of a folder, with the shared link removed.
diff --git a/docs/shared_links_web_links.md b/docs/shared_links_web_links.md
new file mode 100644
index 000000000..e9d58dce4
--- /dev/null
+++ b/docs/shared_links_web_links.md
@@ -0,0 +1,198 @@
+# SharedLinksWebLinksManager
+
+- [Find web link for shared link](#find-web-link-for-shared-link)
+- [Get shared link for web link](#get-shared-link-for-web-link)
+- [Add shared link to web link](#add-shared-link-to-web-link)
+- [Update shared link on web link](#update-shared-link-on-web-link)
+- [Remove shared link from web link](#remove-shared-link-from-web-link)
+
+## Find web link for shared link
+
+Returns the web link represented by a shared link.
+
+A shared web link can be represented by a shared link,
+which can originate within the current enterprise or within another.
+
+This endpoint allows an application to retrieve information about a
+shared web link when only given a shared link.
+
+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/).
+
+
+
+```python
+user_client.shared_links_web_links.find_web_link_for_shared_link(
+ "".join(
+ [
+ "shared_link=",
+ web_link_from_api.shared_link.url,
+ "&shared_link_password=Secret123@",
+ ]
+ )
+)
+```
+
+### Arguments
+
+- 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.
+- if_none_match `Optional[str]`
+ - Ensures an item is only returned if it has changed. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `304 Not Modified` if the item has not changed since.
+- boxapi `str`
+ - A header containing the shared link and optional password for the shared link. The format for this header is as follows: `shared_link=[link]&shared_link_password=[password]`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `WebLink`.
+
+Returns a full web link resource if the shared link is valid and
+the user has access to it.
+
+## Get shared link for web link
+
+Gets the information for a shared link on a web link.
+
+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/).
+
+
+
+```python
+client.shared_links_web_links.get_shared_link_for_web_link(web_link_id, "shared_link")
+```
+
+### Arguments
+
+- web_link_id `str`
+ - The ID of the web link. Example: "12345"
+- fields `str`
+ - Explicitly request the `shared_link` fields to be returned for this item.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `WebLink`.
+
+Returns the base representation of a web link with the
+additional shared link information.
+
+## Add shared link to web link
+
+Adds a shared link to a web link.
+
+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/).
+
+
+
+```python
+client.shared_links_web_links.add_share_link_to_web_link(
+ web_link_id,
+ "shared_link",
+ shared_link=AddShareLinkToWebLinkSharedLink(
+ access=AddShareLinkToWebLinkSharedLinkAccessField.OPEN, password="Secret123@"
+ ),
+)
+```
+
+### Arguments
+
+- web_link_id `str`
+ - The ID of the web link. Example: "12345"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `WebLink`.
+
+Returns the base representation of a web link with a new shared
+link attached.
+
+## Update shared link on web link
+
+Updates a shared link on a web link.
+
+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/).
+
+
+
+```python
+client.shared_links_web_links.update_shared_link_on_web_link(
+ web_link_id,
+ "shared_link",
+ shared_link=UpdateSharedLinkOnWebLinkSharedLink(
+ access=UpdateSharedLinkOnWebLinkSharedLinkAccessField.COLLABORATORS
+ ),
+)
+```
+
+### Arguments
+
+- web_link_id `str`
+ - The ID of the web link. Example: "12345"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `WebLink`.
+
+Returns a basic representation of the web link, with the updated shared
+link attached.
+
+## Remove shared link from web link
+
+Removes a shared link from a web 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/).
+
+
+
+```python
+client.shared_links_web_links.remove_shared_link_from_web_link(
+ web_link_id, "shared_link", shared_link=create_null()
+)
+```
+
+### Arguments
+
+- web_link_id `str`
+ - The ID of the web link. Example: "12345"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `WebLink`.
+
+Returns a basic representation of a web link, with the
+shared link removed.
diff --git a/docs/shield_information_barrier_reports.md b/docs/shield_information_barrier_reports.md
new file mode 100644
index 000000000..f9b7990ed
--- /dev/null
+++ b/docs/shield_information_barrier_reports.md
@@ -0,0 +1,101 @@
+# ShieldInformationBarrierReportsManager
+
+- [List shield information barrier reports](#list-shield-information-barrier-reports)
+- [Create shield information barrier report](#create-shield-information-barrier-report)
+- [Get shield information barrier report by ID](#get-shield-information-barrier-report-by-id)
+
+## List shield information barrier reports
+
+Lists shield information barrier reports.
+
+This operation is performed by calling function `get_shield_information_barrier_reports`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barrier-reports/).
+
+
+
+```python
+client.shield_information_barrier_reports.get_shield_information_barrier_reports(
+ barrier_id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_id `str`
+ - The ID of the shield information barrier.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierReports`.
+
+Returns a paginated list of shield information barrier report objects.
+
+## Create shield information barrier report
+
+Creates a shield information barrier report for a given barrier.
+
+This operation is performed by calling function `create_shield_information_barrier_report`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-shield-information-barrier-reports/).
+
+
+
+```python
+client.shield_information_barrier_reports.create_shield_information_barrier_report(
+ shield_information_barrier=ShieldInformationBarrierBase(
+ id=barrier_id,
+ type=ShieldInformationBarrierBaseTypeField.SHIELD_INFORMATION_BARRIER,
+ )
+)
+```
+
+### Arguments
+
+- shield_information_barrier `Optional[ShieldInformationBarrierBase]`
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierReport`.
+
+Returns the shield information barrier report information object.
+
+## Get shield information barrier report by ID
+
+Retrieves a shield information barrier report by its ID.
+
+This operation is performed by calling function `get_shield_information_barrier_report_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barrier-reports-id/).
+
+
+
+```python
+client.shield_information_barrier_reports.get_shield_information_barrier_report_by_id(
+ created_report.id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_report_id `str`
+ - The ID of the shield information barrier Report. Example: "3423"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierReport`.
+
+Returns the shield information barrier report object.
diff --git a/docs/shield_information_barrier_segment_members.md b/docs/shield_information_barrier_segment_members.md
new file mode 100644
index 000000000..13fa7510b
--- /dev/null
+++ b/docs/shield_information_barrier_segment_members.md
@@ -0,0 +1,144 @@
+# ShieldInformationBarrierSegmentMembersManager
+
+- [Get shield information barrier segment member by ID](#get-shield-information-barrier-segment-member-by-id)
+- [Delete shield information barrier segment member by ID](#delete-shield-information-barrier-segment-member-by-id)
+- [List shield information barrier segment members](#list-shield-information-barrier-segment-members)
+- [Create shield information barrier segment member](#create-shield-information-barrier-segment-member)
+
+## Get shield information barrier segment member by ID
+
+Retrieves a shield information barrier
+segment member by its ID.
+
+This operation is performed by calling function `get_shield_information_barrier_segment_member_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barrier-segment-members-id/).
+
+
+
+```python
+client.shield_information_barrier_segment_members.get_shield_information_barrier_segment_member_by_id(
+ segment_member.id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_member_id `str`
+ - The ID of the shield information barrier segment Member. Example: "7815"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegmentMember`.
+
+Returns the shield information barrier segment member object.
+
+## Delete shield information barrier segment member by ID
+
+Deletes a shield information barrier
+segment member based on provided ID.
+
+This operation is performed by calling function `delete_shield_information_barrier_segment_member_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-shield-information-barrier-segment-members-id/).
+
+
+
+```python
+client.shield_information_barrier_segment_members.delete_shield_information_barrier_segment_member_by_id(
+ segment_member.id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_member_id `str`
+ - The ID of the shield information barrier segment Member. Example: "7815"
+- 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 if the
+segment member was deleted successfully.
+
+## List shield information barrier segment members
+
+Lists shield information barrier segment members
+based on provided segment IDs.
+
+This operation is performed by calling function `get_shield_information_barrier_segment_members`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barrier-segment-members/).
+
+
+
+```python
+client.shield_information_barrier_segment_members.get_shield_information_barrier_segment_members(
+ segment.id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_id `str`
+ - The ID of the shield information barrier segment.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegmentMembers`.
+
+Returns a paginated list of
+shield information barrier segment member objects.
+
+## Create shield information barrier segment member
+
+Creates a new shield information barrier segment member.
+
+This operation is performed by calling function `create_shield_information_barrier_segment_member`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-shield-information-barrier-segment-members/).
+
+
+
+```python
+client.shield_information_barrier_segment_members.create_shield_information_barrier_segment_member(
+ CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegment(
+ id=segment.id,
+ type=CreateShieldInformationBarrierSegmentMemberShieldInformationBarrierSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT,
+ ),
+ UserBase(id=get_env_var("USER_ID")),
+)
+```
+
+### Arguments
+
+- type `Optional[CreateShieldInformationBarrierSegmentMemberType]`
+ - A type of the shield barrier segment member.
+- shield_information_barrier `Optional[ShieldInformationBarrierBase]`
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegmentMember`.
+
+Returns a new shield information barrier segment member object.
diff --git a/docs/shield_information_barrier_segment_restrictions.md b/docs/shield_information_barrier_segment_restrictions.md
new file mode 100644
index 000000000..d18dbbe5b
--- /dev/null
+++ b/docs/shield_information_barrier_segment_restrictions.md
@@ -0,0 +1,150 @@
+# ShieldInformationBarrierSegmentRestrictionsManager
+
+- [Get shield information barrier segment restriction by ID](#get-shield-information-barrier-segment-restriction-by-id)
+- [Delete shield information barrier segment restriction by ID](#delete-shield-information-barrier-segment-restriction-by-id)
+- [List shield information barrier segment restrictions](#list-shield-information-barrier-segment-restrictions)
+- [Create shield information barrier segment restriction](#create-shield-information-barrier-segment-restriction)
+
+## Get shield information barrier segment restriction by ID
+
+Retrieves a shield information barrier segment
+restriction based on provided ID.
+
+This operation is performed by calling function `get_shield_information_barrier_segment_restriction_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barrier-segment-restrictions-id/).
+
+
+
+```python
+client.shield_information_barrier_segment_restrictions.get_shield_information_barrier_segment_restriction_by_id(
+ segment_restriction_id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_restriction_id `str`
+ - The ID of the shield information barrier segment Restriction. Example: "4563"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegmentRestriction`.
+
+Returns the shield information barrier segment
+restriction object.
+
+## Delete shield information barrier segment restriction by ID
+
+Delete shield information barrier segment restriction
+based on provided ID.
+
+This operation is performed by calling function `delete_shield_information_barrier_segment_restriction_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-shield-information-barrier-segment-restrictions-id/).
+
+
+
+```python
+client.shield_information_barrier_segment_restrictions.delete_shield_information_barrier_segment_restriction_by_id(
+ segment_restriction_id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_restriction_id `str`
+ - The ID of the shield information barrier segment Restriction. Example: "4563"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Empty body in response.
+
+## List shield information barrier segment restrictions
+
+Lists shield information barrier segment restrictions
+based on provided segment ID.
+
+This operation is performed by calling function `get_shield_information_barrier_segment_restrictions`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barrier-segment-restrictions/).
+
+
+
+```python
+client.shield_information_barrier_segment_restrictions.get_shield_information_barrier_segment_restrictions(
+ segment_id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_id `str`
+ - The ID of the shield information barrier segment.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegmentRestrictions`.
+
+Returns a paginated list of
+shield information barrier segment restriction objects.
+
+## Create shield information barrier segment restriction
+
+Creates a shield information barrier
+segment restriction object.
+
+This operation is performed by calling function `create_shield_information_barrier_segment_restriction`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-shield-information-barrier-segment-restrictions/).
+
+
+
+```python
+client.shield_information_barrier_segment_restrictions.create_shield_information_barrier_segment_restriction(
+ CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment(
+ id=segment_id,
+ type=CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT,
+ ),
+ CreateShieldInformationBarrierSegmentRestrictionRestrictedSegment(
+ id=segment_to_restrict_id,
+ type=CreateShieldInformationBarrierSegmentRestrictionRestrictedSegmentTypeField.SHIELD_INFORMATION_BARRIER_SEGMENT,
+ ),
+ type=CreateShieldInformationBarrierSegmentRestrictionType.SHIELD_INFORMATION_BARRIER_SEGMENT_RESTRICTION,
+)
+```
+
+### Arguments
+
+- type `CreateShieldInformationBarrierSegmentRestrictionType`
+ - The type of the shield barrier segment restriction for this member.
+- shield_information_barrier `Optional[ShieldInformationBarrierBase]`
+- shield_information_barrier_segment `CreateShieldInformationBarrierSegmentRestrictionShieldInformationBarrierSegment`
+ - The `type` and `id` of the requested shield information barrier segment.
+- 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.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegmentRestriction`.
+
+Returns the newly created Shield
+Information Barrier Segment Restriction object.
diff --git a/docs/shield_information_barrier_segments.md b/docs/shield_information_barrier_segments.md
new file mode 100644
index 000000000..c208101ee
--- /dev/null
+++ b/docs/shield_information_barrier_segments.md
@@ -0,0 +1,175 @@
+# ShieldInformationBarrierSegmentsManager
+
+- [Get shield information barrier segment with specified ID](#get-shield-information-barrier-segment-with-specified-id)
+- [Delete shield information barrier segment](#delete-shield-information-barrier-segment)
+- [Update shield information barrier segment with specified ID](#update-shield-information-barrier-segment-with-specified-id)
+- [List shield information barrier segments](#list-shield-information-barrier-segments)
+- [Create shield information barrier segment](#create-shield-information-barrier-segment)
+
+## Get shield information barrier segment with specified ID
+
+Retrieves shield information barrier segment based on provided ID..
+
+This operation is performed by calling function `get_shield_information_barrier_segment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barrier-segments-id/).
+
+
+
+```python
+client.shield_information_barrier_segments.get_shield_information_barrier_segment_by_id(
+ segment_id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_id `str`
+ - The ID of the shield information barrier segment. Example: "3423"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegment`.
+
+Returns the shield information barrier segment object.
+
+## Delete shield information barrier segment
+
+Deletes the shield information barrier segment
+based on provided ID.
+
+This operation is performed by calling function `delete_shield_information_barrier_segment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-shield-information-barrier-segments-id/).
+
+
+
+```python
+client.shield_information_barrier_segments.delete_shield_information_barrier_segment_by_id(
+ segment_id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_id `str`
+ - The ID of the shield information barrier segment. Example: "3423"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Empty body in response.
+
+## Update shield information barrier segment with specified ID
+
+Updates the shield information barrier segment based on provided ID..
+
+This operation is performed by calling function `update_shield_information_barrier_segment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-shield-information-barrier-segments-id/).
+
+
+
+```python
+client.shield_information_barrier_segments.update_shield_information_barrier_segment_by_id(
+ segment_id, description=updated_segment_description
+)
+```
+
+### Arguments
+
+- shield_information_barrier_segment_id `str`
+ - The ID of the shield information barrier segment. Example: "3423"
+- name `Optional[str]`
+ - The updated name for the shield information barrier segment.
+- description `Optional[str]`
+ - The updated description for the shield information barrier segment.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegment`.
+
+Returns the updated shield information barrier segment object.
+
+## List shield information barrier segments
+
+Retrieves a list of shield information barrier segment objects
+for the specified Information Barrier ID.
+
+This operation is performed by calling function `get_shield_information_barrier_segments`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barrier-segments/).
+
+
+
+```python
+client.shield_information_barrier_segments.get_shield_information_barrier_segments(
+ barrier_id
+)
+```
+
+### Arguments
+
+- shield_information_barrier_id `str`
+ - The ID of the shield information barrier.
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegments`.
+
+Returns a paginated list of shield information barrier segment objects.
+
+## Create shield information barrier segment
+
+Creates a shield information barrier segment.
+
+This operation is performed by calling function `create_shield_information_barrier_segment`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-shield-information-barrier-segments/).
+
+
+
+```python
+client.shield_information_barrier_segments.create_shield_information_barrier_segment(
+ ShieldInformationBarrierBase(
+ id=barrier_id,
+ type=ShieldInformationBarrierBaseTypeField.SHIELD_INFORMATION_BARRIER,
+ ),
+ segment_name,
+ description=segment_description,
+)
+```
+
+### Arguments
+
+- shield_information_barrier `ShieldInformationBarrierBase`
+- name `str`
+ - Name of the shield information barrier segment.
+- description `Optional[str]`
+ - Description of the shield information barrier segment.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrierSegment`.
+
+Returns a new shield information barrier segment object.
diff --git a/docs/shield_information_barriers.md b/docs/shield_information_barriers.md
new file mode 100644
index 000000000..50b3efce8
--- /dev/null
+++ b/docs/shield_information_barriers.md
@@ -0,0 +1,131 @@
+# ShieldInformationBarriersManager
+
+- [Get shield information barrier with specified ID](#get-shield-information-barrier-with-specified-id)
+- [Add changed status of shield information barrier with specified ID](#add-changed-status-of-shield-information-barrier-with-specified-id)
+- [List shield information barriers](#list-shield-information-barriers)
+- [Create shield information barrier](#create-shield-information-barrier)
+
+## Get shield information barrier with specified ID
+
+Get shield information barrier based on provided ID.
+
+This operation is performed by calling function `get_shield_information_barrier_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barriers-id/).
+
+
+
+```python
+client.shield_information_barriers.get_shield_information_barrier_by_id(barrier_id)
+```
+
+### Arguments
+
+- shield_information_barrier_id `str`
+ - The ID of the shield information barrier. Example: "1910967"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrier`.
+
+Returns the shield information barrier object.
+
+## Add changed status of shield information barrier with specified ID
+
+Change status of shield information barrier with the specified ID.
+
+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/).
+
+
+
+```python
+client.shield_information_barriers.update_shield_information_barrier_status(
+ barrier_id, UpdateShieldInformationBarrierStatusStatus.DISABLED
+)
+```
+
+### Arguments
+
+- id `str`
+ - The ID of the shield information barrier.
+- 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.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrier`.
+
+Returns the updated shield information barrier object.
+
+## List shield information barriers
+
+Retrieves a list of shield information barrier objects
+for the enterprise of JWT.
+
+This operation is performed by calling function `get_shield_information_barriers`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-shield-information-barriers/).
+
+
+
+```python
+client.shield_information_barriers.get_shield_information_barriers()
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarriers`.
+
+Returns a paginated list of
+shield information barrier objects,
+empty list if currently no barrier.
+
+## Create shield information barrier
+
+Creates a shield information barrier to
+separate individuals/groups within the same
+firm and prevents confidential information passing between them.
+
+This operation is performed by calling function `create_shield_information_barrier`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-shield-information-barriers/).
+
+
+
+```python
+client.shield_information_barriers.create_shield_information_barrier(
+ EnterpriseBase(id=enterprise_id)
+)
+```
+
+### Arguments
+
+- enterprise `EnterpriseBase`
+ - The `type` and `id` of enterprise this barrier is under.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldInformationBarrier`.
+
+Returns a new shield information barrier object.
diff --git a/docs/shield_lists.md b/docs/shield_lists.md
new file mode 100644
index 000000000..39505cada
--- /dev/null
+++ b/docs/shield_lists.md
@@ -0,0 +1,177 @@
+# ShieldListsManager
+
+- [Get all shield lists in enterprise](#get-all-shield-lists-in-enterprise)
+- [Create shield list](#create-shield-list)
+- [Get single shield list by shield list id](#get-single-shield-list-by-shield-list-id)
+- [Delete single shield list by shield list id](#delete-single-shield-list-by-shield-list-id)
+- [Update shield list](#update-shield-list)
+
+## Get all shield lists in enterprise
+
+Retrieves all shield lists in the enterprise.
+
+This operation is performed by calling function `get_shield_lists_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-shield-lists/).
+
+
+
+```python
+client.shield_lists.get_shield_lists_v2025_r0()
+```
+
+### Arguments
+
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldListsV2025R0`.
+
+Returns the list of shield list objects.
+
+## Create shield list
+
+Creates a shield list.
+
+This operation is performed by calling function `create_shield_list_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/post-shield-lists/).
+
+
+
+```python
+client.shield_lists.create_shield_list_v2025_r0(
+ shield_list_country_name,
+ ShieldListContentCountryV2025R0(
+ type=ShieldListContentCountryV2025R0TypeField.COUNTRY,
+ country_codes=["US", "PL"],
+ ),
+ description="A list of things that are shielded",
+)
+```
+
+### Arguments
+
+- name `str`
+ - The name of the shield list.
+- description `Optional[str]`
+ - Optional description of Shield List.
+- content `ShieldListContentRequestV2025R0`
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldListV2025R0`.
+
+Returns the shield list object.
+
+## Get single shield list by shield list id
+
+Retrieves a single shield list by its ID.
+
+This operation is performed by calling function `get_shield_list_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/get-shield-lists-id/).
+
+
+
+```python
+client.shield_lists.get_shield_list_by_id_v2025_r0(shield_list_country.id)
+```
+
+### Arguments
+
+- shield_list_id `str`
+ - The unique identifier that represents a shield list. The ID for any Shield List can be determined by the response from the endpoint fetching all shield lists for the enterprise. Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 "
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldListV2025R0`.
+
+Returns the shield list object.
+
+## Delete single shield list by shield list id
+
+Delete a single shield list by its ID.
+
+This operation is performed by calling function `delete_shield_list_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/delete-shield-lists-id/).
+
+
+
+```python
+client.shield_lists.delete_shield_list_by_id_v2025_r0(shield_list_country.id)
+```
+
+### Arguments
+
+- shield_list_id `str`
+ - The unique identifier that represents a shield list. The ID for any Shield List can be determined by the response from the endpoint fetching all shield lists for the enterprise. Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 "
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Shield List correctly removed. No content in response.
+
+## Update shield list
+
+Updates a shield list.
+
+This operation is performed by calling function `update_shield_list_by_id_v2025_r0`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/v2025.0/put-shield-lists-id/).
+
+
+
+```python
+client.shield_lists.update_shield_list_by_id_v2025_r0(
+ shield_list_country.id,
+ shield_list_country_name,
+ ShieldListContentCountryV2025R0(
+ type=ShieldListContentCountryV2025R0TypeField.COUNTRY, country_codes=["US"]
+ ),
+ description="Updated description",
+)
+```
+
+### Arguments
+
+- shield_list_id `str`
+ - The unique identifier that represents a shield list. The ID for any Shield List can be determined by the response from the endpoint fetching all shield lists for the enterprise. Example: "90fb0e17-c332-40ed-b4f9-fa8908fbbb24 "
+- name `str`
+ - The name of the shield list.
+- description `Optional[str]`
+ - Optional description of Shield List.
+- content `ShieldListContentRequestV2025R0`
+- box_version `BoxVersionHeaderV2025R0`
+ - Version header.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `ShieldListV2025R0`.
+
+Returns the shield list object.
diff --git a/docs/sign_requests.md b/docs/sign_requests.md
new file mode 100644
index 000000000..bee346654
--- /dev/null
+++ b/docs/sign_requests.md
@@ -0,0 +1,214 @@
+# SignRequestsManager
+
+- [Cancel Box Sign request](#cancel-box-sign-request)
+- [Resend Box Sign request](#resend-box-sign-request)
+- [Get Box Sign request by ID](#get-box-sign-request-by-id)
+- [List Box Sign requests](#list-box-sign-requests)
+- [Create Box Sign request](#create-box-sign-request)
+
+## Cancel Box Sign request
+
+Cancels a sign request.
+
+This operation is performed by calling function `cancel_sign_request`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-sign-requests-id-cancel/).
+
+
+
+```python
+client.sign_requests.cancel_sign_request(created_sign_request.id)
+```
+
+### Arguments
+
+- sign_request_id `str`
+ - The ID of the signature request. Example: "33243242"
+- 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 `SignRequest`.
+
+Returns a Sign Request object.
+
+## Resend Box Sign request
+
+Resends a signature request email to all outstanding signers.
+
+This operation is performed by calling function `resend_sign_request`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-sign-requests-id-resend/).
+
+_Currently we don't have an example for calling `resend_sign_request` in integration tests_
+
+### Arguments
+
+- sign_request_id `str`
+ - The ID of the signature request. Example: "33243242"
+- 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 API call was successful.
+The email notifications will be sent asynchronously.
+
+## Get Box Sign request by ID
+
+Gets a sign request by ID.
+
+This operation is performed by calling function `get_sign_request_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-sign-requests-id/).
+
+
+
+```python
+client.sign_requests.get_sign_request_by_id(created_sign_request.id)
+```
+
+### Arguments
+
+- sign_request_id `str`
+ - The ID of the signature request. Example: "33243242"
+- 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 `SignRequest`.
+
+Returns a signature request.
+
+## List Box Sign requests
+
+Gets signature requests created by a user. If the `sign_files` and/or
+`parent_folder` are deleted, the signature request will not return in the list.
+
+This operation is performed by calling function `get_sign_requests`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-sign-requests/).
+
+
+
+```python
+client.sign_requests.get_sign_requests()
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- senders `Optional[List[str]]`
+ - A list of sender emails to filter the signature requests by sender. If provided, `shared_requests` must be set to `true`.
+- shared_requests `Optional[bool]`
+ - If set to `true`, only includes requests that user is not an owner, but user is a collaborator. Collaborator access is determined by the user access level of the sign files of the request. Default is `false`. Must be set to `true` if `senders` are provided.
+- 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 `SignRequests`.
+
+Returns a collection of sign requests.
+
+## Create Box Sign request
+
+Creates a signature request. This involves preparing a document for signing and
+sending the signature request to signers.
+
+This operation is performed by calling function `create_sign_request`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-sign-requests/).
+
+
+
+```python
+client.sign_requests.create_sign_request(
+ [
+ SignRequestCreateSigner(
+ email=signer_email,
+ suppress_notifications=True,
+ declined_redirect_url="https://www.box.com",
+ embed_url_external_user_id="123",
+ is_in_person=False,
+ login_required=False,
+ password="password",
+ role=SignRequestCreateSignerRoleField.SIGNER,
+ )
+ ],
+ source_files=[FileBase(id=file_to_sign.id)],
+ parent_folder=FolderMini(id=destination_folder.id),
+ is_document_preparation_needed=False,
+ redirect_url="https://www.box.com",
+ declined_redirect_url="https://www.box.com",
+ are_text_signatures_enabled=True,
+ email_subject="Sign this document",
+ email_message="Please sign this document",
+ are_reminders_enabled=True,
+ name="Sign Request",
+ prefill_tags=[
+ SignRequestPrefillTag(
+ date_value=date_from_string("2035-01-01"), document_tag_id="0"
+ )
+ ],
+ days_valid=30,
+ external_id="123",
+ external_system_name="BoxSignIntegration",
+)
+```
+
+### Arguments
+
+- source_files `Optional[List[FileBase]]`
+ - 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.
+- signature_color `Optional[CreateSignRequestSignatureColor]`
+ - Force a specific color for the signature (blue, black, or red).
+- signers `List[SignRequestCreateSigner]`
+ - Array of signers for the signature request. 35 is the max number of signers permitted. **Note**: It may happen that some signers belong to conflicting [segments](r://shield-information-barrier-segment-member) (user groups). This means that due to the security policies, users are assigned to segments to prevent exchanges or communication that could lead to ethical conflicts. In such a case, an attempt to send the sign request will result in an error. Read more about [segments and ethical walls](https://support.box.com/hc/en-us/articles/9920431507603-Understanding-Information-Barriers#h_01GFVJEHQA06N7XEZ4GCZ9GFAQ).
+- parent_folder `Optional[FolderMini]`
+- is_document_preparation_needed `Optional[bool]`
+ - Indicates if the sender should receive a `prepare_url` in the response to complete document preparation using the UI.
+- redirect_url `Optional[str]`
+ - When specified, the signature request will be redirected to this url when a document is signed.
+- declined_redirect_url `Optional[str]`
+ - The uri that a signer will be redirected to after declining to sign a document.
+- are_text_signatures_enabled `Optional[bool]`
+ - Disables the usage of signatures generated by typing (text).
+- email_subject `Optional[str]`
+ - Subject of sign request email. This is cleaned by sign request. If this field is not passed, a default subject will be used.
+- email_message `Optional[str]`
+ - Message to include in sign request email. The field is cleaned through sanitization of specific characters. However, some html tags are allowed. Links included in the message are also converted to hyperlinks in the email. The message may contain the following html tags including `a`, `abbr`, `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and `strong`. Be aware that when the text to html ratio is too high, the email may end up in spam filters. Custom styles on these tags are not allowed. If this field is not passed, a default message will be used.
+- are_reminders_enabled `Optional[bool]`
+ - Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to outstanding signers.
+- name `Optional[str]`
+ - Name of the signature request.
+- prefill_tags `Optional[List[SignRequestPrefillTag]]`
+ - When a document contains sign-related tags in the content, you can prefill them using this `prefill_tags` by referencing the 'id' of the tag as the `external_id` field of the prefill tag.
+- days_valid `Optional[int]`
+ - Set the number of days after which the created signature request will automatically expire if not completed. By default, we do not apply any expiration date on signature requests, and the signature request does not expire.
+- external_id `Optional[str]`
+ - This can be used to reference an ID in an external system that the sign request is related to.
+- template_id `Optional[str]`
+ - When a signature request is created from a template this field will indicate the id of that template.
+- external_system_name `Optional[str]`
+ - Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `SignRequest`.
+
+Returns a Box Sign request object.
diff --git a/docs/sign_templates.md b/docs/sign_templates.md
new file mode 100644
index 000000000..c9c6bfa19
--- /dev/null
+++ b/docs/sign_templates.md
@@ -0,0 +1,62 @@
+# SignTemplatesManager
+
+- [List Box Sign templates](#list-box-sign-templates)
+- [Get Box Sign template by ID](#get-box-sign-template-by-id)
+
+## List Box Sign templates
+
+Gets Box Sign templates created by a user.
+
+This operation is performed by calling function `get_sign_templates`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-sign-templates/).
+
+
+
+```python
+client.sign_templates.get_sign_templates(limit=2)
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `SignTemplates`.
+
+Returns a collection of templates.
+
+## Get Box Sign template by ID
+
+Fetches details of a specific Box Sign template.
+
+This operation is performed by calling function `get_sign_template_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-sign-templates-id/).
+
+
+
+```python
+client.sign_templates.get_sign_template_by_id(sign_templates.entries[0].id)
+```
+
+### Arguments
+
+- template_id `str`
+ - The ID of a Box Sign template. Example: "123075213-7d117509-8f05-42e4-a5ef-5190a319d41d"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `SignTemplate`.
+
+Returns details of a template.
diff --git a/docs/skills.md b/docs/skills.md
new file mode 100644
index 000000000..1c15dbe9b
--- /dev/null
+++ b/docs/skills.md
@@ -0,0 +1,173 @@
+# SkillsManager
+
+- [List Box Skill cards on file](#list-box-skill-cards-on-file)
+- [Create Box Skill cards on file](#create-box-skill-cards-on-file)
+- [Update Box Skill cards on file](#update-box-skill-cards-on-file)
+- [Remove Box Skill cards from file](#remove-box-skill-cards-from-file)
+- [Update all Box Skill cards on file](#update-all-box-skill-cards-on-file)
+
+## List Box Skill cards on file
+
+List the Box Skills metadata cards that are attached to a file.
+
+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-boxSkillsCards/).
+
+
+
+```python
+client.skills.get_box_skill_cards_on_file(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `SkillCardsMetadata`.
+
+Returns all the metadata associated with a file.
+
+This API does not support pagination and will therefore always return
+all of the metadata associated to the file.
+
+## Create Box Skill cards on file
+
+Applies one or more Box Skills metadata cards to a file.
+
+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-boxSkillsCards/).
+
+
+
+```python
+client.skills.create_box_skill_cards_on_file(file.id, cards_to_create)
+```
+
+### 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"
+- cards `List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]`
+ - A list of Box Skill cards to apply to this file.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `SkillCardsMetadata`.
+
+Returns the instance of the template that was applied to the file,
+including the data that was applied to the template.
+
+## Update Box Skill cards on file
+
+Updates one or more Box Skills metadata cards to a file.
+
+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-boxSkillsCards/).
+
+
+
+```python
+client.skills.update_box_skill_cards_on_file(
+ file.id,
+ [
+ UpdateBoxSkillCardsOnFileRequestBody(
+ op=UpdateBoxSkillCardsOnFileRequestBodyOpField.REPLACE,
+ path="/cards/0",
+ value=card_to_update,
+ )
+ ],
+)
+```
+
+### 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[UpdateBoxSkillCardsOnFileRequestBody]`
+ - Request body of updateBoxSkillCardsOnFile method
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `SkillCardsMetadata`.
+
+Returns the updated metadata template, with the
+custom template data included.
+
+## Remove Box Skill cards from file
+
+Removes any Box Skills cards metadata from a file.
+
+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-boxSkillsCards/).
+
+
+
+```python
+client.skills.delete_box_skill_cards_from_file(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- 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 cards are
+successfully deleted.
+
+## Update all Box Skill cards on file
+
+An alternative method that can be used to overwrite and update all Box Skill
+metadata cards on a file.
+
+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_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 `UpdateAllSkillCardsOnFileStatus`
+ - Defines the status of this invocation. Set this to `success` when setting Skill cards.
+- 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 `UpdateAllSkillCardsOnFileFile`
+ - The file to assign the cards to.
+- file_version `Optional[UpdateAllSkillCardsOnFileFileVersion]`
+ - The optional file version to assign the cards to.
+- 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.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the card has been successfully updated.
diff --git a/docs/source/boxsdk.auth.rst b/docs/source/boxsdk.auth.rst
deleted file mode 100644
index bba00b889..000000000
--- a/docs/source/boxsdk.auth.rst
+++ /dev/null
@@ -1,85 +0,0 @@
-boxsdk.auth package
-===================
-
-Submodules
-----------
-
-boxsdk.auth.ccg\_auth module
-----------------------------
-
-.. automodule:: boxsdk.auth.ccg_auth
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.auth.cooperatively\_managed\_oauth2 module
--------------------------------------------------
-
-.. automodule:: boxsdk.auth.cooperatively_managed_oauth2
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.auth.developer\_token\_auth module
------------------------------------------
-
-.. automodule:: boxsdk.auth.developer_token_auth
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.auth.jwt\_auth module
-----------------------------
-
-.. automodule:: boxsdk.auth.jwt_auth
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.auth.oauth2 module
--------------------------
-
-.. automodule:: boxsdk.auth.oauth2
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.auth.redis\_managed\_jwt\_auth module
---------------------------------------------
-
-.. automodule:: boxsdk.auth.redis_managed_jwt_auth
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.auth.redis\_managed\_oauth2 module
------------------------------------------
-
-.. automodule:: boxsdk.auth.redis_managed_oauth2
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.auth.remote\_managed\_oauth2 module
-------------------------------------------
-
-.. automodule:: boxsdk.auth.remote_managed_oauth2
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.auth.server\_auth module
--------------------------------
-
-.. automodule:: boxsdk.auth.server_auth
- :members:
- :undoc-members:
- :show-inheritance:
-
-Module contents
----------------
-
-.. automodule:: boxsdk.auth
- :members:
- :undoc-members:
- :show-inheritance:
diff --git a/docs/source/boxsdk.client.rst b/docs/source/boxsdk.client.rst
deleted file mode 100644
index f4028ab6d..000000000
--- a/docs/source/boxsdk.client.rst
+++ /dev/null
@@ -1,45 +0,0 @@
-boxsdk.client package
-=====================
-
-Submodules
-----------
-
-boxsdk.client.client module
----------------------------
-
-.. automodule:: boxsdk.client.client
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.client.developer\_token\_client module
----------------------------------------------
-
-.. automodule:: boxsdk.client.developer_token_client
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.client.development\_client module
-----------------------------------------
-
-.. automodule:: boxsdk.client.development_client
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.client.logging\_client module
-------------------------------------
-
-.. automodule:: boxsdk.client.logging_client
- :members:
- :undoc-members:
- :show-inheritance:
-
-Module contents
----------------
-
-.. automodule:: boxsdk.client
- :members:
- :undoc-members:
- :show-inheritance:
diff --git a/docs/source/boxsdk.network.rst b/docs/source/boxsdk.network.rst
deleted file mode 100644
index bb38e8b7a..000000000
--- a/docs/source/boxsdk.network.rst
+++ /dev/null
@@ -1,29 +0,0 @@
-boxsdk.network package
-======================
-
-Submodules
-----------
-
-boxsdk.network.default\_network module
---------------------------------------
-
-.. automodule:: boxsdk.network.default_network
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.network.network\_interface module
-----------------------------------------
-
-.. automodule:: boxsdk.network.network_interface
- :members:
- :undoc-members:
- :show-inheritance:
-
-Module contents
----------------
-
-.. automodule:: boxsdk.network
- :members:
- :undoc-members:
- :show-inheritance:
diff --git a/docs/source/boxsdk.object.rst b/docs/source/boxsdk.object.rst
deleted file mode 100644
index 142a6994f..000000000
--- a/docs/source/boxsdk.object.rst
+++ /dev/null
@@ -1,421 +0,0 @@
-boxsdk.object package
-=====================
-
-Submodules
-----------
-
-boxsdk.object.api\_json\_object module
---------------------------------------
-
-.. automodule:: boxsdk.object.api_json_object
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.base\_api\_json\_object module
---------------------------------------------
-
-.. automodule:: boxsdk.object.base_api_json_object
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.base\_endpoint module
------------------------------------
-
-.. automodule:: boxsdk.object.base_endpoint
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.base\_item module
--------------------------------
-
-.. automodule:: boxsdk.object.base_item
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.base\_object module
----------------------------------
-
-.. automodule:: boxsdk.object.base_object
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.cloneable module
-------------------------------
-
-.. automodule:: boxsdk.object.cloneable
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.collaboration module
-----------------------------------
-
-.. automodule:: boxsdk.object.collaboration
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.collaboration\_allowlist module
----------------------------------------------
-
-.. automodule:: boxsdk.object.collaboration_allowlist
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.collaboration\_allowlist\_entry module
-----------------------------------------------------
-
-.. automodule:: boxsdk.object.collaboration_allowlist_entry
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.collaboration\_allowlist\_exempt\_target module
--------------------------------------------------------------
-
-.. automodule:: boxsdk.object.collaboration_allowlist_exempt_target
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.collection module
--------------------------------
-
-.. automodule:: boxsdk.object.collection
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.comment module
-----------------------------
-
-.. automodule:: boxsdk.object.comment
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.device\_pinner module
------------------------------------
-
-.. automodule:: boxsdk.object.device_pinner
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.email\_alias module
----------------------------------
-
-.. automodule:: boxsdk.object.email_alias
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.enterprise module
--------------------------------
-
-.. automodule:: boxsdk.object.enterprise
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.event module
---------------------------
-
-.. automodule:: boxsdk.object.event
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.events module
----------------------------
-
-.. automodule:: boxsdk.object.events
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.file module
--------------------------
-
-.. automodule:: boxsdk.object.file
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.file\_request module
-----------------------------------
-
-.. automodule:: boxsdk.object.file_request
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.file\_version module
-----------------------------------
-
-.. automodule:: boxsdk.object.file_version
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.file\_version\_retention module
----------------------------------------------
-
-.. automodule:: boxsdk.object.file_version_retention
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.folder module
----------------------------
-
-.. automodule:: boxsdk.object.folder
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.folder\_lock module
----------------------------------
-
-.. automodule:: boxsdk.object.folder_lock
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.group module
---------------------------
-
-.. automodule:: boxsdk.object.group
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.group\_membership module
---------------------------------------
-
-.. automodule:: boxsdk.object.group_membership
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.invite module
----------------------------
-
-.. automodule:: boxsdk.object.invite
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.item module
--------------------------
-
-.. automodule:: boxsdk.object.item
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.legal\_hold module
---------------------------------
-
-.. automodule:: boxsdk.object.legal_hold
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.legal\_hold\_policy module
-----------------------------------------
-
-.. automodule:: boxsdk.object.legal_hold_policy
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.legal\_hold\_policy\_assignment module
-----------------------------------------------------
-
-.. automodule:: boxsdk.object.legal_hold_policy_assignment
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.metadata module
------------------------------
-
-.. automodule:: boxsdk.object.metadata
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.metadata\_cascade\_policy module
-----------------------------------------------
-
-.. automodule:: boxsdk.object.metadata_cascade_policy
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.metadata\_template module
----------------------------------------
-
-.. automodule:: boxsdk.object.metadata_template
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.recent\_item module
----------------------------------
-
-.. automodule:: boxsdk.object.recent_item
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.retention\_policy module
---------------------------------------
-
-.. automodule:: boxsdk.object.retention_policy
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.retention\_policy\_assignment module
---------------------------------------------------
-
-.. automodule:: boxsdk.object.retention_policy_assignment
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.search module
----------------------------
-
-.. automodule:: boxsdk.object.search
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.sign\_request module
-----------------------------------
-
-.. automodule:: boxsdk.object.sign_request
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.sign\_template module
------------------------------------
-
-.. automodule:: boxsdk.object.sign_template
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.storage\_policy module
-------------------------------------
-
-.. automodule:: boxsdk.object.storage_policy
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.storage\_policy\_assignment module
-------------------------------------------------
-
-.. automodule:: boxsdk.object.storage_policy_assignment
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.task module
--------------------------
-
-.. automodule:: boxsdk.object.task
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.task\_assignment module
--------------------------------------
-
-.. automodule:: boxsdk.object.task_assignment
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.terms\_of\_service module
----------------------------------------
-
-.. automodule:: boxsdk.object.terms_of_service
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.terms\_of\_service\_user\_status module
------------------------------------------------------
-
-.. automodule:: boxsdk.object.terms_of_service_user_status
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.trash module
---------------------------
-
-.. automodule:: boxsdk.object.trash
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.upload\_session module
-------------------------------------
-
-.. automodule:: boxsdk.object.upload_session
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.user module
--------------------------
-
-.. automodule:: boxsdk.object.user
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.watermark module
-------------------------------
-
-.. automodule:: boxsdk.object.watermark
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.web\_link module
-------------------------------
-
-.. automodule:: boxsdk.object.web_link
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.object.webhook module
-----------------------------
-
-.. automodule:: boxsdk.object.webhook
- :members:
- :undoc-members:
- :show-inheritance:
-
-Module contents
----------------
-
-.. automodule:: boxsdk.object
- :members:
- :undoc-members:
- :show-inheritance:
diff --git a/docs/source/boxsdk.pagination.rst b/docs/source/boxsdk.pagination.rst
deleted file mode 100644
index 342ff3837..000000000
--- a/docs/source/boxsdk.pagination.rst
+++ /dev/null
@@ -1,69 +0,0 @@
-boxsdk.pagination package
-=========================
-
-Submodules
-----------
-
-boxsdk.pagination.box\_object\_collection module
-------------------------------------------------
-
-.. automodule:: boxsdk.pagination.box_object_collection
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.pagination.dict\_page module
------------------------------------
-
-.. automodule:: boxsdk.pagination.dict_page
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.pagination.limit\_offset\_based\_dict\_collection module
----------------------------------------------------------------
-
-.. automodule:: boxsdk.pagination.limit_offset_based_dict_collection
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.pagination.limit\_offset\_based\_object\_collection module
------------------------------------------------------------------
-
-.. automodule:: boxsdk.pagination.limit_offset_based_object_collection
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.pagination.marker\_based\_dict\_collection module
---------------------------------------------------------
-
-.. automodule:: boxsdk.pagination.marker_based_dict_collection
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.pagination.marker\_based\_object\_collection module
-----------------------------------------------------------
-
-.. automodule:: boxsdk.pagination.marker_based_object_collection
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.pagination.page module
------------------------------
-
-.. automodule:: boxsdk.pagination.page
- :members:
- :undoc-members:
- :show-inheritance:
-
-Module contents
----------------
-
-.. automodule:: boxsdk.pagination
- :members:
- :undoc-members:
- :show-inheritance:
diff --git a/docs/source/boxsdk.rst b/docs/source/boxsdk.rst
deleted file mode 100644
index ba153803a..000000000
--- a/docs/source/boxsdk.rst
+++ /dev/null
@@ -1,51 +0,0 @@
-boxsdk package
-==============
-
-Subpackages
------------
-
-.. toctree::
- :maxdepth: 4
-
- boxsdk.auth
- boxsdk.client
- boxsdk.network
- boxsdk.object
- boxsdk.pagination
- boxsdk.session
- boxsdk.util
-
-Submodules
-----------
-
-boxsdk.config module
---------------------
-
-.. automodule:: boxsdk.config
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.exception module
------------------------
-
-.. automodule:: boxsdk.exception
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.version module
----------------------
-
-.. automodule:: boxsdk.version
- :members:
- :undoc-members:
- :show-inheritance:
-
-Module contents
----------------
-
-.. automodule:: boxsdk
- :members:
- :undoc-members:
- :show-inheritance:
diff --git a/docs/source/boxsdk.session.rst b/docs/source/boxsdk.session.rst
deleted file mode 100644
index 798187638..000000000
--- a/docs/source/boxsdk.session.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-boxsdk.session package
-======================
-
-Submodules
-----------
-
-boxsdk.session.box\_request module
-----------------------------------
-
-.. automodule:: boxsdk.session.box_request
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.session.box\_response module
------------------------------------
-
-.. automodule:: boxsdk.session.box_response
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.session.session module
------------------------------
-
-.. automodule:: boxsdk.session.session
- :members:
- :undoc-members:
- :show-inheritance:
-
-Module contents
----------------
-
-.. automodule:: boxsdk.session
- :members:
- :undoc-members:
- :show-inheritance:
diff --git a/docs/source/boxsdk.util.rst b/docs/source/boxsdk.util.rst
deleted file mode 100644
index 46c84a538..000000000
--- a/docs/source/boxsdk.util.rst
+++ /dev/null
@@ -1,117 +0,0 @@
-boxsdk.util package
-===================
-
-Submodules
-----------
-
-boxsdk.util.api\_call\_decorator module
----------------------------------------
-
-.. automodule:: boxsdk.util.api_call_decorator
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.chunked\_uploader module
-------------------------------------
-
-.. automodule:: boxsdk.util.chunked_uploader
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.datetime\_formatter module
---------------------------------------
-
-.. automodule:: boxsdk.util.datetime_formatter
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.default\_arg\_value module
---------------------------------------
-
-.. automodule:: boxsdk.util.default_arg_value
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.deprecation\_decorator module
------------------------------------------
-
-.. automodule:: boxsdk.util.deprecation_decorator
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.enum module
------------------------
-
-.. automodule:: boxsdk.util.enum
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.json module
------------------------
-
-.. automodule:: boxsdk.util.json
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.log module
-----------------------
-
-.. automodule:: boxsdk.util.log
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.lru\_cache module
------------------------------
-
-.. automodule:: boxsdk.util.lru_cache
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.multipart\_stream module
-------------------------------------
-
-.. automodule:: boxsdk.util.multipart_stream
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.shared\_link module
--------------------------------
-
-.. automodule:: boxsdk.util.shared_link
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.text\_enum module
------------------------------
-
-.. automodule:: boxsdk.util.text_enum
- :members:
- :undoc-members:
- :show-inheritance:
-
-boxsdk.util.translator module
------------------------------
-
-.. automodule:: boxsdk.util.translator
- :members:
- :undoc-members:
- :show-inheritance:
-
-Module contents
----------------
-
-.. automodule:: boxsdk.util
- :members:
- :undoc-members:
- :show-inheritance:
diff --git a/docs/source/conf.py b/docs/source/conf.py
deleted file mode 100644
index c2db4faae..000000000
--- a/docs/source/conf.py
+++ /dev/null
@@ -1,353 +0,0 @@
-#
-# boxsdk documentation build configuration file, created by
-# sphinx-quickstart on Tue Dec 16 01:10:30 2014.
-#
-# This file is execfile()d with the current directory set to its
-# containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-import sys
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
-
-# -- General configuration ------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
-extensions = [
- 'sphinx.ext.autodoc',
- 'sphinx.ext.viewcode',
-]
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The main toctree document.
-main_doc = 'index'
-
-# General information about the project.
-project = 'boxsdk'
-copyright = '2014, Box'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-import pkg_resources
-try:
- release = pkg_resources.get_distribution('boxsdk').version
-except pkg_resources.DistributionNotFound:
- print('To build the documentation, The distribution information of boxsdk')
- print('Has to be available. Either install the package into your')
- print('development environment or run "setup.py develop" to setup the')
- print('metadata. A virtualenv is recommended!')
- sys.exit(1)
-del pkg_resources
-
-version = '.'.join(release.split('.')[:2])
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set "language" from the command line for these cases.
-language = 'en'
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-exclude_patterns = ['_build']
-
-# The reST default role (used for this markup: `text`) to use for all
-# documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-# If true, keep warnings as "system message" paragraphs in the built documents.
-#keep_warnings = False
-
-
-# -- Options for HTML output ----------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-html_theme = 'nature'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# " v documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# Add any extra paths that contain custom files (such as robots.txt or
-# .htaccess) here, relative to this directory. These files are copied
-# directly to the root of the documentation.
-#html_extra_path = []
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_domain_indices = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
-
-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
-
-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
-
-# Language to be used for generating the HTML full-text search index.
-# Sphinx supports the following languages:
-# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
-# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
-#html_search_language = 'en'
-
-# A dictionary with options for the search language support, empty by default.
-# Now only 'ja' uses this config value
-#html_search_options = {'type': 'default'}
-
-# The name of a javascript file (relative to the configuration directory) that
-# implements a search results scorer. If empty, the default will be used.
-#html_search_scorer = 'scorer.js'
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'boxsdkdoc'
-
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
-
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
-
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
-
-# Latex figure (float) alignment
-#'figure_align': 'htbp',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
-latex_documents = [
- ('index', 'boxsdk.tex', 'boxsdk Documentation',
- 'Author', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# If true, show page references after internal links.
-#latex_show_pagerefs = False
-
-# If true, show URL addresses after external links.
-#latex_show_urls = False
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_domain_indices = True
-
-
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- ('index', 'boxsdk', 'boxsdk Documentation',
- ['Author'], 1)
-]
-
-# If true, show URL addresses after external links.
-#man_show_urls = False
-
-
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- ('index', 'boxsdk', 'boxsdk Documentation',
- 'Author', 'boxsdk', 'One line description of project.',
- 'Miscellaneous'),
-]
-
-# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
-
-# If false, no module index is generated.
-#texinfo_domain_indices = True
-
-# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
-
-# If true, do not generate a @detailmenu in the "Top" node's menu.
-#texinfo_no_detailmenu = False
-
-
-# -- Options for Epub output ----------------------------------------------
-
-# Bibliographic Dublin Core info.
-epub_title = 'boxsdk'
-epub_author = 'Author'
-epub_publisher = 'Author'
-epub_copyright = '2014, Author'
-
-# The basename for the epub file. It defaults to the project name.
-#epub_basename = u'boxsdk'
-
-# The HTML theme for the epub output. Since the default themes are not optimized
-# for small screen space, using the same theme for HTML and epub output is
-# usually not wise. This defaults to 'epub', a theme designed to save visual
-# space.
-#epub_theme = 'epub'
-
-# The language of the text. It defaults to the language option
-# or 'en' if the language is not set.
-#epub_language = ''
-
-# The scheme of the identifier. Typical schemes are ISBN or URL.
-#epub_scheme = ''
-
-# The unique identifier of the text. This can be a ISBN number
-# or the project homepage.
-#epub_identifier = ''
-
-# A unique identification for the text.
-#epub_uid = ''
-
-# A tuple containing the cover image and cover page html template filenames.
-#epub_cover = ()
-
-# A sequence of (type, uri, title) tuples for the guide element of content.opf.
-#epub_guide = ()
-
-# HTML files that should be inserted before the pages created by sphinx.
-# The format is a list of tuples containing the path and title.
-#epub_pre_files = []
-
-# HTML files shat should be inserted after the pages created by sphinx.
-# The format is a list of tuples containing the path and title.
-#epub_post_files = []
-
-# A list of files that should not be packed into the epub file.
-epub_exclude_files = ['search.html']
-
-# The depth of the table of contents in toc.ncx.
-#epub_tocdepth = 3
-
-# Allow duplicate toc entries.
-#epub_tocdup = True
-
-# Choose between 'default' and 'includehidden'.
-#epub_tocscope = 'default'
-
-# Fix unsupported image types using the Pillow.
-#epub_fix_images = False
-
-# Scale large images.
-#epub_max_image_width = 0
-
-# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#epub_show_urls = 'inline'
-
-# If false, no index is generated.
-#epub_use_index = True
diff --git a/docs/source/index.rst b/docs/source/index.rst
deleted file mode 100644
index 987777f91..000000000
--- a/docs/source/index.rst
+++ /dev/null
@@ -1,106 +0,0 @@
-.. boxsdk documentation main file, created by
- sphinx-quickstart on Tue Dec 16 01:10:30 2014.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-Box Python SDK
-==============
-
-
-Installing
-----------
-
-.. code-block:: console
-
- pip install boxsdk
-
-
-Source Code
------------
-
-https://github.com/box/box-python-sdk
-
-
-Quickstart
-----------
-
-Create a developer token from your app's configuration page (https://app.box.com/developers/services).
-
-You'll be prompted for it on the command line.
-
-.. code-block:: pycon
-
- $ from boxsdk import DevelopmentClient
- $ client = DevelopmentClient()
- >>> Enter developer token:
- $ me = client.user().get()
-
- GET https://api.box.com/2.0/users/me {'headers': {u'Authorization': u'Bearer ----KkeV',
- u'User-Agent': u'box-python-sdk-1.4.3'},
- 'params': None}
-
- {"type":"user","id":"----6009","name":"Jeffrey Meadows","login":"jmeadows@box.com",...}
-
- $ me.name
- >>> Jeffrey Meadows
-
-The ``DevelopmentClient`` uses Box developer tokens for auth (and will prompt you for a new token upon
-expiration), and logs API requests and responses, making it really easy to get started learning the SDK and Box API.
-
-
-Creating an App for Users
--------------------------
-
-Authorization
-~~~~~~~~~~~~~
-
-If you'd like other users to use your app, you need to set up a way for them to authorize your app and
-grant it access to their Box account. The ``auth`` module contains several classes to help you do that.
-
-The simplest class is the ``OAuth2`` class. To use it, instantiate it with your ``client_id`` and ``client_secret``.
-
-Follow the `tutorial on GitHub `_ for
-instructions on how to get an authorized client for a user. Using the ``store_tokens`` callback, you may persist
-the user's auth and refresh tokens for the next time they use your app. Once they return to your app, you can
-create an authorized client like so:
-
-.. code-block:: python
-
- from boxsdk import OAuth2, Client
-
- oauth = OAuth2(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- store_tokens=your_store_tokens_callback_method,
- access_token=persisted_access_token,
- refresh_token=persisted_refresh_token,
- )
- client = Client(oauth)
-
-
-Making requests to Box
-~~~~~~~~~~~~~~~~~~~~~~
-
-Once you have an authorized client, you can use it to make requests to Box on your user's behalf. The client
-has several methods to help you get started, many of which return Box objects, which, in turn, have methods that
-correspond to Box API endpoints.
-
-The module documentation below describes each of these methods and which parameters they require. Some API endpoints
-do not have corresponding SDK methods; for those, you can use the generic ``make_request`` method of the client.
-
-Module Documentation
---------------------
-
-.. toctree::
- :maxdepth: 4
-
- boxsdk
-
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
diff --git a/docs/source/modules.rst b/docs/source/modules.rst
deleted file mode 100644
index 989c0d560..000000000
--- a/docs/source/modules.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-boxsdk
-======
-
-.. toctree::
- :maxdepth: 4
-
- boxsdk
diff --git a/docs/storage_policies.md b/docs/storage_policies.md
new file mode 100644
index 000000000..f28f7d1b2
--- /dev/null
+++ b/docs/storage_policies.md
@@ -0,0 +1,64 @@
+# StoragePoliciesManager
+
+- [List storage policies](#list-storage-policies)
+- [Get storage policy](#get-storage-policy)
+
+## List storage policies
+
+Fetches all the storage policies in the enterprise.
+
+This operation is performed by calling function `get_storage_policies`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-storage-policies/).
+
+
+
+```python
+client.storage_policies.get_storage_policies()
+```
+
+### Arguments
+
+- 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.
+- 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`.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `StoragePolicies`.
+
+Returns a collection of storage policies.
+
+## Get storage policy
+
+Fetches a specific storage policy.
+
+This operation is performed by calling function `get_storage_policy_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-storage-policies-id/).
+
+
+
+```python
+client.storage_policies.get_storage_policy_by_id(storage_policy.id)
+```
+
+### Arguments
+
+- storage_policy_id `str`
+ - The ID of the storage policy. Example: "34342"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `StoragePolicy`.
+
+Returns a storage policy object.
diff --git a/docs/storage_policy_assignments.md b/docs/storage_policy_assignments.md
new file mode 100644
index 000000000..187dd3c59
--- /dev/null
+++ b/docs/storage_policy_assignments.md
@@ -0,0 +1,178 @@
+# StoragePolicyAssignmentsManager
+
+- [List storage policy assignments](#list-storage-policy-assignments)
+- [Assign storage policy](#assign-storage-policy)
+- [Get storage policy assignment](#get-storage-policy-assignment)
+- [Update storage policy assignment](#update-storage-policy-assignment)
+- [Unassign storage policy](#unassign-storage-policy)
+
+## List storage policy assignments
+
+Fetches all the storage policy assignment for an enterprise or user.
+
+This operation is performed by calling function `get_storage_policy_assignments`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-storage-policy-assignments/).
+
+
+
+```python
+client.storage_policy_assignments.get_storage_policy_assignments(
+ GetStoragePolicyAssignmentsResolvedForType.USER, user_id
+)
+```
+
+### Arguments
+
+- marker `Optional[str]`
+ - Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `StoragePolicyAssignments`.
+
+Returns a collection of storage policies for
+the enterprise or user.
+
+## Assign storage policy
+
+Creates a storage policy assignment for an enterprise or user.
+
+This operation is performed by calling function `create_storage_policy_assignment`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-storage-policy-assignments/).
+
+
+
+```python
+client.storage_policy_assignments.create_storage_policy_assignment(
+ CreateStoragePolicyAssignmentStoragePolicy(id=policy_id),
+ CreateStoragePolicyAssignmentAssignedTo(
+ id=user_id, type=CreateStoragePolicyAssignmentAssignedToTypeField.USER
+ ),
+)
+```
+
+### Arguments
+
+- storage_policy `CreateStoragePolicyAssignmentStoragePolicy`
+ - The storage policy to assign to the user or enterprise.
+- 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.
+
+### Returns
+
+This function returns a value of type `StoragePolicyAssignment`.
+
+Returns the new storage policy assignment created.
+
+## Get storage policy assignment
+
+Fetches a specific storage policy assignment.
+
+This operation is performed by calling function `get_storage_policy_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-storage-policy-assignments-id/).
+
+
+
+```python
+client.storage_policy_assignments.get_storage_policy_assignment_by_id(
+ storage_policy_assignment.id
+)
+```
+
+### Arguments
+
+- storage_policy_assignment_id `str`
+ - The ID of the storage policy assignment. Example: "932483"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `StoragePolicyAssignment`.
+
+Returns a storage policy assignment object.
+
+## Update storage policy assignment
+
+Updates a specific storage policy assignment.
+
+This operation is performed by calling function `update_storage_policy_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-storage-policy-assignments-id/).
+
+
+
+```python
+client.storage_policy_assignments.update_storage_policy_assignment_by_id(
+ storage_policy_assignment.id,
+ UpdateStoragePolicyAssignmentByIdStoragePolicy(id=storage_policy_2.id),
+)
+```
+
+### Arguments
+
+- storage_policy_assignment_id `str`
+ - The ID of the storage policy assignment. Example: "932483"
+- 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.
+
+### Returns
+
+This function returns a value of type `StoragePolicyAssignment`.
+
+Returns an updated storage policy assignment object.
+
+## Unassign storage policy
+
+Delete a storage policy assignment.
+
+Deleting a storage policy assignment on a user
+will have the user inherit the enterprise's default
+storage policy.
+
+There is a rate limit for calling this endpoint of only
+twice per user in a 24 hour time frame.
+
+This operation is performed by calling function `delete_storage_policy_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-storage-policy-assignments-id/).
+
+
+
+```python
+client.storage_policy_assignments.delete_storage_policy_assignment_by_id(
+ storage_policy_assignment.id
+)
+```
+
+### Arguments
+
+- storage_policy_assignment_id `str`
+ - The ID of the storage policy assignment. Example: "932483"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the storage policy
+assignment is successfully deleted.
diff --git a/docs/task_assignments.md b/docs/task_assignments.md
new file mode 100644
index 000000000..c0fcbefbd
--- /dev/null
+++ b/docs/task_assignments.md
@@ -0,0 +1,167 @@
+# TaskAssignmentsManager
+
+- [List task assignments](#list-task-assignments)
+- [Assign task](#assign-task)
+- [Get task assignment](#get-task-assignment)
+- [Update task assignment](#update-task-assignment)
+- [Unassign task](#unassign-task)
+
+## List task assignments
+
+Lists all of the assignments for a given task.
+
+This operation is performed by calling function `get_task_assignments`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-tasks-id-assignments/).
+
+
+
+```python
+client.task_assignments.get_task_assignments(task.id)
+```
+
+### Arguments
+
+- task_id `str`
+ - The ID of the task. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TaskAssignments`.
+
+Returns a collection of task assignment defining what task on
+a file has been assigned to which users and by who.
+
+## Assign task
+
+Assigns a task to a user.
+
+A task can be assigned to more than one user by creating multiple
+assignments.
+
+This operation is performed by calling function `create_task_assignment`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-task-assignments/).
+
+
+
+```python
+client.task_assignments.create_task_assignment(
+ CreateTaskAssignmentTask(type=CreateTaskAssignmentTaskTypeField.TASK, id=task.id),
+ CreateTaskAssignmentAssignTo(id=current_user.id),
+)
+```
+
+### Arguments
+
+- task `CreateTaskAssignmentTask`
+ - The task to assign to a user.
+- 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.
+
+### Returns
+
+This function returns a value of type `TaskAssignment`.
+
+Returns a new task assignment object.
+
+## Get task assignment
+
+Retrieves information about a task assignment.
+
+This operation is performed by calling function `get_task_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-task-assignments-id/).
+
+
+
+```python
+client.task_assignments.get_task_assignment_by_id(task_assignment.id)
+```
+
+### Arguments
+
+- task_assignment_id `str`
+ - The ID of the task assignment. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TaskAssignment`.
+
+Returns a task assignment, specifying who the task has been assigned to
+and by whom.
+
+## Update task assignment
+
+Updates a task assignment. This endpoint can be
+used to update the state of a task assigned to a user.
+
+This operation is performed by calling function `update_task_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-task-assignments-id/).
+
+
+
+```python
+client.task_assignments.update_task_assignment_by_id(
+ task_assignment.id,
+ message="updated message",
+ resolution_state=UpdateTaskAssignmentByIdResolutionState.APPROVED,
+)
+```
+
+### Arguments
+
+- task_assignment_id `str`
+ - 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[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.
+
+### Returns
+
+This function returns a value of type `TaskAssignment`.
+
+Returns the updated task assignment object.
+
+## Unassign task
+
+Deletes a specific task assignment.
+
+This operation is performed by calling function `delete_task_assignment_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-task-assignments-id/).
+
+
+
+```python
+client.task_assignments.delete_task_assignment_by_id(task_assignment.id)
+```
+
+### Arguments
+
+- task_assignment_id `str`
+ - The ID of the task assignment. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the task
+assignment was successfully deleted.
diff --git a/docs/tasks.md b/docs/tasks.md
new file mode 100644
index 000000000..755487964
--- /dev/null
+++ b/docs/tasks.md
@@ -0,0 +1,175 @@
+# TasksManager
+
+- [List tasks on file](#list-tasks-on-file)
+- [Create task](#create-task)
+- [Get task](#get-task)
+- [Update task](#update-task)
+- [Remove task](#remove-task)
+
+## List tasks on file
+
+Retrieves a list of all the tasks for a file. This
+endpoint does not support pagination.
+
+This operation is performed by calling function `get_file_tasks`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-files-id-tasks/).
+
+
+
+```python
+client.tasks.get_file_tasks(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Tasks`.
+
+Returns a list of tasks on a file.
+
+If there are no tasks on this file an empty collection is returned
+instead.
+
+## Create task
+
+Creates a single task on a file. This task is not assigned to any user and
+will need to be assigned separately.
+
+This operation is performed by calling function `create_task`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-tasks/).
+
+
+
+```python
+client.tasks.create_task(
+ CreateTaskItem(type=CreateTaskItemTypeField.FILE, id=file.id),
+ action=CreateTaskAction.REVIEW,
+ message="test message",
+ due_at=date_time,
+ completion_rule=CreateTaskCompletionRule.ALL_ASSIGNEES,
+)
+```
+
+### Arguments
+
+- item `CreateTaskItem`
+ - The file to attach the task to.
+- 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[DateTime]`
+ - Defines when the task is due. Defaults to `null` if not provided.
+- 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.
+
+### Returns
+
+This function returns a value of type `Task`.
+
+Returns the newly created task.
+
+## Get task
+
+Retrieves information about a specific task.
+
+This operation is performed by calling function `get_task_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-tasks-id/).
+
+
+
+```python
+client.tasks.get_task_by_id(task.id)
+```
+
+### Arguments
+
+- task_id `str`
+ - The ID of the task. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Task`.
+
+Returns a task object.
+
+## Update task
+
+Updates a task. This can be used to update a task's configuration, or to
+update its completion state.
+
+This operation is performed by calling function `update_task_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-tasks-id/).
+
+
+
+```python
+client.tasks.update_task_by_id(task.id, message="updated message")
+```
+
+### Arguments
+
+- task_id `str`
+ - The ID of the task. Example: "12345"
+- 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[DateTime]`
+ - When the task is due at.
+- 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.
+
+### Returns
+
+This function returns a value of type `Task`.
+
+Returns the updated task object.
+
+## Remove task
+
+Removes a task from a file.
+
+This operation is performed by calling function `delete_task_by_id`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/delete-tasks-id/).
+
+
+
+```python
+client.tasks.delete_task_by_id(task.id)
+```
+
+### Arguments
+
+- task_id `str`
+ - The ID of the task. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the task was successfully deleted.
diff --git a/docs/terms_of_service_user_statuses.md b/docs/terms_of_service_user_statuses.md
new file mode 100644
index 000000000..24c9e9e57
--- /dev/null
+++ b/docs/terms_of_service_user_statuses.md
@@ -0,0 +1,107 @@
+# TermsOfServiceUserStatusesManager
+
+- [List terms of service user statuses](#list-terms-of-service-user-statuses)
+- [Create terms of service status for new user](#create-terms-of-service-status-for-new-user)
+- [Update terms of service status for existing user](#update-terms-of-service-status-for-existing-user)
+
+## List terms of service user statuses
+
+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_terms_of_service_user_statuses`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/get-terms-of-service-user-statuses/).
+
+
+
+```python
+client.terms_of_service_user_statuses.get_terms_of_service_user_statuses(
+ tos.id, user_id=user.id
+)
+```
+
+### Arguments
+
+- tos_id `str`
+ - The ID of the terms of service.
+- user_id `Optional[str]`
+ - Limits results to the given user ID.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TermsOfServiceUserStatuses`.
+
+Returns a list of terms of service statuses.
+
+## Create terms of service status for new user
+
+Sets the status for a terms of service for a user.
+
+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/).
+
+
+
+```python
+client.terms_of_service_user_statuses.create_terms_of_service_status_for_user(
+ CreateTermsOfServiceStatusForUserTos(id=tos.id),
+ CreateTermsOfServiceStatusForUserUser(id=user.id),
+ False,
+)
+```
+
+### Arguments
+
+- tos `CreateTermsOfServiceStatusForUserTos`
+ - The terms of service to set the status for.
+- user `CreateTermsOfServiceStatusForUserUser`
+ - The user to set the status for.
+- is_accepted `bool`
+ - Whether the user has accepted the terms.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TermsOfServiceUserStatus`.
+
+Returns a terms of service status object.
+
+## Update terms of service status for existing user
+
+Updates the status for a terms of service for a user.
+
+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/).
+
+
+
+```python
+client.terms_of_service_user_statuses.update_terms_of_service_status_for_user_by_id(
+ created_tos_user_status.id, True
+)
+```
+
+### Arguments
+
+- terms_of_service_user_status_id `str`
+ - The ID of the terms of service status. Example: "324234"
+- is_accepted `bool`
+ - Whether the user has accepted the terms.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TermsOfServiceUserStatus`.
+
+Returns the updated terms of service status object.
diff --git a/docs/terms_of_services.md b/docs/terms_of_services.md
new file mode 100644
index 000000000..68be19616
--- /dev/null
+++ b/docs/terms_of_services.md
@@ -0,0 +1,131 @@
+# TermsOfServicesManager
+
+- [List terms of services](#list-terms-of-services)
+- [Create terms of service](#create-terms-of-service)
+- [Get terms of service](#get-terms-of-service)
+- [Update terms of service](#update-terms-of-service)
+
+## List terms of services
+
+Returns the current terms of service text and settings
+for the enterprise.
+
+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/).
+
+
+
+```python
+client.terms_of_services.get_terms_of_service()
+```
+
+### Arguments
+
+- 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.
+
+### Returns
+
+This function returns a value of type `TermsOfServices`.
+
+Returns a collection of terms of service text and settings for the
+enterprise.
+
+## Create terms of service
+
+Creates a terms of service for a given enterprise
+and type of user.
+
+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/).
+
+
+
+```python
+client.terms_of_services.create_terms_of_service(
+ CreateTermsOfServiceStatus.DISABLED,
+ "Test TOS",
+ tos_type=CreateTermsOfServiceTosType.MANAGED,
+)
+```
+
+### Arguments
+
+- status `CreateTermsOfServiceStatus`
+ - Whether this terms of service is active.
+- 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`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TermsOfService`.
+
+Returns a new task object.
+
+## Get terms of service
+
+Fetches a specific terms of service.
+
+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_terms_of_service_by_id` in integration tests_
+
+### Arguments
+
+- terms_of_service_id `str`
+ - The ID of the terms of service. Example: "324234"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TermsOfService`.
+
+Returns a terms of service object.
+
+## Update terms of service
+
+Updates a specific terms of service.
+
+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/).
+
+
+
+```python
+client.terms_of_services.update_terms_of_service_by_id(
+ tos.id, UpdateTermsOfServiceByIdStatus.DISABLED, "TOS"
+)
+```
+
+### Arguments
+
+- terms_of_service_id `str`
+ - The ID of the terms of service. Example: "324234"
+- 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`.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TermsOfService`.
+
+Returns an updated terms of service object.
diff --git a/docs/transfer.md b/docs/transfer.md
new file mode 100644
index 000000000..d3e6b3c5c
--- /dev/null
+++ b/docs/transfer.md
@@ -0,0 +1,73 @@
+# TransferManager
+
+- [Transfer owned folders](#transfer-owned-folders)
+
+## Transfer owned folders
+
+Move all of the items (files, folders and workflows) owned by a user into
+another user's account
+
+Only the root folder (`0`) can be transferred.
+
+Folders can only be moved across users by users with administrative
+permissions.
+
+All existing shared links and folder-level collaborations are transferred
+during the operation. Please note that while collaborations at the individual
+file-level are transferred during the operation, the collaborations are
+deleted when the original user is deleted.
+
+If the user has a large number of items across all folders, the call will
+be run asynchronously. If the operation is not completed within 10 minutes,
+the user will receive a 200 OK response, and the operation will continue running.
+
+If the destination path has a metadata cascade policy attached to any of
+the parent folders, a metadata cascade operation will be kicked off
+asynchronously.
+
+There is currently no way to check for when this operation is finished.
+
+The destination folder's name will be in the format `{User}'s Files and
+Folders`, where `{User}` is the display name of the user.
+
+To make this API call your application will need to have the "Read and write
+all files and folders stored in Box" scope enabled.
+
+Please make sure the destination user has access to `Relay` or `Relay Lite`,
+and has access to the files and folders involved in the workflows being
+transferred.
+
+Admins will receive an email when the operation is completed.
+
+This operation is performed by calling function `transfer_owned_folder`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/put-users-id-folders-0/).
+
+
+
+```python
+client.transfer.transfer_owned_folder(
+ source_user.id, TransferOwnedFolderOwnedBy(id=target_user.id), notify=False
+)
+```
+
+### Arguments
+
+- user_id `str`
+ - The ID of the user. Example: "12345"
+- 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.
+- notify `Optional[bool]`
+ - Determines if users should receive email notification for the action performed.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `FolderFull`.
+
+Returns the information for the newly created
+destination folder.
diff --git a/docs/trashed_files.md b/docs/trashed_files.md
new file mode 100644
index 000000000..3b77196f2
--- /dev/null
+++ b/docs/trashed_files.md
@@ -0,0 +1,113 @@
+# TrashedFilesManager
+
+- [Restore file](#restore-file)
+- [Get trashed file](#get-trashed-file)
+- [Permanently remove file](#permanently-remove-file)
+
+## Restore file
+
+Restores a file that has been moved to the trash.
+
+An optional new parent ID can be provided to restore the file to in case the
+original folder has been deleted.
+
+This operation is performed by calling function `restore_file_from_trash`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-id/).
+
+
+
+```python
+client.trashed_files.restore_file_from_trash(file.id)
+```
+
+### 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"
+- name `Optional[str]`
+ - An optional new name for the file.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TrashFileRestored`.
+
+Returns a file object when the file has been restored.
+
+## Get trashed file
+
+Retrieves a file that has been moved to the trash.
+
+Please note that only if the file itself has been moved to the
+trash can it be retrieved with this API call. If instead one of
+its parent folders was moved to the trash, only that folder
+can be inspected using the
+[`GET /folders/:id/trash`](e://get_folders_id_trash) API.
+
+To list all items that have been moved to the trash, please
+use the [`GET /folders/trash/items`](e://get-folders-trash-items/)
+API.
+
+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/).
+
+
+
+```python
+client.trashed_files.get_trashed_file_by_id(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TrashFile`.
+
+Returns the file that was trashed,
+including information about when the it
+was moved to the trash.
+
+## Permanently remove file
+
+Permanently deletes a file that is in the trash.
+This action cannot be undone.
+
+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/).
+
+
+
+```python
+client.trashed_files.delete_trashed_file_by_id(file.id)
+```
+
+### Arguments
+
+- file_id `str`
+ - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the file was
+permanently deleted.
diff --git a/docs/trashed_folders.md b/docs/trashed_folders.md
new file mode 100644
index 000000000..66a0f27fc
--- /dev/null
+++ b/docs/trashed_folders.md
@@ -0,0 +1,120 @@
+# TrashedFoldersManager
+
+- [Restore folder](#restore-folder)
+- [Get trashed folder](#get-trashed-folder)
+- [Permanently remove folder](#permanently-remove-folder)
+
+## Restore folder
+
+Restores a folder that has been moved to the trash.
+
+An optional new parent ID can be provided to restore the folder to in case the
+original folder has been deleted.
+
+During this operation, part of the file tree will be locked, mainly
+the source folder and all of its descendants, as well as the destination
+folder.
+
+For the duration of the operation, no other move, copy, delete, or restore
+operation can performed on any of the locked folders.
+
+This operation is performed by calling function `restore_folder_from_trash`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-folders-id/).
+
+
+
+```python
+client.trashed_folders.restore_folder_from_trash(folder.id)
+```
+
+### 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"
+- name `Optional[str]`
+ - An optional new name for the folder.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TrashFolderRestored`.
+
+Returns a folder object when the folder has been restored.
+
+## Get trashed folder
+
+Retrieves a folder that has been moved to the trash.
+
+Please note that only if the folder itself has been moved to the
+trash can it be retrieved with this API call. If instead one of
+its parent folders was moved to the trash, only that folder
+can be inspected using the
+[`GET /folders/:id/trash`](e://get_folders_id_trash) API.
+
+To list all items that have been moved to the trash, please
+use the [`GET /folders/trash/items`](e://get-folders-trash-items/)
+API.
+
+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/).
+
+
+
+```python
+client.trashed_folders.get_trashed_folder_by_id(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TrashFolder`.
+
+Returns the folder that was trashed,
+including information about when the it
+was moved to the trash.
+
+## Permanently remove folder
+
+Permanently deletes a folder that is in the trash.
+This action cannot be undone.
+
+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/).
+
+
+
+```python
+client.trashed_folders.delete_trashed_folder_by_id(folder.id)
+```
+
+### Arguments
+
+- folder_id `str`
+ - The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the folder was
+permanently deleted.
diff --git a/docs/trashed_items.md b/docs/trashed_items.md
new file mode 100644
index 000000000..22b41a270
--- /dev/null
+++ b/docs/trashed_items.md
@@ -0,0 +1,51 @@
+# TrashedItemsManager
+
+- [List trashed items](#list-trashed-items)
+
+## List trashed items
+
+Retrieves the files and folders that have been moved
+to the trash.
+
+Any attribute in the full files or folders objects can be passed
+in with the `fields` parameter to retrieve those specific
+attributes that are not returned by default.
+
+This endpoint defaults to use offset-based pagination, yet also supports
+marker-based pagination using the `marker` parameter.
+
+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/).
+
+
+
+```python
+client.trashed_items.get_trashed_items()
+```
+
+### Arguments
+
+- 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.
+- limit `Optional[int]`
+ - The maximum number of items to return per page.
+- offset `Optional[int]`
+ - The offset of the item at which to begin the response. Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
+- usemarker `Optional[bool]`
+ - Specifies whether to use marker-based pagination instead of offset-based pagination. Only one pagination method can be used at a time. By setting this value to true, the API will return a `marker` field that can be passed as a parameter to this endpoint to get the next page of the response.
+- 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[GetTrashedItemsDirection]`
+ - The direction to sort results in. This can be either in alphabetical ascending (`ASC`) or descending (`DESC`) order.
+- 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.
+
+### Returns
+
+This function returns a value of type `Items`.
+
+Returns a list of items that have been deleted.
diff --git a/docs/trashed_web_links.md b/docs/trashed_web_links.md
new file mode 100644
index 000000000..b1d31d080
--- /dev/null
+++ b/docs/trashed_web_links.md
@@ -0,0 +1,103 @@
+# TrashedWebLinksManager
+
+- [Restore web link](#restore-web-link)
+- [Get trashed web link](#get-trashed-web-link)
+- [Permanently remove web link](#permanently-remove-web-link)
+
+## Restore web link
+
+Restores a web link that has been moved to the trash.
+
+An optional new parent ID can be provided to restore the web link to in case
+the original folder has been deleted.
+
+This operation is performed by calling function `restore_weblink_from_trash`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-web-links-id/).
+
+
+
+```python
+client.trashed_web_links.restore_weblink_from_trash(weblink.id)
+```
+
+### Arguments
+
+- web_link_id `str`
+ - The ID of the web link. Example: "12345"
+- name `Optional[str]`
+ - An optional new name for the web link.
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TrashWebLinkRestored`.
+
+Returns a web link object when it has been restored.
+
+## Get trashed web link
+
+Retrieves a web link that has been moved to the trash.
+
+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/).
+
+
+
+```python
+client.trashed_web_links.get_trashed_web_link_by_id(weblink.id)
+```
+
+### Arguments
+
+- web_link_id `str`
+ - The ID of the web link. Example: "12345"
+- 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.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `TrashWebLink`.
+
+Returns the web link that was trashed,
+including information about when the it
+was moved to the trash.
+
+## Permanently remove web link
+
+Permanently deletes a web link that is in the trash.
+This action cannot be undone.
+
+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/).
+
+
+
+```python
+client.trashed_web_links.delete_trashed_web_link_by_id(weblink.id)
+```
+
+### Arguments
+
+- web_link_id `str`
+ - The ID of the web link. Example: "12345"
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `None`.
+
+Returns an empty response when the web link was
+permanently deleted.
diff --git a/docs/uploads.md b/docs/uploads.md
new file mode 100644
index 000000000..8d4095301
--- /dev/null
+++ b/docs/uploads.md
@@ -0,0 +1,173 @@
+# UploadsManager
+
+- [Upload file version](#upload-file-version)
+- [Preflight check before upload](#preflight-check-before-upload)
+- [Upload file](#upload-file)
+- [Upload a file with a preflight check](#upload-a-file-with-a-preflight-check)
+
+## Upload file version
+
+Update a file's content. For file sizes over 50MB we recommend
+using the Chunk Upload APIs.
+
+The `attributes` part of the body must come **before** the
+`file` part. Requests that do not follow this format when
+uploading the file will receive a HTTP `400` error with a
+`metadata_after_file_contents` error code.
+
+This operation is performed by calling function `upload_file_version`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-id-content/).
+
+
+
+```python
+client.uploads.upload_file_version(
+ uploaded_file.id,
+ UploadFileVersionAttributes(name=new_file_version_name),
+ new_file_content_stream,
+)
+```
+
+### 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"
+- attributes `UploadFileVersionAttributes`
+ - The additional attributes of the file being uploaded. Mainly the name and the parent folder. These attributes are part of the multi part request body and are in JSON format. The `attributes` part of the body must come **before** the `file` part. Requests that do not follow this format when uploading the file will receive a HTTP `400` error with a `metadata_after_file_contents` error code.
+- file `ByteStream`
+ - The content of the file to upload to Box. The `attributes` part of the body must come **before** the `file` part. Requests that do not follow this format when uploading the file will receive a HTTP `400` error with a `metadata_after_file_contents` error code.
+- file_file_name `Optional[str]`
+- file_content_type `Optional[str]`
+- 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.
+- if_match `Optional[str]`
+ - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since.
+- content_md_5 `Optional[str]`
+ - An optional header containing the SHA1 hash of the file to ensure that the file was not corrupted in transit.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Files`.
+
+Returns the new file object in a list.
+
+## Preflight check before upload
+
+Performs a check to verify that a file will be accepted by Box
+before you upload the entire file.
+
+This operation is performed by calling function `preflight_file_upload_check`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/options-files-content/).
+
+
+
+```python
+client.uploads.preflight_file_upload_check(
+ name=new_file_name, size=1024 * 1024, parent=PreflightFileUploadCheckParent(id="0")
+)
+```
+
+### Arguments
+
+- name `Optional[str]`
+ - The name for the file.
+- size `Optional[int]`
+ - The size of the file in bytes.
+- parent `Optional[PreflightFileUploadCheckParent]`
+- 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 `UploadUrl`.
+
+If the check passed, the response will include a session URL that
+can be used to upload the file to.
+
+## Upload file
+
+Uploads a small file to Box. For file sizes over 50MB we recommend
+using the Chunk Upload APIs.
+
+The `attributes` part of the body must come **before** the
+`file` part. Requests that do not follow this format when
+uploading the file will receive a HTTP `400` error with a
+`metadata_after_file_contents` error code.
+
+This operation is performed by calling function `upload_file`.
+
+See the endpoint docs at
+[API Reference](https://developer.box.com/reference/post-files-content/).
+
+
+
+```python
+client.uploads.upload_file(
+ UploadFileAttributes(
+ name=new_file_name, parent=UploadFileAttributesParentField(id="0")
+ ),
+ file_content_stream,
+)
+```
+
+### Arguments
+
+- attributes `UploadFileAttributes`
+ - The additional attributes of the file being uploaded. Mainly the name and the parent folder. These attributes are part of the multi part request body and are in JSON format. The `attributes` part of the body must come **before** the `file` part. Requests that do not follow this format when uploading the file will receive a HTTP `400` error with a `metadata_after_file_contents` error code.
+- file `ByteStream`
+ - The content of the file to upload to Box. The `attributes` part of the body must come **before** the `file` part. Requests that do not follow this format when uploading the file will receive a HTTP `400` error with a `metadata_after_file_contents` error code.
+- file_file_name `Optional[str]`
+- file_content_type `Optional[str]`
+- 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.
+- content_md_5 `Optional[str]`
+ - An optional header containing the SHA1 hash of the file to ensure that the file was not corrupted in transit.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Files`.
+
+Returns the new file object in a list.
+
+## Upload a file with a preflight check
+
+Upload a file with a preflight check
+
+This operation is performed by calling function `upload_with_preflight_check`.
+
+```python
+client.uploads.upload_with_preflight_check(
+ UploadWithPreflightCheckAttributes(
+ name=new_file_name,
+ size=-1,
+ parent=UploadWithPreflightCheckAttributesParentField(id="0"),
+ ),
+ file_content_stream,
+)
+```
+
+### Arguments
+
+- attributes `UploadWithPreflightCheckAttributes`
+- file `ByteStream`
+ - The content of the file to upload to Box. The `attributes` part of the body must come **before** the `file` part. Requests that do not follow this format when uploading the file will receive a HTTP `400` error with a `metadata_after_file_contents` error code.
+- file_file_name `Optional[str]`
+- file_content_type `Optional[str]`
+- 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.
+- content_md_5 `Optional[str]`
+ - An optional header containing the SHA1 hash of the file to ensure that the file was not corrupted in transit.
+- extra_headers `Optional[Dict[str, Optional[str]]]`
+ - Extra headers that will be included in the HTTP request.
+
+### Returns
+
+This function returns a value of type `Files`.
diff --git a/docs/usage/README.md b/docs/usage/README.md
deleted file mode 100644
index f7fd6f5d7..000000000
--- a/docs/usage/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# Getting raw json response
-
-The response returned by an API endpoint is being automatically translated to the corresponding
-object basing on the value of the `type` field. If you want to get the raw response object,
-you can access response dict using `response_object` property. Example below will print the
-raw json response returned by the Get file information endpoint.
-
-``` python
-file = client.file('1122334455').get()
-print(json.dumps(file.response_object))
-```
diff --git a/docs/usage/ai.md b/docs/usage/ai.md
deleted file mode 100644
index 0a9d4da51..000000000
--- a/docs/usage/ai.md
+++ /dev/null
@@ -1,103 +0,0 @@
-AI
-==
-
-AI allows to send an intelligence request to supported large language models and returns an answer based on the provided prompt and items.
-
-
-
-
-- [Send AI request](#send-ai-request)
-- [Send AI text generation request](#send-ai-text-generation-request)
-- [Get AI agent default configuration](#get-ai-agent-default-configuration)
-
-
-
-Send AI request
-------------------------
-
-Calling the [`client.send_ai_question(items, prompt, mode, ai_agent)`][send-ai-question] method will send an AI request to the supported large language models. The `items` parameter is a list of items to be processed by the LLM, often files. The `prompt` provided by the client to be answered by the LLM. The prompt's length is limited to 10000 characters. The `mode` specifies if this request is for a single or multiple items. If you select `single_item_qa` the items array can have one element only. Selecting `multiple_item_qa` allows you to provide up to 25 items. The `ai_agent` specifies the AI agent which will be used to handle queries.
-
-
-
-
-```python
-items = [{
- "id": "1582915952443",
- "type": "file",
- "content": "More information about public APIs"
-}]
-ai_agent = {
- 'type': 'ai_agent_ask',
- 'basic_text_multi': {
- 'model': 'openai__gpt_3_5_turbo'
- }
-}
-answer = client.send_ai_question(
- items=items,
- prompt="What is this file?",
- mode="single_item_qa",
- ai_agent=ai_agent
-)
-print(answer)
-```
-
-NOTE: The AI endpoint may return a 412 status code if you use for your request a file which has just been updated to the box.
-It usually takes a few seconds for the file to be indexed and available for the AI endpoint.
-
-[send-ai-question]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.send_ai_question
-
-Send AI text generation request
-------------------------
-
-Calling the [`client.send_ai_text_gen(dialogue_history, items, prompt, ai_agent)`][send-ai-text-gen] method will send an AI text generation request to the supported large language models. The `dialogue_history` parameter is history of prompts and answers previously passed to the LLM. This provides additional context to the LLM in generating the response. The `items` parameter is a list of items to be processed by the LLM, often files. The `prompt` provided by the client to be answered by the LLM. The prompt's length is limited to 10000 characters. The `ai_agent` specifies the AI agent which will be used for generating text.
-
-
-```python
-items = [{
- "id": "1582915952443",
- "type": "file",
- "content": "More information about public APIs"
-}]
-dialogue_history = [{
- "prompt": "Make my email about public APIs sound more professional",
- "answer": "Here is the first draft of your professional email about public APIs",
- "created_at": "2013-12-12T10:53:43-08:00"
- },
- {
- "prompt": "Can you add some more information?",
- "answer": "Public API schemas provide necessary information to integrate with APIs...",
- "created_at": "2013-12-12T11:20:43-08:00"
-}]
-ai_agent = {
- 'type': 'ai_agent_text_gen',
- 'basic_gen': {
- 'model': 'openai__gpt_3_5_turbo_16k'
- }
-}
-answer = client.send_ai_text_gen(
- dialogue_history=dialogue_history,
- items=items,
- prompt="Write an email to a client about the importance of public APIs.",
- ai_agent=ai_agent
-)
-print(answer)
-```
-
-[send-ai-text-gen]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.send_ai_text_gen
-
-Get AI agent default configuration
-------------------------
-
-To get an AI agent default configuration call the [`client.get_ai_agent_default_config(mode, language, model)`][get-ai-agent-default] method. The `mode` parameter filters the agent configuration to be returned. It can be either `ask` or `text_gen`. The `language` parameter specifies the ISO language code to return the agent config for. If the language is not supported, the default agent configuration is returned. The `model` parameter specifies the model for which the default agent configuration should be returned.
-
-
-```python
-config = client.get_ai_agent_default_config(
- mode='text_gen',
- language='en',
- model='openai__gpt_3_5_turbo'
-)
-print(config)
-```
-
-[get-ai-agent-default]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.get_ai_agent_default_config
diff --git a/docs/usage/authentication.md b/docs/usage/authentication.md
deleted file mode 100644
index bce264e8c..000000000
--- a/docs/usage/authentication.md
+++ /dev/null
@@ -1,417 +0,0 @@
-Authentication
-==============
-
-The Box API uses OAuth2 for authentication, which can be difficult to implement.
-The SDK makes it easier by providing classes that handle obtaining tokens and
-automatically refreshing them when possible. See the
-[OAuth 2 overview](https://developer.box.com/en/guides/authentication/) for a detailed
-overview of how the Box API handles authentication.
-
-
-
-
-- [Ways to Authenticate](#ways-to-authenticate)
- - [Developer Token](#developer-token)
- - [Server Auth with JWT](#server-auth-with-jwt)
- - [Client Credentials Grant](#client-credentials-grant)
- - [Obtaining Service Account token](#obtaining-service-account-token)
- - [Obtaining User token](#obtaining-user-token)
- - [Traditional 3-Legged OAuth2](#traditional-3-legged-oauth2)
- - [Redirect to Authorization URL](#redirect-to-authorization-url)
- - [Authenticate (Get Token Pair)](#authenticate-get-token-pair)
- - [Initialize a Client Given Access and Refresh Token](#initialize-a-client-given-access-and-refresh-token)
- - [Box View Authentication with App Tokens](#box-view-authentication-with-app-tokens)
-- [As-User](#as-user)
-- [Downscoping token](#downscoping-token)
-- [Revoking Tokens](#revoking-tokens)
-
-
-
-Ways to Authenticate
---------------------
-
-### Developer Token
-
-The fastest way to get started using the API is with developer tokens. A
-developer token is simply a short-lived access token that cannot be refreshed
-and can only be used with your own account. Therefore, they're only useful for
-testing an app and aren't suitable for production. You can obtain a developer
-token from your application's [developer console][dev_console] page.
-
-For manual testing in a Python REPL, you can interactively create a [`DevelopmentClient`][dev_client].
-This client will prompt for a new developer token any time the current one expires, and will automatically
-log API requests and responses for testing and debugging.
-
-```python
->>> from boxsdk import DevelopmentClient
->>> client = DevelopmentClient()
-Enter developer token:
->>> me = client.user().get()
-GET https://api.box.com/2.0/users/me {'headers': {'Authorization': '---wXyZ',
- 'User-Agent': 'box-python-sdk-2.0.0',
- 'X-Box-UA': 'agent=box-python-sdk/2.0.0; env=python/3.6.5'},
- 'params': None}
-"GET https://api.box.com/2.0/users/me" 200 454
-{'Date': 'Tue, 30 Oct 2018 20:57:36 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=31536000', 'Cache-Control': 'no-cache, no-store', 'Content-Encoding': 'gzip', 'Vary': 'Accept-Encoding', 'BOX-REQUEST-ID': '0dnjcjpu1krfunto6s7mrpal2ba', 'Age': '0'}
-{'address': '',
- 'avatar_url': 'https://cloud.app.box.com/api/avatar/large/33333',
- 'created_at': '2012-06-07T11:14:50-07:00',
- 'id': '33333',
- 'job_title': '',
- 'language': 'en',
- 'login': 'user@example.com',
- 'max_upload_size': 16106127360,
- 'modified_at': '2018-10-29T12:13:57-07:00',
- 'name': 'Example User',
- 'phone': '',
- 'space_amount': 1000000000000000.0,
- 'space_used': 14330011102,
- 'status': 'active',
- 'timezone': 'America/Los_Angeles',
- 'type': 'user'}
->>>
-```
-
-To create a [`Client`][client_class] non-interactively with a developer token, construct an [`OAuth2`][oauth2_class]
-object with the `access_token` set to the developer token and construct the client with that.
-
-
-```python
-from boxsdk import Client, OAuth2
-
-auth = OAuth2(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- access_token='DEVELOPER_TOKEN_GOES_HERE',
-)
-client = Client(auth)
-me = client.user().get()
-print(f'My user ID is {me.id}')
-```
-
-[dev_console]: https://app.box.com/developers/console
-[dev_client]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#module-boxsdk.client.development_client
-[client_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client
-[oauth2_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.auth.html#boxsdk.auth.oauth2.OAuth2
-
-### Server Auth with JWT
-
-Authenticating with a JWT requires some extra dependencies. To get them, simply
-```
-pip install "boxsdk[jwt]"
-```
-
-Server auth allows your application to authenticate itself with the Box API
-for a given enterprise. By default, your application has a
-[Service Account](https://developer.box.com/en/guides/authentication/user-types/app-users/)
-that represents it and can perform API calls. The Service Account is separate
-from the Box accounts of the application developer and the enterprise admin of
-any enterprise that has authorized the app — files stored in that account are
-not accessible in any other account by default, and vice versa.
-
-If you generated your public and private keys automatically through the
-[Box Developer Console][dev_console], you can use the JSON file created there
-to configure your SDK instance and create a client to make calls as the
-Service Account by calling the appropriate static [`JWTAuth`][jwt_auth_class] method:
-
-
-```python
-from boxsdk import JWTAuth, Client
-
-auth = JWTAuth.from_settings_file('/path/to/settings.json')
-client = Client(auth)
-service_account = client.user().get()
-print(f'Service Account user ID is {service_account.id}')
-```
-
-Otherwise, you'll need to provide the necessary configuration fields directly
-to the [`JWTAuth`][jwt_auth_class] constructor:
-
-
-```python
-from boxsdk import JWTAuth, Client
-
-service_account_auth = JWTAuth(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- enterprise_id='YOUR_ENTERPRISE_ID',
- jwt_key_id='YOUR_JWT_KEY_ID',
- rsa_private_key_file_sys_path='CERT.PEM',
- rsa_private_key_passphrase='PASSPHRASE',
- store_tokens=your_store_tokens_callback_method,
-)
-
-access_token = auth.authenticate_instance()
-
-service_account_client = Client(auth)
-```
-
-App auth applications also often have associated App Users, which are
-[created and managed directly by the application](https://developer.box.com/en/guides/authentication/user-types/app-users/)
-— they do not have normal login credentials, and can only be accessed through
-the Box API by the application that created them. You may authenticate as the
-Service Account to provision and manage users, or as an individual app user to
-make calls as that user. See the [API documentation](https://developer.box.com/)
-for detailed instructions on how to use app auth.
-
-Clients for making calls as an App User can be created with the same [`JWTAuth`][jwt_auth_class]
-constructor as in the above examples, similarly to creating a Service Account client. Simply pass the
-[`User`][user_class] object for the app user instead of an `enterprise_id` when constructing the auth instance:
-
-
-```python
-app_user = service_account_client.user(user_id='APP_USER_ID')
-
-app_user_auth = JWTAuth(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- user=app_user,
- jwt_key_id='YOUR_JWT_KEY_ID',
- rsa_private_key_file_sys_path='CERT.PEM',
- rsa_private_key_passphrase='PASSPHRASE',
- store_tokens=your_store_tokens_callback_method,
-)
-app_user_auth.authenticate_user()
-app_user_client = Client(app_user_auth)
-```
-
-[jwt_auth_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.auth.html#boxsdk.auth.jwt_auth.JWTAuth
-[user_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.user.User
-
-
-### Client Credentials Grant
-
-Allows you to obtain an access token by having client credentials and secret with enterprise or user ID,
-which allows you to work using a service or user account.
-
-You can use `CCGAuth` to initialize a client object the same way as for other authentication types:
-
-```python
-auth = CCGAuth(
- client_id="YOUR_CLIENT_ID",
- client_secret="YOUR_CLIENT_SECRET",
- user="YOUR_USER_ID"
-)
-
-client = Client(auth)
-print(f'Id of the authenticated user is: {client.user().get().id}')
-```
-
-Obtained token is valid for specified amount of time, it will be refreshed automatically by default.
-
-#### Obtaining Service Account token
-
-The [Service Account](https://developer.box.com/guides/getting-started/user-types/service-account//)
-is separate from the Box accounts of the application developer and the
-enterprise admin of any enterprise that has authorized the app — files stored in that account
-are not accessible in any other account by default, and vice versa.
-To obtain service account you will have to provide enterprise ID with client id and secret:
-
-
-```python
-auth = CCGAuth(
- client_id="YOUR_CLIENT_ID",
- client_secret="YOUR_CLIENT_SECRET",
- enterprise_id="YOUR_ENETRPRISE_ID"
-)
-```
-
-Remember that you can still make calls on behalf of managed users, which are part of your enterprise, by using
-[As-User](#as-user) bahaviour.
-
-#### Obtaining User token
-
-To obtain user account you will have to provide user ID with client id and secret
-
-```python
-auth = CCGAuth(
- client_id="YOUR_CLIENT_ID",
- client_secret="YOUR_CLIENT_SECRET",
- user="YOUR_USER_ID"
-)
-```
-In order to enable obtaining user token you have to go to your application configuration that can be found
-[here](https://app.box.com/developers/console). In`Configuration` tab, in section `Advanced Features`
-select `Generate user access tokens`. Do not forget to re-authorize application if it was already authorized.
-
-
-### Traditional 3-Legged OAuth2
-
-If your application needs to integrate with existing Box users who will provide
-their login credentials to grant your application access to their account, you
-will need to go through the standard OAuth2 login flow. A detailed guide for
-this process is available in the
-[Authentication with OAuth API documentation](https://developer.box.com/en/guides/authentication/oauth2/).
-
-Using an auth code is the most common way of authenticating with the Box API for
-existing Box users, to integrate with their accounts.
-Your application must provide a way for the user to login to Box (usually with a
-browser or web view) in order to obtain an auth code.
-
-After a user logs in and grants your application access to their Box account,
-they will be redirected to your application's `redirect_uri` which will contain
-an auth code. This auth code can then be used along with your client ID and
-client secret to establish an API connection.
-
-#### Redirect to Authorization URL
-
-The first step in the process is to redirect the user to the Box Authorize URL, which you can generate
-(along with a CSRF token) by calling [`oauth.get_authorization_url(redirect_url)`][get_authorization_url] with
-your application's redirect URL.
-
-
-```python
-from boxsdk import OAuth2
-
-oauth = OAuth2(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- store_tokens=your_store_tokens_callback_method,
-)
-
-auth_url, csrf_token = oauth.get_authorization_url('http://YOUR_REDIRECT_URL')
-
-# Redirect user to auth_url, where they will enter their Box credentials
-```
-
-The SDK will keep the tokens in memory for the duration of the Python script run, so you don't always need to pass
-`store_tokens`.
-
-[get_authorization_url]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.auth.html#boxsdk.auth.oauth2.OAuth2.get_authorization_url
-
-#### Authenticate (Get Token Pair)
-
-If you navigate the user to the auth_url, the user will be redirected to
-`https://YOUR_REDIRECT_URL?code=YOUR_AUTH_CODE&state=CSRF_TOKEN` after they log in to Box. After getting the auth code,
-you will be able to exchange it for an access token and refresh token.
-
-The SDK handles all the work for you; all you need to do is call [`oauth.authenticate(auth_code)`][authenticate] with
-the auth code pulled from the query parameters of the incoming URL:
-
-
-```python
-from boxsdk import Client
-
-# Make sure that the csrf token you get from the `state` parameter
-# in the final redirect URI is the same token you get from the
-# get_authorization_url method to protect against CSRF vulnerabilities.
-assert 'THE_CSRF_TOKEN_YOU_GOT' == csrf_token
-access_token, refresh_token = oauth.authenticate('YOUR_AUTH_CODE')
-client = Client(oauth)
-```
-
-[authenticate]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.auth.html#boxsdk.auth.oauth2.OAuth2.authenticate
-
-#### Initialize a Client Given Access and Refresh Token
-
-You can also instantiate a client given the access and refresh token. You first need to construct an
-[OAuth2][oauth2_class] object with the access and refresh token passed in. Once you have created the
-oauth object you then pass it into your [Client][client_class] object to instantiate your client. Finally, you can begin making calls with your client.
-
-
-```python
-from boxsdk import Client, OAuth2
-
-oauth = OAuth2(
- client_id='YOUR_CLIENT_ID',
- client_secret='YOUR_CLIENT_SECRET',
- access_token='ACCESS_TOKEN',
- refresh_token='REFRESH_TOKEN',
-)
-
-client = Client(oauth)
-
-user = client.user().get()
-print(f'User ID is {user.id}')
-```
-
-### Box View Authentication with App Tokens
-
-[Box View](https://developer.box.com/en/guides/embed/box-view/)
-uses a long-lived access token that is generated from the [Box Developer Console][dev_console] to make API calls.
-These access tokens cannot be automatically refreshed from the SDK, and must be manually changed in
-your application code.
-
-To use the primary or secondary access token generated in the Developer Console,
-simply create a [`Client`][client_class] with that token:
-
-
-```python
-from boxsdk import Client, OAuth2
-
-auth = OAuth2(
- client_id='YOUR_CLIENT_ID',
- client_secret='',
- access_token='APP_ACCESS_TOKEN_GOES_HERE'
-)
-client = Client(auth)
-```
-
-As-User
--------
-
-The As-User header is used by enterprise admins to make API calls on behalf of
-their enterprise's users. This requires the API request to pass an
-`As-User: USER-ID` header. For more details see the
-[documentation on As-User](https://developer.box.com/en/guides/authentication/oauth2/as-user/).
-
-The following examples assume that the `client` has been instantiated with an
-access token belonging to an admin-level user or Service Account with appropriate
-privileges to make As-User calls.
-
-Calling the [`client.as_user(user)`][as_user] method with the [`User`][user_class] creates a new client to impersonate
-the provided user. All calls made with the new client will be made in context of the impersonated user, leaving the
-original client unmodified.
-
-
-```python
-user_to_impersonate = client.user(user_id='USER_ID_GOES_HERE')
-user_client = client.as_user(user_to_impersonate)
-```
-
-[as_user]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.cloneable.Cloneable.as_user
-
-Downscoping token
---------------
-
-You can downscope a client's access token for one with a lower scope, in order
-to restrict the permissions for a child client or to pass to a less secure
-location (e.g. a browser-based app). This is useful if you want to use the
-[Box UI Elements](https://developer.box.com/en/guides/embed/ui-elements/), since they generally
-do not need full read/write permissions to run.
-
-To exchange the token held by a client for a new token with only `item_preview`
-scope, restricted to a single file, suitable for the
-[Content Preview UI Element](https://developer.box.com/en/guides/embed/ui-elements/preview/), call
-[`client.downscope_token(scopes, item=None, additional_data=None)`][downscope_token] with the scope(s) needed.
-This method returns a [`TokenResponse`][token_response] object with the downscoped token information.
-
-
-```python
-target_file = client.file(file_id='FILE_ID_HERE')
-token_info = client.downscope_token(['item_preview'], target_file)
-downscoped_client = Client(
- OAuth2(
- client_id=None,
- client_secret=None,
- access_token=token_info.access_token
- )
-)
-```
-But bear in mind that there is no way of refreshing this token, and you will need to add you own logic to do that.
-
-[downscope_token]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.downscope_token
-[token_response]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.auth.html#boxsdk.auth.oauth2.TokenResponse
-
-Revoking Tokens
----------------
-
-To revoke the tokens contained in an [`OAuth2`][oauth2_class] instance, removing the ability to call the Box API,
-call [`oauth.revoke()`][revoke].
-
-
-```python
-oauth.revoke()
-```
-
-[revoke]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.auth.html#boxsdk.auth.oauth2.OAuth2.revoke
diff --git a/docs/usage/classifications.md b/docs/usage/classifications.md
deleted file mode 100644
index d0c77023f..000000000
--- a/docs/usage/classifications.md
+++ /dev/null
@@ -1,217 +0,0 @@
-Classifications
-===============
-
-Classifications are a type of metadata that allows users and applications
-to define and assign a content classification to files and folders.
-
-Classifications use the metadata APIs to add and remove classifications, and
-assign them to files. For more details on metadata templates please see the
-[metadata documentation](./metadata.md).
-
-
-
-
-
-- [Add initial classifications](#add-initial-classifications)
-- [List all classifications](#list-all-classifications)
-- [Add another classification](#add-another-classification)
-- [Update a classification](#update-a-classification)
-- [Delete a classification](#delete-a-classification)
-- [Delete all classifications](#delete-all-classifications)
-- [Add classification to file](#add-classification-to-file)
-- [Update classification on file](#update-classification-on-file)
-- [Get classification on file](#get-classification-on-file)
-- [Remove classification from file](#remove-classification-from-file)
-- [Add classification to folder](#add-classification-to-folder)
-- [Update classification on folder](#update-classification-on-folder)
-- [Get classification on folder](#get-classification-on-folder)
-- [Remove classification from folder](#remove-classification-from-folder)
-
-
-
-Add initial classifications
----------------------------
-
-If an enterprise does not already have a classification defined, the first classification(s)
-can be added with the
-`client.create_metadata_template(display_name, fields, template_key=None, hidden=False, scope='enterprise')`](https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.create_metadata_template)
-method.
-
-
-```python
-from boxsdk.object.metadata_template import MetadataField, MetadataFieldType
-
-fields = [
- MetadataField(MetadataFieldType.ENUM, 'Classification', key='Box__Security__Classification__Key', options=['Top Secret'])
-]
-
-template = client.create_metadata_template('Classification', fields, template_key='securityClassification-6VMVochwUWo')
-```
-
-List all classifications
-------------------------
-
-To retrieve a list of all the classifications in an enterprise call the
-[`client.metadata_template(scope, template_key)`](https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.metadata_template)
-method to get the classifications template, which will contain a list of all the
-classifications.
-
-
-```python
-template = client.metadata_template('enterprise', 'securityClassification-6VMVochwUWo').get()
-```
-
-Add another classification
---------------------------
-
-To add another classification, call the
-[`template.start_update()`][start_update] API to start making changes to the
-template, and then call the [`template.update_info(updates=new_updates)`][update_info]
-with the changes to apply to the template.
-
-
-```python
-template = client.metadata_template('enterprise', 'securityClassification-6VMVochwUWo')
-new_updates = template.start_update()
-new_updates.add_enum_option('Box__Security__Classification__Key', 'Sensitive')
-updated_template = template.update_info(updates=new_updates)
-```
-
-[start_update]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.metadata_template.MetadataTemplate.start_update
-[update_info]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.metadata_template.MetadataTemplate.update_info
-
-Update a classification
------------------------
-
-To update a classification, call the
-[`template.start_update()`][start_update] API to start making changes to the
-template, and then call the [`template.update_info(updates=new_updates)`][update_info]
-with the classification to change on the template.
-
-
-```python
-template = client.metadata_template('enterprise', 'securityClassification-6VMVochwUWo')
-new_updates = template.start_update()
-new_updates.edit_enum_option('Box__Security__Classification__Key', 'Sensitive', 'Very Sensitive')
-updated_template = template.update_info(updates=new_updates)
-```
-
-Add classification to file
---------------------------
-
-To add a classification to a file, call
-[`file.metadata(scope='global', template='properties')`][set-metadata]
-with the name of the classification template, as well as the details of the classification
-to add to the file.
-
-
-```python
-classification = {
- 'Box__Security__Classification__Key': 'Sensitive',
-}
-applied_metadata = client.file(file_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').set(classification)
-```
-
-[set-metadata]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.item.Item.metadata
-
-Update classification on file
------------------------------
-
-To update a classification on a file, call
-[`file.metadata(scope='global', template='properties')`][update-metadata]
-with the name of the classification template, as well as the details of the classification
-to add to the file.
-
-
-```python
-classification = {
- 'Box__Security__Classification__Key': 'Sensitive',
-}
-applied_metadata = client.file(file_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').set(classification)
-```
-
-[update-metadata]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.item.Item.metadata
-
-Get classification on file
---------------------------
-
-Retrieve the classification on a file by calling
-[`file.metadata(scope='global', template='properties').get()`](https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.metadata.Metadata.get)
-on a file.
-
-
-```python
-metadata = client.file(file_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').get()
-```
-
-Remove classification from file
--------------------------------
-
-A classification can be removed from a file by calling
-[`file.metadata(scope='global', template='properties').delete()`](https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.metadata.Metadata.delete).
-
-
-```python
-client.file(file_id='11111').metadata(scope='securityClassification-6VMVochwUWo', template='myMetadata').delete()
-```
-
-
-
-Add classification to folder
---------------------------
-
-To add a classification to a folder, call
-[`folder.metadata(scope='global', template='properties')`][set-metadata]
-with the name of the classification template, as well as the details of the classification
-to add to the folder.
-
-
-```python
-classification = {
- 'Box__Security__Classification__Key': 'Sensitive',
-}
-applied_metadata = client.folder(folder_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').set(classification)
-```
-
-[set-metadata]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.item.Item.metadata
-
-Update classification on folder
------------------------------
-
-To update a classification on a folder, call
-[`folder.metadata(scope='global', template='properties')`][update-metadata]
-with the name of the classification template, as well as the details of the classification
-to add to the folder.
-
-
-```python
-classification = {
- 'Box__Security__Classification__Key': 'Sensitive',
-}
-applied_metadata = client.folder(folder_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').set(classification)
-```
-
-[update-metadata]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.item.Item.metadata
-
-Get classification on folder
---------------------------
-
-Retrieve the classification on a folder by calling
-[`folder.metadata(scope='global', template='properties').get()`](https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.metadata.Metadata.get)
-on a folder.
-
-
-```python
-metadata = client.folder(folder_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').get()
-```
-
-Remove classification from folder
--------------------------------
-
-A classification can be removed from a folder by calling
-[`folder.metadata(scope='global', template='properties').delete()`](https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.metadata.Metadata.delete).
-
-
-```python
-client.folder(folder_id='11111').metadata(scope='securityClassification-6VMVochwUWo', template='myMetadata').delete()
-```
diff --git a/docs/usage/collaboration.md b/docs/usage/collaboration.md
deleted file mode 100644
index 871a7ea20..000000000
--- a/docs/usage/collaboration.md
+++ /dev/null
@@ -1,180 +0,0 @@
-Collaborations
-==============
-
-Collaborations are used to share folders between users or groups. They also
-define what permissions a user has for a folder.
-
-
-
-
-
-- [Add a Collaboration](#add-a-collaboration)
-- [Edit a Collaboration](#edit-a-collaboration)
-- [Remove a Collaboration](#remove-a-collaboration)
-- [Get a Collaboration's Information](#get-a-collaborations-information)
-- [List Collaborations on a Folder or File](#list-collaborations-on-a-folder-or-file)
-- [List Pending Collaborations](#list-pending-collaborations)
-- [Accept or Reject a Pending Collaboration](#accept-or-reject-a-pending-collaboration)
-
-
-
-Add a Collaboration
--------------------
-
-You can add a collaboration on a folder or a file by calling
-[`item.collaborate(accessible_by, role, can_view_path=None, notify=None, fields=None)`][collaborate]. Pass the
-[`User`][user_class] or [`Group`][group_class] to collaborate the item with as the `accessible_by` parameter. The
-`role` parameter determines what permissions the collaborator will have on the folder. This method returns a
-[`Collaboration`][collaboration_class] object representing the new collaboration on the item.
-
-
-```python
-from boxsdk.object.collaboration import CollaborationRole
-
-user = client.user(user_id='11111')
-collaboration = client.folder(folder_id='22222').collaborate(user, CollaborationRole.VIEWER)
-
-collaborator = collaboration.accessible_by
-item = collaboration.item
-has_accepted = 'has' if collaboration.status == 'accepted' else 'has not'
-print(f'{collaborator.name} {has_accepted} accepted the collaboration to folder "{item.name}"')
-```
-
-Alternatively, you can also invite a user with their email address.
-
-```python
-from boxsdk.object.collaboration import CollaborationRole
-
-email_of_invitee = 'testuser@example.com'
-collaboration = client.folder(folder_id='22222').collaborate_with_login(email_of_invitee, CollaborationRole.VIEWER)
-```
-
-Or, you can invite a group using the group id
-
-
-```python
-from boxsdk.object.collaboration import CollaborationRole
-
-group = client.group(group_id='11111')
-collaboration = client.folder(folder_id='22222').collaborate(group, CollaborationRole.VIEWER)
-
-collaborator = collaboration.accessible_by
-item = collaboration.item
-has_accepted = 'has' if collaboration.status == 'accepted' else 'has not'
-print(f'{collaborator.name} {has_accepted} accepted the collaboration to folder "{item.name}"')
-```
-
-> __Note:__ The `can_view_path` parameter is currently only available for collaborations on folders.
-
-[collaborate]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.item.Item.collaborate
-[user_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.user.User
-[group_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.group.Group
-[collaboration_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration.Collaboration
-
-Edit a Collaboration
---------------------
-
-A collaboration can be edited by calling [`collaboration.update_info(*, data=None, role=None, status=None, **kwargs)`][update_info].
-Note that `role` fields is always required when updating a collaboration. This method returns an updated
-[`Collaboration`][collaboration_class] object, leaving the original unmodified.
-
-
-```python
-from boxsdk.object.collaboration import CollaborationRole
-
-collaboration_update = {'role': CollaborationRole.EDITOR, 'can_view_path': False}
-collaboration = client.collaboration(collab_id='12345')
-updated_collaboration = collaboration.update_info(data=collaboration_update)
-```
-
-[update_info]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration.Collaboration.update_info
-
-Remove a Collaboration
-----------------------
-
-A collaboration can be removed by calling [`collaboration.delete()`][delete]. This will generally cause the user or
-group associated with the collaboration to lose access to the item. This method returns `True` to indicate that removal
-succeeded.
-
-
-```python
-collaboration_id = '1111'
-client.collaboration(collaboration_id).delete()
-```
-
-[delete]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.delete
-
-Get a Collaboration's Information
----------------------------------
-
-To get information about a specific collaboration, call [`collaboration.get()`][get]. This method returns a new
-[`Collaboration`][collaboration_class] with fields populated by data from the API.
-
-
-```python
-collaboration = client.collaboration(collab_id='12345').get()
-```
-
-[get]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.get
-
-List Collaborations on a Folder or File
-----------------------------------------
-
-To retrieve all collaborations on a specified [`Folder`][folder_class] or [`File`][file_class], call
-[`item.get_collaborations(limit=None, marker=None, fields=None)`][get_collaborations]. This method returns a
-`BoxObjectCollection` that you can use to iterate over all
-[`Collaboration`][collaboration_class] objects in the collection.
-
-
-```python
-collaborations = client.folder(folder_id='22222').get_collaborations()
-for collab in collaborations:
- target = collab.accessible_by
- print(f'{target.type.capitalize()} {target.name} is collaborated on the folder')
-```
-
-
-```python
-collaborations = client.file(file_id='11111').get_collaborations()
-for collab in collaborations
- target = collab.accessible_by
- print(f'{target.type.capitalize()} {target.name} is collaborated on the file')
-```
-
-[folder_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.folder.Folder
-[file_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File
-[get_collaborations]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.item.Item.get_collaborations
-
-List Pending Collaborations
----------------------------
-
-To retrieve all pending collaborations for the current user, call
-[`client.get_pending_collaborations(limit=None, offset=None, fields=None)`][get_pending_collaborations]. The user can
-accept or reject these collaborations. This method returns a `BoxObjectCollection` that you
-can use to iterate over all pending [`Collaboration`][collaboration_class] objects in the collection.
-
-
-```python
-pending_collaborations = client.get_pending_collaborations()
-for pending_collaboration in pending_collaborations:
- print(f'Collaboration {pending_collaboration.id} is pending')
-```
-
-[get_pending_collaborations]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.get_pending_collaborations
-
-Accept or Reject a Pending Collaboration
------------------------------------------
-
-To accept or reject a pending collaboration, call [`collaboration.accept()`][accept] or
-[`collaboration.reject()`][reject]. These methods both return the updated [`Collaboration`][collaboration_class]
-object, leaving the original unmodified.
-
-
-```python
-accepted_collab = client.collaboration(collab_id='12345').accept()
-
-rejected_collab = client.collaboration(collab_id='98765').reject()
-```
-
-[accept]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration.Collaboration.accept
-[reject]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration.Collaboration.reject
diff --git a/docs/usage/collaboration_allowlist.md b/docs/usage/collaboration_allowlist.md
deleted file mode 100644
index 069418c5e..000000000
--- a/docs/usage/collaboration_allowlist.md
+++ /dev/null
@@ -1,148 +0,0 @@
-Collaboration Allowlist
-=======================
-
-The Collaboration Allowlist API allows you to manage a set of approved domains (i.e. a allowlist) that can collaborate
-with your enterprise. You can also manage whether the allowlisted domains are approved for outbound or inbound
-collaboration.
-
-It is important to note that the collaboration allowlist functionality is only available to customers with Box Governance.
-
-
-
-
-
-- [List Collaboration Allowlist Entries](#list-collaboration-allowlist-entries)
-- [Get Information for Collaboration Allowlist Entry](#get-information-for-collaboration-allowlist-entry)
-- [Allowlist a Domain for Collaboration](#allowlist-a-domain-for-collaboration)
-- [Remove a Domain from Allowlist](#remove-a-domain-from-allowlist)
-- [List Exempt Users](#list-exempt-users)
-- [Get Exempt User Information](#get-exempt-user-information)
-- [Exempt User from Allowlist](#exempt-user-from-allowlist)
-- [Remove User Exemption](#remove-user-exemption)
-
-
-
-List Collaboration Allowlist Entries
-------------------------------------
-
-To retrieve a list of collaboration allowlist entries, call
-[`collaboration_allowlist.get_entries(limit=None, marker=None, fields=None)`][get_entries]. This method returns a
-`BoxObjectCollection` which can iterate over the [`CollaborationAllowlistEntry`][entry_class]
-objects in the collection.
-
-
-```python
-allowlist_entries = client.collaboration_allowlist().get_entries()
-for entry in allowlist_entries:
- direction = entry.direction if entry.direction != 'both' else 'bidirectional'
- print(f'Domain {entry.domain} is allowlisted for {direction} collaboration')
-```
-
-[get_entries]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration_allowlist.CollaborationAllowlist.get_entries
-[entry_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration_allowlist_entry.CollaborationAllowlistEntry
-
-Get Information for Collaboration Allowlist Entry
--------------------------------------------------
-
-To get information about a collaboration allowlist entry, use [`collaboration_allowlist_entry.get(*, fields=None, headers=None, **kwargs)`][get].
-This method returns a [`CollaborationAllowlistEntry`][entry_class] object with fields populated by data form the API.
-
-
-```python
-allowlist_entry = client.collaboration_allowlist_entry(entry_id='11111').get()
-```
-
-[get]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.get
-
-Allowlist a Domain for Collaboration
-------------------------------------
-
-To allowlist a domain for collaboration, call [`collaboration_allowlist.add_domain(domain, direction)`][add_domain] with
-the domain to allowlist and the direction(s) collaboration should be allowed in. This method returns a
-[`CollaborationAllowlistEntry`][entry_class] object representing the newly-allowlisted domain.
-
-You can determine the direction of the allowlist by passing in 'outbound', 'inbound', or 'both'. Outbound collaboration
-is defined as a user in your enterprise collaborating on content owned by someone outside your enterprise. Inbound
-collaboration is defined as a user outside of your enterprise collaborating on content owned by your enterprise.
-
-
-```python
-from boxsdk.object.collaboration_allowlist import AllowlistDirection
-domain = 'example.com'
-allowlist_entry = client.collaboration_allowlist().add_domain(domain, direction=AllowlistDirection.INBOUND)
-```
-
-[add_domain]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration_allowlist.CollaborationAllowlist.add_domain
-
-Remove a Domain from Allowlist
-------------------------------
-
-To remove a collaboration allowlisted domain, call [`collaboration_allowlist_entry.delete()`][delete]. This will remove
-the domain from the allowlist, restricting collaboration to and from users in that domain. This method returns `True`
-to indicate that deletion was successful.
-
-
-```python
-client.collaboration_allowlist_entry(entry_id='11111').delete()
-```
-
-[delete]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.delete
-
-List Exempt Users
------------------
-
-To get all exempt users from the collaboration allowlist, call
-[`collaboration_allowlist.get_exemptions(limit=None, marker=None, fields=None)`][get_exemptions]. This method returns
-a `BoxObjectCollection` that allows you to iterate over each
-[`CollaborationAllowlistExemptTarget`][exemption_class] in the collection.
-
-
-```python
-exemptions = client.collaboration_allowlist().get_exemptions()
-for exemption in exemptions:
- print(f'{exemption.user.name} (ID: {exemption.user.id}) is exempt from the collaboration allowlist')
-```
-
-[get_exemptions]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration_allowlist.CollaborationAllowlist.get_exemptions
-[exemption_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration_allowlist_exempt_target.CollaborationAllowlistExemptTarget
-
-Get Exempt User Information
----------------------------
-
-To get information about an exempted user, call [`collaboration_allowlist_exempt_target.get(*, fields=None, headers=None, **kwargs)`][get].
-This method will return a [`CollaborationAllowlistExemptTarget][exemption_class] with fields populated by data from the API.
-
-
-```python
-exemption_id = '11111'
-exemption = client.collaboration_allowlist_exempt_target(exemption_id).get()
-```
-
-Exempt User from Allowlist
---------------------------
-
-To exempt a user from the collaboration allowlist, call [`collaboration_allowlist.add_exemption(user)`][add_exemption]
-with the [`User`][user_class] to exempt from the allowlist. This user will no longer be subject to the collaboration
-allowlist, and will be permitted to collaborate with users from any other domain. This method returns a
-[`CollaborationAllowlistExemptTarget`][exemption_class] object representing the exempted user.
-
-
-```python
-user = client.user(user_id='11111')
-exemption = client.collaboration_allowlist().add_exemption(user)
-```
-
-[add_exemption]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collaboration_allowlist.CollaborationAllowlist.add_exemption
-[user_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.user.User
-
-Remove User Exemption
----------------------
-
-To remove a user exemption from the collaboration allowlist, call
-[`collaboration_allowlist_exempt_target.delete()`][delete]. This will remove the exemption and make the user subject to
-the collaboration allowlist again. This method returns `True` to indicate that deletion was successful.
-
-
-```python
-client.collaboration_allowlist_exempt_target(exemption_id='22222').delete()
-```
diff --git a/docs/usage/collections.md b/docs/usage/collections.md
deleted file mode 100644
index 1e42cf932..000000000
--- a/docs/usage/collections.md
+++ /dev/null
@@ -1,81 +0,0 @@
-Collections
-===========
-
-Collections allow users to mark specific files, folders and web links to make it easier to find them.
-
-
-
-
-- [Get a User's Collections](#get-a-users-collections)
-- [Get the Items in a Collection](#get-the-items-in-a-collection)
-- [Add an Item to a Collection](#add-an-item-to-a-collection)
-- [Remove an Item from a Collection](#remove-an-item-from-a-collection)
-
-
-
-Get a User's Collections
-------------------------
-
-To get all collections belonging to a user, call [`client.collections(limit=None, offset=0, fields=None)`][collections].
-This method returns a `BoxObjectCollection` that you can use to iterate over all the
-[`Collection`][collection_class] objects in the set.
-
-
-```python
-collections = client.collections()
-for collection in collections:
- print(f'Collection "{collection.name}" has ID {collection.id}')
-```
-
-[collections]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.collections
-[collection_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collection.Collection
-
-Get the Items in a Collection
------------------------------
-
-To retrieve a list of items contained in a collection, call
-[`collection.get_items(limit=None, offset=0, fields=None)`][get_items]. This method returns a
-`BoxObjectCollection` that you can use to iterate over all the [`BaseItem`][base_item_class] objects in
-the collection. [`BaseItem`][base_item_class] is a super class for files, folders and web links.
-
-
-```python
-items = client.collection(collection_id='12345').get_items()
-for item in items:
- print(f'{item.type.capitalize()} "{item.name}" is in the collection')
-```
-
-[get_items]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.collection.Collection.get_items
-[base_item_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_item.BaseItem
-
-Add an Item to a Collection
-----------------------
-
-To add an [`BaseItem`][base_item_class] to a collection, call [`item.add_to_collection(collection)`][add_to_collection] with the
-[`Collection`][collection_class] you want to add the item to. This method returns the updated [`BaseItem`][base_item_class]
-object.
-
-
-```python
-collection = client.collection(collection_id='12345')
-updated_file = client.file(file_id='11111').add_to_collection(collection)
-print(f'File "{updated_file.name}" added to collection!')
-```
-
-[add_to_collection]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_item.BaseItem.add_to_collection
-
-Remove an Item from a Collection
----------------------------
-
-To remove an [`BaseItem`][base_item_class] from a collection, call
-[`item.remove_from_collection(collection)`][remove_from_collection] with the [`Collection`][collection_class] you want
-to remove the item from. This method returns the updated [`BaseItem`][base_item_class] object.
-
-
-```python
-collection = client.collection(collection_id='12345')
-updated_file = client.file(file_id='11111').remove_from_collection(collection)
-print(f'File "{updated_file.name}" removed from collection!')
-```
-
-[remove_from_collection]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_item.BaseItem.remove_from_collection
diff --git a/docs/usage/comments.md b/docs/usage/comments.md
deleted file mode 100644
index 04ef71499..000000000
--- a/docs/usage/comments.md
+++ /dev/null
@@ -1,123 +0,0 @@
-Comments
-========
-
-Comment objects represent a user-created comment on a file. They can be added directly to a file.
-
-
-
-
-
-- [Get Information About a Comment](#get-information-about-a-comment)
-- [Get the Comments on a File](#get-the-comments-on-a-file)
-- [Add a Comment to a File](#add-a-comment-to-a-file)
-- [Reply to a Comment](#reply-to-a-comment)
-- [Edit a Comment](#edit-a-comment)
-- [Delete a Comment](#delete-a-comment)
-
-
-
-Get Information About a Comment
--------------------------------
-
-To get a specific comment object, first call `[client.comment(comment_id)`][comment] to construct the appropriate
-[`Comment`][comment_class] object, and then call [`comment.get(*, fields=None, headers=None, **kwargs)`][get] to
-retrieve the data about the comment. The latter method returns a new [`Comment`][comment_class] object with fields
-populated by data from the API, leaving the original unmodified.
-
-
-```python
-comment = client.comment(comment_id='55555').get()
-print(f'The comment says "{comment.message}"')
-```
-
-[comment]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.comment
-[get]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.get
-[comment_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.comment.Comment
-
-Get the Comments on a File
---------------------------
-
-To retrieve the comment left on a file, call [`file.get_comments(limit=None, offset=0, fields=None)`][get_comments].
-This method returns a `BoxObjectCollection` that you can use to iterate over all the
-[`Comment`][comment_class] objects in the set.
-
-
-```python
-comments = client.file(file_id='11111').get_comments()
-for comment in comments:
- print(f'Comment was left by {comment.created_by.name} at {comment.created_at}')
-```
-
-[get_comments]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.get_comments
-
-Add a Comment to a File
------------------------
-
-To leave a comment on a file, call [`file.add_comment(message)`][add_comment] with the message to leave in the comment.
-
-
-```python
-comment = client.file(file_id='11111').add_comment('When should I have this done by?')
-```
-
-You can at-mention other users by adding special tags within the message, in the format `@[USER_ID:USER_NAME]`. For
-example, to at-mention John Doe, whose user ID is `"33333"`: `@[33333:John Doe]`.
-
-
-```python
-comment = client.file(file_id='11111').add_comment('Hey @[44444:boss], when should I have this done by?')
-```
-
-This method returns a [`Comment`][comment_class] object representing the newly-created comment.
-
-[add_comment]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.add_comment
-
-Reply to a Comment
-------------------
-
-To reply to a comment, call [`comment.reply(message)`][reply] with the message to leave in the comment.
-
-
-```python
-reply_comment = client.comment(comment_id='12345').reply('If possible, please finish this by the end of the week!')
-```
-
-You can at-mention other users by adding special tags within the message, in the format `@[USER_ID:USER_NAME]`. For
-example, to at-mention John Doe, whose user ID is `"33333"`: `@[33333:John Doe]`.
-
-
-```python
-reply_comment = client.comment(comment_id='12345').reply('@[33333:John Doe], if possible, please finish this by the end of the week!')
-```
-
-This method returns a [`Comment`][comment_class] object representing the newly-created comment.
-
-[reply]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.comment.Comment.reply
-
-Edit a Comment
---------------
-
-To edit a comment and change its message, call [`comment.edit(message)`][edit] with the message to leave in the comment.
-You can at-mention other users by adding special tags within the message, in the format `@[USER_ID:USER_NAME]`. For
-example, to at-mention John Doe, whose user ID is `"33333"`: `@[33333:John Doe]`. This method returns an updated
-[`Comment`][comment_class] object, leaving the original unmodified.
-
-
-```python
-edited_comment = client.comment(comment_id='98765').edit('If possible, please finish this by Friday!')
-```
-
-[edit]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.comment.Comment.edit
-
-Delete a Comment
-----------------
-
-To delete a comment, call [`comment.delete()`][delete]. This will remove the comment from the file. This method
-returns `True` to indicate that the deletion succeeded.
-
-
-```python
-client.comment(comment_id='12345').delete()
-```
-
-[delete]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.delete
diff --git a/docs/usage/configuration.md b/docs/usage/configuration.md
deleted file mode 100644
index c12848d14..000000000
--- a/docs/usage/configuration.md
+++ /dev/null
@@ -1,83 +0,0 @@
-Configuration
-=============
-
-The Python SDK has helpful custom config that you can set for a variety of use cases.
-
-
-
-
-- [Proxy](#proxy)
- - [Unauthenticated Proxy](#unauthenticated-proxy)
- - [Basic Authentication Proxy](#basic-authentication-proxy)
-- [Configure URLs](#configure-urls)
- - [Base URL](#base-url)
- - [OAUTH2 URLs](#oauth2-urls)
- - [Upload URL](#upload-url)
-- [Max retry attmepts](#max-retry-attmepts)
-
-
-
-Proxy
------
-
-### Unauthenticated Proxy
-
-In order to set up configuration for basic proxy with the Python SDK, simply specify the proxy address for the `Proxy.URL` field.
-
-```python
-from boxsdk.config import Proxy
-Proxy.URL = 'http://example-proxy-address.com'
-```
-
-### Basic Authentication Proxy
-
-The Python SDK also lets you set an authenticated proxy. To do this, specify the `user` and `password` fields and pass set that on the `Proxy.AUTH` field.
-
-```python
-from boxsdk.config import Proxy
-Proxy.AUTH = {
- 'user': 'test_user',
- 'password': 'test_password',
-}
-```
-
-URLs configuration
-------------------
-
-### Base URL
-The default base URL used for making API calls to Box can be changed by setting the value of the `API.BASE_API_URL` field.
-
-```python
-from boxsdk.config import API
-API.BASE_API_URL = 'https://new-base-url.com'
-```
-
-### OAUTH2 URLs
-The default URLs used to authorize a user and obtain OAuth2 authorization tokens can be modified by overwriting
-`API.OAUTH2_API_URL` and `API.OAUTH2_AUTHORIZE_URL` constants.
-
-```python
-from boxsdk.config import API
-API.OAUTH2_API_URL = 'https://my-company.com/oauth2'
-API.OAUTH2_AUTHORIZE_URL = 'https://my-company.com/authorize'
-```
-
-### Upload URL
-The default URL used when uploading files to Box can be changed by assigning a new value to the `API.UPLOAD_URL` field.
-If this variable is ever changed from default value, the SDK will alwayse use this URL to upload files to Box,
-even if `use_upload_session_urls` is set to `True` while creating an upload session for a chunked upload.
-
-```python
-from boxsdk.config import API
-API.UPLOAD_URL = 'https://my-company-upload-url.com'
-```
-
-Max retry attmepts
-------------------
-
-The default maximum number of retries in case of failed API call is 5 (usually 202, 429 and >= 500 response codes are retried).
-To change this number you can set `API.MAX_RETRY_ATTEMPTS` field.
-```python
-from boxsdk.config import API
-API.MAX_RETRY_ATTEMPTS = 6
-```
diff --git a/docs/usage/device_pin.md b/docs/usage/device_pin.md
deleted file mode 100644
index 08628b5e2..000000000
--- a/docs/usage/device_pin.md
+++ /dev/null
@@ -1,63 +0,0 @@
-Device Pins
-===========
-
-Device pinning is a feature that allows enterprise admins to pin their user’s
-corporate-managed Box account to a particular mobile device or Box Sync client.
-
-
-
-
-
-- [List Enterprise Device Pins](#list-enterprise-device-pins)
-- [Get Device Pin Information](#get-device-pin-information)
-- [Delete Device Pin](#delete-device-pin)
-
-
-
-List Enterprise Device Pins
----------------------------
-
-To retrieve all device pins for an enterprise, call
-[`client.device_pinners(enterprise=None, limit=None, marker=None, direction=None, fields=None)`][device_pinners].
-If an `enterprise` is not specified, this defaults to the current enterprise. This method returns a
-`BoxObjectCollection` that allows you to iterate over the [`DevicePinner`][device_pin_class] objects in the collection.
-
-
-```python
-device_pins = client.device_pinners()
-for pin in device_pins:
- print(f'Pinned {pin.product_name} device for {pin.owned_by.name}')
-```
-
-[device_pinners]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.device_pinners
-[device_pin_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.device_pinner.DevicePinner
-
-Get Device Pin Information
---------------------------
-
-To get information about a specific device pin, call [`device_pinner.get(*, fields=None, headers=None, **kwargs)`][get].
-This method returns a new [`DevicePinner`][device_pin_class] object with fields populated by data from the API.
-
-
-```python
-device_pin_id = '1111'
-device_pin = client.device_pinner(device_pin_id).get()
-print(f'{pin.product_name} device for {pin.owned_by.name} is pinned')
-```
-
-[get]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.get
-
-Delete Device Pin
------------------
-
-To delete a specific device pin, call [`device_pinner.delete()`][delete]. This method returns `True` to indicate that
-the deletion was successful.
-
-
-```python
-device_pin_id = '1111'
-client.device_pin(device_pin_id).delete()
-print('Device pin deleted!')
-```
-
-[delete]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.delete
diff --git a/docs/usage/events.md b/docs/usage/events.md
deleted file mode 100644
index 34946205c..000000000
--- a/docs/usage/events.md
+++ /dev/null
@@ -1,151 +0,0 @@
-Events
-======
-
-It is possible to poll the Box API for events, in order to get information about activity within Box as it happens.
-
-The Box API supports two types of event streams: one for the events specific to a particular user and one for all of
-the events in an enterprise.
-
-
-
-
-
-- [User Events](#user-events)
- - [Listening to the Event Stream](#listening-to-the-event-stream)
- - [Get the Current Stream Position](#get-the-current-stream-position)
- - [Get Events Manually](#get-events-manually)
-- [Enterprise Events](#enterprise-events)
- - [Get Events Manually](#get-events-manually-1)
-
-
-
-User Events
------------
-
-The Box API provides an events endpoint that utilizes long-polling to send events in real-time. The SDK provides a
-generator that automatically handles long-polling and deduplicating events.
-
-### Listening to the Event Stream
-
-To automatically receive events as they happen, call
-[`events.generate_events_with_long_polling(stream_position=None, stream_type=UserEventsStreamType.ALL)`][generator] and iterate over
-the results. By default, this will start listening for events from the current time onward; to get all available events,
-pass a `stream_position` of `0`. The generator yields [`Event`][event_class] objects representing each event.
-
-
-```python
-events = client.events().generate_events_with_long_polling()
-for event in events:
- print(f'Got {event.event_type} event')
-```
-
-[generator]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.events.Events.generate_events_with_long_polling
-[event_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.event.Event
-
-### Get the Current Stream Position
-
-It is possible to get the current stream position, which can later be used to fetch events from that point in time
-forward, by calling [`events.get_latest_stream_position(stream_type=UserEventsStreamType.ALL)`][get_stream_position].
-This method returns the current stream position value as an `int`.
-
-```python
-stream_position = client.events().get_latest_stream_position()
-print(f'The current stream position is {stream_position}')
-```
-
-[get_stream_position]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.events.Events.get_latest_stream_position
-
-### Get Events Manually
-
-To manually retrieve a set of events, call
-[`events.get_events(limit=100, stream_position=0, stream_type=UserEventsStreamType.ALL)`][get_events]. By default, this
-will fetch the first available events chronologically; you can pass a specific `stream_position` to get events from a
-particular time. This method returns a `dict` with the relevant [`Event`][event_class] objects in a `list` under the
-`entries` key and the next stream position value under the `next_stream_position` key.
-
-
-```python
-stream_position = 0
-events = client.events().get_events(stream_position=stream_position)
-stream_position = events['next_stream_position']
-for event in events['entries']:
- print(f'Got {event.event_type} event that occurred at {event.created_at}')
-```
-
-[get_events]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.events.Events.get_events
-
-Enterprise Events
------------------
-
-Currently, the SDK only provides a manual interface for retrieving Enterprise (or Admin) Events.
-
-### Get Events Manually
-
-To manually retrieve a set of admin events, call
-[`events.get_events(limit=100, stream_position=0, stream_type=UserEventsStreamType.ALL)`][get_events] with `stream_type`
-set to `EnterpriseEventsStreamType.ADMIN_LOGS`. By default, this will fetch the first available events chronologically;
-you can pass a specific `stream_position` to get events from a particular time. This method returns a `dict` with the
-relevant [`Event`][event_class] objects in a `list` under the `entries` key and the next stream position value under the
-`next_stream_position` key.
-
-```python
-from boxsdk.object.events import EnterpriseEventsStreamType
-
-stream_position = 0
-events = client.events().get_events(stream_type=EnterpriseEventsStreamType.ADMIN_LOGS, stream_position=stream_position)
-stream_position = events['next_stream_position']
-for event in events['entries']:
- print(f'Got {event.event_type} event that occurred at {event.created_at}')
-```
-
-### Get Admin Events
-
-The SDK also allows you to retrieve enterprise events. Use [`events.get_admin_events_streaming(self, limit=None, stream_position=0, event_types=None)`] for live monitoring (events up to two weeks, low latency) and [`events.get_admin_events(self, limit=None, stream_position=0, created_after=None, created_before=None, event_types=None)`] for historical querying (events up to one year, higher latency).
-If `limit` param is set to None, then default API value (limit=100) will be used.
-Live monitoring example
-
-
-```python
- events = client.events()
- .get_admin_events_streaming()
- for event in events['entries']:
- print(f'Got {event.event_type} event that occurred at {event.created_at}')
-```
-
-Addditionally, a list of event types can be passed along to filter down the returned events.
-
-
-```python
- events = client.events()
- .get_admin_events_streaming(event_types=['ITEM_CREATE'])
- for event in events['entries']:
- print(f'Got {event.event_type} event that occurred at {event.created_at}')
-```
-
-When using historical querying you can specify before and after a certain datetime and the types of events to retrieve with the `event_type` by calling
-[`events.get_admin_events(self, limit=None, stream_position=0, created_after=None, created_before=None, event_types=None)`][admin_events_details].
-If `limit` param is set to None, then default API value (limit=100) will be used.
-The format for the `created_after` and `created_before` fields are supported by [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) and look
-something like this: 2019-08-12T09:12:36-00:00. For more information on the date format please see [here](https://developer.box.com/en/guides/api-calls/types-and-formats/#date-and-times).
-This method returns a `dict` with the relevant [`Event`][event_class] objects in a `list` under the
-`entries` key and the next stream position value under the `next_stream_position` key.
-
-
-```python
- events = client.events()
- .get_admin_events(created_after='2019-07-01T22:02:24-07:00')
- for event in events['entries']:
- print(f'Got {event.event_type} event that occurred at {event.created_at}')
-```
-
-Addditionally, a list of event types can be passed along to filter down the returned events.
-
-
-```python
- events = client.events()
- .get_admin_events(created_after='2019-07-01T22:02:24-07:00', event_types=['ITEM_CREATE'])
- for event in events['entries']:
- print(f'Got {event.event_type} event that occurred at {event.created_at}')
-```
-
-[admin_events_details]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.events.Events.get_admin_events
diff --git a/docs/usage/file_request.md b/docs/usage/file_request.md
deleted file mode 100644
index 8ecdb0cc3..000000000
--- a/docs/usage/file_request.md
+++ /dev/null
@@ -1,79 +0,0 @@
-File Requests
-=============
-
-File request objects represent a file request associated with a folder.
-
-
-
-
-- [Get a File Request's Information](#get-a-file-requests-information)
-- [Copy a File Request's Information](#copy-a-file-requests-information)
-- [Update a File Request's Information](#update-a-file-requests-information)
-- [Delete a File Request](#delete-a-file-request)
-
-
-
-Get a File Request's Information
-------------------------
-
-To get a file request object, first call [`client.file_request(file_request_id)`][file_request] to construct the appropriate [`FileRequest`][file_request_class] object, and then calling [`file_request.get(*, fields=None, headers=None, **kwargs)`][get] will return the [`FileRequest`][file_request_class] object populated with data
-from the API, leaving the original object unmodified.
-
-
-```python
-file_request = client.file_request(file_request_id='123456').get()
-print(f'File request {file_request.id} on folder {file_request.folder.name}')
-```
-
-[file_request]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html#boxsdk.client.client.Client.file_request
-[file_request_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file_request.FileRequest
-[get]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.get
-
-
-Copy a File Request's Information
----------------------------
-
-To copy a file request, first call [`client.file_request(file_request_id)`][file_request] to construct the appropriate [`FileRequest`][file_request_class] object, and then calling [`file_request.copy(folder, description=None, title=None, expires_at=None, require_description=None, require_email=None, status=None)`][copy]. It will return the [`FileRequest`][file_request_class] object populated with data new created file request from the API.
-
-
-```python
-file_request = client.file_request(file_request_id='123456')
-folder = client.folder(folder_id='123456789')
-new_file_request = file_request.copy(folder=folder, title="Copied file request")
-```
-
-[file_request_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file_request.FileRequest
-[copy]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file_request.FileRequest.copy
-
-Update a File Request's Information
----------------------------
-
-To update a file request object, call [`file_request.update_info(data=file_request_update)`][update_info] with a `dict` of properties to
-update on the file request. This method returns a newly updated [`FileRequest`][file_request_class] object, leaving the original object unmodified.
-
-
-```python
-from boxsdk.object.file_request import StatusState
-update_data = {
- "description": 'Updated description',
- "is_email_required": True,
- "status": StatusState.ACTIVE
-}
-file_request.update_info(data=update_data)
-```
-
-[update_info]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.update_info
-[file_request_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file_request.FileRequest
-
-Delete a File Request
--------------
-
-To delete a file request, call [`file_request.delete()`][delete], it deletes a file request permanently.
-
-
-```python
-file_request = client.file_request(file_request_id='123456')
-file_request.delete()
-```
-
-[delete]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.delete
\ No newline at end of file
diff --git a/docs/usage/files.md b/docs/usage/files.md
deleted file mode 100644
index a4f67de87..000000000
--- a/docs/usage/files.md
+++ /dev/null
@@ -1,1060 +0,0 @@
-Files
-=====
-
-File objects represent individual files in Box. They can be used to download a
-file's contents, upload new versions, and perform other common file operations
-(move, copy, delete, etc.).
-
-
-
-
-- [Files](#files)
- - [Get a File's Information](#get-a-files-information)
- - [Update a File's Information](#update-a-files-information)
- - [Download a File](#download-a-file)
- - [Get Download URL](#get-download-url)
- - [Upload a File](#upload-a-file)
- - [Chunked Upload](#chunked-upload)
- - [Automatic Uploader](#automatic-uploader)
- - [Upload new file](#upload-new-file)
- - [Upload new file version](#upload-new-file-version)
- - [Preflight check before upload](#preflight-check-before-upload)
- - [Resume Upload](#resume-upload)
- - [Abort Chunked Upload](#abort-chunked-upload)
- - [Manual Process](#manual-process)
- - [Create Upload Session for File Version](#create-upload-session-for-file-version)
- - [Create Upload Session for File](#create-upload-session-for-file)
- - [Upload Part](#upload-part)
- - [Commit Upload Session](#commit-upload-session)
- - [Abort Upload Session](#abort-upload-session)
- - [List Upload Parts](#list-upload-parts)
- - [Move a File](#move-a-file)
- - [Copy a File](#copy-a-file)
- - [Rename a File](#rename-a-file)
- - [Delete a File](#delete-a-file)
- - [Get Previous Versions of a File](#get-previous-versions-of-a-file)
- - [Upload a New Version of a File](#upload-a-new-version-of-a-file)
- - [Promote a Previous Version of a File](#promote-a-previous-version-of-a-file)
- - [Delete a Previous Version of a File](#delete-a-previous-version-of-a-file)
- - [Lock a File](#lock-a-file)
- - [Unlock a File](#unlock-a-file)
- - [Create a Shared Link Download URL](#create-a-shared-link-download-url)
- - [Find a File for a Shared Link](#find-a-file-for-a-shared-link)
- - [Create or update a Shared Link](#create-or-update-a-shared-link)
- - [Get a Shared Link](#get-a-shared-link)
- - [Remove a Shared Link](#remove-a-shared-link)
- - [Get an Embed Link](#get-an-embed-link)
- - [Get File Representations](#get-file-representations)
- - [Get Thumbnail (Deprecated)](#get-thumbnail-deprecated)
- - [Get Thumbnail](#get-thumbnail)
- - [Set Metadata](#set-metadata)
- - [Get Metadata](#get-metadata)
- - [Remove Metadata](#remove-metadata)
- - [Get All Metadata](#get-all-metadata)
- - [Set a Classification](#set-a-classification)
- - [Retrieve a Classification](#retrieve-a-classification)
- - [Remove a Classification](#remove-a-classification)
- - [Set retention policy expiration date](#set-retention-policy-expiration-date)
-
-
-
-Get a File's Information
-------------------------
-
-Calling [`file.get(*, fields=None, etag=None, **kwargs)`][get_info] on a [`File`][file_class] retrieves information
-about the file from the API. This method returns a new [`File`][file_class] object populated with the information retrieved.
-
-You can specify an `Iterable` of fields to retrieve from the API in the `fields` parameter.
-
-
-```python
-file_id = '11111'
-file_info = client.file(file_id).get()
-print(f'File "{file_info.name}" has a size of {file_info.size} bytes')
-```
-
-[get_info]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_object.BaseObject.get
-[file_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File
-
-Update a File's Information
----------------------------
-
-To update fields on the [`File`][file_class] object, call [`file.update_info(data=data_to_update)`][update_info] with
-a `dict` of fields to update. This method returns the updated [`File`][file_class] object, leaving the original it
-was called on unmodified.
-
-
-```python
-file_id = '11111'
-updated_file = client.file(file_id).update_info(data={'description': 'My file'})
-```
-
-Download a File
----------------
-
-A file can be downloaded in two ways: by returning the entire contents of the file as `bytes` or by providing an output
-stream to which the contents of the file will be written. For both methods, you can optionally download a specific
-version of the file by passing the desired [`FileVersion`][file_version_class] in the `file_version` parameter. You may
-also wish to download only a certain chunk of the file by passing a tuple of byte offsets via the `byte_range`
-parameter — the lower and upper bounds you wish to download.
-
-To get the entire contents of the file as `bytes`, call [`file.content(file_version=None, byte_range=None)`][content].
-
-
-```python
-file_id = '11111'
-file_content = client.file(file_id).content()
-```
-
-For users with premium accounts, previous versions of a file can be downloaded.
-
-
-```python
-file_id = '11111'
-file_version = client.file_version('12345')
-version_content = client.file(file_id).content(file_version=file_version)
-```
-
-Additonally, only a part of the file can be downloaded by specifying a byte range.
-
-```python
-file_id = '11111'
-beginning_of_file_content = client.file(file_id).content(byte_range=(0,99))
-```
-
-To download the file contents to an output stream, call
-[`file.download_to(writeable_stream, file_version=None, byte_range=None)`][download_to] with the stream.
-
-```python
-file_id = '11111'
-
-# Write the Box file contents to disk
-with open('file.pdf', 'wb') as output_file:
- client.file(file_id).download_to(output_file)
-```
-
-[file_version_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file_version.FileVersion
-[content]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.content
-[download_to]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.download_to
-
-Get Download URL
-----------------
-
-To get a download URL suitable for passing to a web browser or other application, which will allow someone to download
-the file, call [`file.get_download_url(file_version=None)`][get_download_url]. The will return a `unicode` string
-containing the file's download URL. You can optionally pass a [`FileVersion`][file_version_class] via the
-`file_version` parameter to get a download URL for a specific version of the file.
-
-
-```python
-file_id = '11111'
-download_url = client.file(file_id).get_download_url()
-print(f'The file\'s download URL is: {download_url}')
-```
-
-[get_download_url]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.get_download_url
-
-Upload a File
--------------
-
-Files are uploaded to a folder in one of two ways: by providing a path to a file on disk, or via a readable stream
-containing the file contents.
-
-To upload a file from a path on disk, call the
-[`folder.upload(file_path, file_name=None, file_description=None,preflight_check=False, preflight_expected_size=0)`][upload] method
-on the [`Folder`][folder_class] you want to upload the file into. By default, the file uploaded to Box will have the
-same file name as the one on disk; you can override this by passing a different name in the `file_name` parameter. You can, optionally, also choose to set a file description upon upload by using the `file_description` parameter.
-This method returns a [`File`][file_class] object representing the newly-uploaded file.
-
-
-```python
-folder_id = '22222'
-new_file = client.folder(folder_id).upload('/home/me/document.pdf')
-print(f'File "{new_file.name}" uploaded to Box with file ID {new_file.id}')
-```
-
-To upload a file from a readable stream, call
-[`folder.upload_stream(file_stream, file_name, file_description=None, preflight_check=False, preflight_expected_size=0)`][upload_stream]
-with the stream and a name for the file. This method returns a [`File`][file_class] object representing the
-newly-uploaded file.
-
-```python
-file_name = 'file.pdf'
-stream = open('/path/to/file.pdf', 'rb')
-
-folder_id = '22222'
-new_file = client.folder(folder_id).upload_stream(stream, file_name)
-print(f'File "{new_file.name}" uploaded to Box with file ID {new_file.id}')
-```
-
-----
-**NOTE:**
-
-Both methods `folder.upload()` and `folder.upload_stream()` include the `stream_file_content` parameter,
-which controls how the file content is uploaded.
-
-If you are uploading a large file, you may want to stream the request to avoid excessive memory usage.
-According to `requests'` library [docs][request_docs], by default, the `requests` library does not support streaming uploads,
-and all the data must be read into memory before being sent to the server.
-However, the `requests-toolbelt` package includes a `MultipartEncoder` class, which enables file uploads without
-loading the entire file into memory. This approach is the default in the Box Python SDK.
-
-That said, handling 307 Temporary Redirects presents a challenge with streamed file uploads.
-307 redirect requires that both the request method and body remain unchanged.
-This can be problematic when uploading a file stream because the stream will already be exhausted when the redirect occurs.
-
-To address this issue, the `stream_file_content` parameter has been introduced in upload methods. This allows you to choose between:
- - Streaming the file (`stream_file_content=True`): Optimizes memory usage but may cause issues with redirects.
-
- - Using the default `requests'` library behavior (`stream_file_content=False`): Ensures the file can be re-read if a
- redirect occurs but may consume more memory. This is especially important when working with proxy servers.
-
-[folder_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.folder.Folder
-[upload]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.folder.Folder.upload
-[upload_stream]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.folder.Folder.upload_stream
-[request_docs]: https://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
-
-Chunked Upload
---------------
-
-For large files or in cases where the network connection is less reliable,
-you may want to upload the file in parts. This allows a single part to fail
-without aborting the entire upload, and failed parts can then be retried.
-
-Since box-python-sdk 3.11.0 release, by default the SDK uses upload urls provided in response
-when creating a new upload session. This allowes to always upload your content to the closest Box data center and
-can significantly improve upload speed. You can always disable this feature and always use base upload url by
-setting `use_upload_session_urls` flag to `False` when creating upload session.
-
-### Automatic Uploader
-
-Since box-python-sdk 3.7.0 release, automatic uploader uses multiple threads, which significantly speeds up the upload process.
-By default, automatic chunked uploader will use 5 threads.
-You can change this number by setting `API.CHUNK_UPLOAD_THREADS` to a new number.
-
-```python
-from boxsdk.config import API
-API.CHUNK_UPLOAD_THREADS = 6
-```
-
-#### Upload new file
-
-The SDK provides a method of automatically handling a chunked upload. First get a folder you want to upload the file to.
-Then call [`folder.get_chunked_uploader(file_path, rename_file=False, use_upload_session_urls=True)`][get_chunked_uploader_for_file]
-to retrieve a [`ChunkedUploader`][chunked_uploader_class] object. Setting `use_upload_session_urls` to `True` inilializes
-the uploader that utlizies urls returned by the `Create Upload Session` endpoint response unless a custom
-API.UPLOAD_URL was set in the config. Setting `use_upload_session_urls` to `False` inilializes the uploader that uses always base upload urls.
-Calling the method [`chunked_upload.start()`][start] will kick off the chunked upload process and return the [File][file_class]
-object that was uploaded.
-
-
-```python
-# uploads large file to a root folder
-chunked_uploader = client.folder('0').get_chunked_uploader(file_path='/path/to/file.txt', file_name='new_name.txt')
-uploaded_file = chunked_uploader.start()
-print(f'File "{uploaded_file.name}" uploaded to Box with file ID {uploaded_file.id}')
-```
-
-You can also upload file stream by creating a [`UploadSession`][upload_session_class] first. This can be done by calling
-[`folder.create_upload_session(file_size, file_name=None, use_upload_session_urls=True)`][create_upload_session] method.
-`use_upload_session_urls` flag is used to determine if the upload session should use urls returned by
-the `Create Upload Session` endpoint or should it always use base upload urls. Then you can call
-method [`upload_session.get_chunked_uploader_for_stream(content_stream, file_size)`][get_chunked_uploader_for_stream].
-
-```python
-test_file_path = '/path/to/large_file.mp4'
-with open(test_file_path, 'rb') as content_stream:
- total_size = os.stat(test_file_path).st_size
- upload_session = client.folder('0').create_upload_session(file_size=total_size, file_name='large_file.mp4')
- chunked_uploader = upload_session.get_chunked_uploader_for_stream(content_stream=content_stream, file_size=total_size)
- uploaded_file = chunked_uploader.start()
- print(f'File "{uploaded_file.name}" uploaded to Box with file ID {uploaded_file.id}')
-```
-
-#### Upload new file version
-
-To upload a new file version for a large file, first get a file you want to replace.
-Then call [`file.get_chunked_uploader(file_path, rename_file=False, use_upload_session_urls=True)`][get_chunked_uploader_for_version]
-to retrieve a [`ChunkedUploader`][chunked_uploader_class] object. Calling the method [`chunked_upload.start()`][start]
-will kick off the chunked upload process and return the updated [File][file_class].
-
-
-```python
-# uploads new large file version
-chunked_uploader = client.file('existing_big_file_id').get_chunked_uploader(file_path='/path/to/file')
-uploaded_file = chunked_uploader.start()
-print(f'File "{uploaded_file.name}" uploaded to Box with file ID {uploaded_file.id}')
-# the uploaded_file.id will be the same as 'existing_big_file_id'
-```
-
-#### Preflight check before upload
-
-To check if a file can be uploaded with given name to a specific folder call
-[`folder.preflight_check(size, name)`][preflight_check]. If the check did not pass, this method will raise an exception
-including some details on why it did not pass.
-
-
-```python
-file_name = 'large_file.mp4'
-test_file_path = '/path/to/large_file.mp4'
-total_size = os.stat(test_file_path).st_size
-destination_folder_id = '0'
-try:
- client.folder(destination_folder_id).preflight_check(size=total_size, name=file_name)
-except BoxAPIException as e:
- print(f'File {file_name} cannot be uploaded to folder with id: {destination_folder_id}. Reason: {e.message}')
-```
-
-[start]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.chunked_uploader.ChunkedUploader.start
-[chunked_uploader_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.chunked_uploader.ChunkedUploader
-[get_chunked_uploader_for_version]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.get_chunked_uploader
-[get_chunked_uploader_for_file]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.folder.Folder.get_chunked_uploader
-[upload_session_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.upload_session.UploadSession
-[get_chunked_uploader_for_stream]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.upload_session.UploadSession.get_chunked_uploader_for_stream
-[preflight_check]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.folder.Folder.preflight_check
-
-#### Resume Upload
-
-Sometimes an upload can be interrupted, in order to resume uploading where you last left off, simply call the
-[`chunked_uploader.resume()`][resume] method. This will return the [File][file_class] object that was uploaded.
-
-```python
-chunked_uploader = client.file('12345').get_chunked_uploader('/path/to/file')
-try:
- uploaded_file = chunked_uploader.start()
-except:
- uploaded_file = chunked_uploader.resume()
-print(f'File "{uploaded_file.name}" uploaded to Box with file ID {uploaded_file.id}')
-```
-
-[resume]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.chunked_uploader.ChunkedUploader.resume
-
-#### Abort Chunked Upload
-
-To abort a running upload, which cancels all currently uploading chunks and aborts the upload session, call the method
-[`chunked_uploader.abort()`][abort].
-
-```python
-from boxsdk.exception import BoxNetworkException
-
-test_file_path = '/path/to/large_file.mp4'
-content_stream = open(test_file_path, 'rb')
-total_size = os.stat(test_file_path).st_size
-chunked_uploader = client.file('existing_big_file_id').get_chunked_uploader(file_path='/path/to/file')
-try:
- uploaded_file = chunked_uploader.start()
-except BoxNetworkException:
- chunked_uploader.abort()
-```
-
-### Manual Process
-
-For more complicated upload scenarios, such as those being coordinated across multiple processes or when an unrecoverable error occurs with the automatic uploader, the endpoints for chunked upload operations are also exposed directly.
-
-For example, this is roughly how a chunked upload is done manually:
-
-```python
-import hashlib
-import os
-
-
-test_file_path = '/path/to/large_file.mp4'
-total_size = os.stat(test_file_path).st_size
-sha1 = hashlib.sha1()
-content_stream = open(test_file_path, 'rb')
-upload_session = client.folder(folder_id='11111').create_upload_session(file_size=total_size, file_name='test_file_name.mp4')
-part_array = []
-
-for part_num in range(upload_session.total_parts):
-
- copied_length = 0
- chunk = b''
- while copied_length < upload_session.part_size:
- bytes_read = content_stream.read(upload_session.part_size - copied_length)
- if bytes_read is None:
- # stream returns none when no bytes are ready currently but there are
- # potentially more bytes in the stream to be read.
- continue
- if len(bytes_read) == 0:
- # stream is exhausted.
- break
- chunk += bytes_read
- copied_length += len(bytes_read)
-
- uploaded_part = upload_session.upload_part_bytes(chunk, part_num*upload_session.part_size, total_size)
- part_array.append(uploaded_part)
- updated_sha1 = sha1.update(chunk)
-content_sha1 = sha1.digest()
-uploaded_file = upload_session.commit(content_sha1=content_sha1, parts=part_array)
-print(f'File ID: {uploaded_file.id} and File Name: {uploaded_file.name}')
-```
-
-The individual endpoint methods are detailed below:
-
-#### Create Upload Session for File Version
-
-To create an upload session for uploading a large version, call
-[`file.create_upload_session(file_size, file_name=None, use_upload_session_urls=True)`][create_version_upload_session]
-with the size of the file to be uploaded. You can optionally specify a new `file_name` to rename the file on upload.
-`use_upload_session_urls` flag is used to determine if the upload session should use urls returned by
-the `Create Upload Session` endpoint or should it always use base upload urls. This method returns an
-[`UploadSession`][upload_session_class] object representing the created upload session.
-
-
-```python
-file_size = 26000000
-upload_session = client.file('11111').create_upload_session(file_size)
-print(f'Created upload session {upload_session.id} with chunk size of {upload_session.part_size} bytes')
-```
-
-[create_version_upload_session]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.create_upload_session
-[upload_session_class]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.upload_session.UploadSession
-
-#### Create Upload Session for File
-
-To create an upload session for uploading a new large file, call
-[`folder.create_upload_session(file_size, file_name, use_upload_session_urls=True)`][create_upload_session] with
-the size and filename of the file to be uploaded. `use_upload_session_urls` flag is used to determine if the upload
-session should use urls returned by the `Create Upload Session` endpoint or should it always use base upload urls.
-This method returns an [`UploadSession`][upload_session_class] object representing the created upload session.
-
-
-```python
-file_size = 26000000
-file_name = 'test_file.pdf'
-upload_session = client.folder('22222').create_upload_session(file_size, file_name)
-print(f'Created upload session {upload_session.id} with chunk size of {upload_session.part_size} bytes')
-```
-
-[create_upload_session]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.folder.Folder.create_upload_session
-
-#### Upload Part
-
-To upload a part of the file to this session, call
-[`upload_session.upload_part_bytes(part_bytes, offset, total_size, part_content_sha1=None)`][upload_part_bytes] with
-the `bytes` to be uploaded, the byte offset within the file (which should be a multiple of the upload session
-`part_size`), and the total size of the file being uploaded. This method returns a `dict` for the part record; these
-records should be kept for the commit operation.
-
-> __Note:__ The number of bytes uploaded for each part must be exactly `upload_sesion.part_size`, except for the last
-> part (which just includes however many bytes are left in the file).
-
-
-```python
-upload_session = client.upload_session('11493C07ED3EABB6E59874D3A1EF3581')
-offset = upload_session.part_size * 3
-total_size = 26000000
-part_bytes = b'abcdefgh'
-part = upload_session.upload_part_bytes(part_bytes, offset, total_size)
-print(f'Successfully uploaded part ID {part["part_id"]}')
-```
-
-[upload_part_bytes]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.upload_session.UploadSession.upload_part_bytes
-
-#### Commit Upload Session
-
-After uploading all parts of the file, commit the upload session to Box by calling
-[`upload_session.commit(content_sha1, parts=None, file_attributes=None, etag=None)`][commit] with the SHA1 hash of the
-entire file. For best consistency guarantees, you should also pass an `Iterable` of the parts `dict`s via the `parts`
-parameter; otherwise, the list of parts will be retrieved from the API. You may also pass a `dict` of `file_attributes`
-to set on the new file.
-
-
-```python
-import hashlib
-
-sha1 = hashlib.sha1()
-# sha1 should have been updated with all the bytes of the file
-
-file_atributes = {
- 'description': 'A file uploaded via Chunked Upload',
-}
-
-upload_session = client.upload_session('11493C07ED3EABB6E59874D3A1EF3581')
-uploaded_file = upload_session.commit(sha1.digest(), file_atributes=file_atributes)
-print(f'Successfully uploaded file {uploaded_file.id} with description {uploaded_file.description}')
-```
-
-[commit]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.upload_session.UploadSession.commit
-
-#### Abort Upload Session
-
-To abort a chunked upload and lose all uploaded file parts, call [`upload_session.abort()`][abort]. This method returns
-`True` to indicate that the deletion succeeded.
-
-
-```python
-client.upload_session('11493C07ED3EABB6E59874D3A1EF3581').abort()
-print('Upload was successfully canceled')
-```
-
-[abort]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.upload_session.UploadSession.abort
-
-#### List Upload Parts
-
-To return the list of parts uploaded so far, call [`upload_session.get_parts(limit=None, offset=None)`][get_parts].
-This method returns a `BoxObjectCollection` that allows you to iterate over the part `dict`s in the collection.
-
-
-```python
-parts = client.upload_session('11493C07ED3EABB6E59874D3A1EF3581').get_parts()
-for part in parts:
- print(f'Part {part["part_id"]} at offset {part["offset"]} has already been uploaded')
-```
-
-[get_parts]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.upload_session.UploadSession.get_parts
-
-Move a File
------------
-
-To move a file from one folder into another, call [`file.move(parent_folder, name=None)`][move] with the destination
-folder to move the file into. You can optionally provide a `name` parameter to automatically rename the file in case
-of a name conflict in the destination folder. This method returns the updated [`File`][file_class] object in the new
-folder.
-
-```python
-file_id = '11111'
-destination_folder_id = '44444'
-
-file_to_move = client.file(file_id)
-destination_folder = client.folder(destination_folder_id)
-
-moved_file = file_to_move.move(parent_folder=destination_folder)
-print(f'File "{moved_file.name}" has been moved into folder "{moved_file.parent.name}"')
-```
-
-[move]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_item.BaseItem.move
-
-Copy a File
------------
-
-A file can be copied to a new folder by calling [`file.copy(*, parent_folder, name=None, file_version=None, **_kwargs)`][copy]
-with the destination folder and an optional new name for the file in case there is a name conflict in the destination
-folder. This method returns a [`File`][file_class] object representing the copy of the file in the destination folder.
-
-
-```python
-file_id = '11111'
-destination_folder_id = '44444'
-
-file_to_copy = client.file(file_id)
-destination_folder = client.folder(destination_folder_id)
-
-file_copy = file_to_copy.copy(parent_folder=destination_folder)
-print(f'File "{file_copy.name}" has been copied into folder "{file_copy.parent.name}"')
-```
-
-[copy]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_item.BaseItem.copy
-
-Rename a File
------------
-
-A file can be renamed by calling [`file.rename(name)`][rename]. This method returns the updated
-[`File`][file_class] object with a new name. Remeber to provide also extension of the file along with the new name.
-
-```python
-file = client.file(file_id='11111')
-
-renamed_file = file.rename("new-name.pdf")
-print(f'File was renamed to "{renamed_file.name}"')
-```
-
-[rename]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.base_item.BaseItem.rename
-
-Delete a File
--------------
-
-Calling the [`file.delete()`][delete] method will delete the file. Depending on enterprise settings, this will either move
-the file to the user's trash or permanently delete the file. This method returns `True` to signify that the deletion
-was successful.
-
-
-```python
-client.file(file_id='11111').delete()
-```
-
-[delete]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.item.Item.delete
-
-Get Previous Versions of a File
--------------------------------
-
-Previous versions of a file can be retrieved with the
-[`file.get_previous_versions(limit=None, offset=None, fields=None)`][get_previous_versions] method. This method returns
-a [`BoxObjectCollection`][box_object_collection] that can iterate over the [`FileVersion`][file_version_class] objects
-in the collection.
-
-
-```python
-file_id = '11111'
-
-file_versions = client.file(file_id).get_previous_versions()
-for version in file_versions:
- print(f'File version {version.id} was created at {version.created_at}')
-```
-
-[get_previous_versions]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.get_previous_versions
-[box_object_collection]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.pagination.html#boxsdk.pagination.box_object_collection.BoxObjectCollection
-
-Upload a New Version of a File
-------------------------------
-
-New versions of a file can be uploaded in one of two ways: by providing a path to a file on disk, or via a readable
-stream containing the file contents.
-
-To upload a new file version from a path on disk, call the
-[`file.update_contents(file_path, etag=None, preflight_check=False, preflight_expected_size=0)`][update_contents]
-method. This method returns a [`File`][file_class] object representing the updated file.
-
-
-```python
-file_id = '11111'
-file_path = '/path/to/file.pdf'
-
-updated_file = client.file(file_id).update_contents(file_path)
-print(f'File "{updated_file.name}" has been updated')
-```
-
-To upload a file version from a readable stream, call
-[`file.update_contents_with_stream(file_stream, etag=None, preflight_check=False, preflight_expected_size=0)`][update_contents_with_stream]
-with the stream. This method returns a [`File`][file_class] object representing the
-newly-uploaded file.
-
-```python
-file_id = '11111'
-stream = open('/path/to/file.pdf', 'rb')
-
-updated_file = client.file(file_id).update_contents_with_stream(stream)
-print(f'File "{updated_file.name}" has been updated')
-```
-
-[update_contents]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.update_contents
-[update_contents_with_stream]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.update_contents_with_stream
-
-Promote a Previous Version of a File
-------------------------------------
-
-A previous version of a file can be promoted by calling the [`file.promote_version(file_version)`][promote_version]
-method to become the current version of the file with the [`FileVersion`][file_version_class] to promote. This create a
-copy of the old file version and puts it on the top of the versions stack. This method returns the new copy
-[`FileVersion`][file_version_class] object.
-
-
-```python
-file_id = '11111'
-file_version_id = '12345'
-
-version_to_promote = client.file_version(file_version_id)
-
-new_version = client.file(file_id).promote_version(version_to_promote)
-print(f'Version {file_version_id} promoted; new version {new_version.id} created')
-```
-
-[promote_version]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.promote_version
-
-Delete a Previous Version of a File
------------------------------------
-
-A version of a file can be deleted and moved to the trash by calling
-[`file.delete_version(file_version, etag=None)`][delete_version] with the [`FileVersion`] to delete.
-
-
-```python
-file_id = '11111'
-version_id = '12345'
-
-version_to_delete = client.file_version(version_id)
-client.file(file_id).delete_version(version_to_delete)
-```
-
-[delete_version]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.delete_version
-
-Lock a File
------------
-
-A locked file cannot be modified by any other user until it is unlocked. This is useful if you want to "check out" a
-file while you're working on it, to ensure that other collaborators do not make changes while your changes are in
-progress.
-
-To lock a file, call [`file.lock(prevent_download=False, expire_time=None)`][lock]. You can optionally prevent other
-users from downloading the file while it is locked by passing `True` for the `prevent_download` parameter. You can also
-set an expiration time for the lock, which will automatically release the lock at the specified time. The expiration
-time is formatted as an [RFC3339 datetime][rfc3339].
-
-This method returns the updated [`File`][file_class] object.
-
-```python
-file_id = '11111'
-
-updated_file = client.file(file_id).lock(expiration_time='2020-01-01T00:00:00-08:00')
-print(f'File "{updated_file.name}" has been locked!')
-```
-
-[lock]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.lock
-[rfc3339]: https://tools.ietf.org/html/rfc3339#section-5.8
-
-Unlock a File
--------------
-
-A locked file can be unlocked by calling [`file.unlock()`][unlock]. This method returns the updated
-[`File`][file_class] object.
-
-```python
-file_id = '11111'
-
-updated_file = client.file(file_id).unlock()
-print(f'File "{updated_file.name}" has been unlocked!')
-```
-
-[unlock]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.unlock
-
-Create a Shared Link Download URL
---------------------
-
-A shared link for a file can be generated by calling
-[`file.get_shared_link_download_url(access=None, etag=None, unshared_at=None, allow_preview=None, password=None, vanity_name=None)`][get_shared_link_download_url].
-This method returns a `unicode` string containing the shared link URL.
-
-
-```python
-file_id = '11111'
-
-url = client.file(file_id).get_shared_link_download_url(access='collaborators', vanity_name="my-unique-vanity-name")
-print(f'The file shared link download URL is: {url}')
-```
-
-[get_shared_link_download_url]:
-https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.get_shared_link_download_url
-
-Find a File for a Shared Link
------------------------------
-
-To find a file given a shared link, use the
-[`client.get_shared_item`](https://box-python-sdk.readthedocs.io/en/latest/boxsdk.client.html?highlight=get_shared_item#boxsdk.client.client.Client.get_shared_item)
-method.
-
-
-```python
-file = client.get_shared_item('https://app.box.com/s/gjasdasjhasd', password='letmein')
-```
-
-Create or update a Shared Link
---------------------
-
-A shared link for a file can be generated or updated by calling
-[`file.get_shared_link(*, access=None, etag=None, unshared_at=None, allow_download=None, allow_preview=None,
-allow_edit=None, password=None, vanity_name=None, **kwargs)`][get_shared_link].
-This method returns a `unicode` string containing the shared link URL.
-
-
-```python
-file_id = '11111'
-
-url = client.file(file_id).get_shared_link(access='open', allow_download=True, allow_edit=True)
-print(f'The file shared link URL is: {url}')
-```
-
-[get_shared_link]: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.file.File.get_shared_link
-
-Get a Shared Link
---------------------
-
-To check for an existing shared link on a file, simply call
-`file.shared_link`
-
-This method returns a `unicode` string containing the shared link URL.
-
-
-```python
-file_id = '11111'
-shared_link = client.file(file_id).get().shared_link
-url = shared_link['url']
-```
-
-Remove a Shared Link
---------------------
-
-A shared link for a file can be removed by calling [`file.remove_shared_link(*, etag=None, **kwargs)`][remove_shared_link].
-
-
-```python
-file_id = '11111'
-client.file(file_id).remove_shared_link()
-```
-
-[remove_shared_link]:
-https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html#boxsdk.object.item.Item.remove_shared_link
-
-
-Get an Embed Link
------------------
-
-A file embed URL can be generated by calling [`file.get_embed_url()`][get_embed_url]. This method returns a `unicode`
-string containing a URL suitable for embedding in an `