# Collections ## List `collections.list(CollectionListParams**kwargs) -> SyncCollectionsCursor[CollectionListResponse]` **get** `/collections` List collections of a team ### Parameters - `page_size: Optional[int]` The number of items to return in the response. The default value is 10, maximum value is 100, minimum value is 1 - `pagination_token: Optional[str]` A token you received in a previous request to query the next page of items ### Returns - `class CollectionListResponse: …` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[Thumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) page = client.collections.list() page = page.collections[0] print(page.id) ``` #### Response ```json { "collections": [ { "id": "id", "assetCount": 0, "createdAt": "createdAt", "itemCount": 0, "modelCount": 0, "name": "name", "ownerId": "ownerId", "updatedAt": "updatedAt", "thumbnail": { "assetId": "assetId", "url": "url" } } ], "nextPaginationToken": "nextPaginationToken" } ``` ## Create `collections.create(CollectionCreateParams**kwargs) -> CollectionCreateResponse` **post** `/collections` Create a new collection ### Parameters - `name: str` The name of the collection. ### Returns - `class CollectionCreateResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) collection = client.collections.create( name="name", ) print(collection.collection) ``` #### Response ```json { "collection": { "id": "id", "assetCount": 0, "createdAt": "createdAt", "itemCount": 0, "modelCount": 0, "name": "name", "ownerId": "ownerId", "updatedAt": "updatedAt", "thumbnail": { "assetId": "assetId", "url": "url" } } } ``` ## Retrieve `collections.retrieve(strcollection_id) -> CollectionRetrieveResponse` **get** `/collections/{collectionId}` Get the details of a collection ### Parameters - `collection_id: str` ### Returns - `class CollectionRetrieveResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) collection = client.collections.retrieve( "collectionId", ) print(collection.collection) ``` #### Response ```json { "collection": { "id": "id", "assetCount": 0, "createdAt": "createdAt", "itemCount": 0, "modelCount": 0, "name": "name", "ownerId": "ownerId", "updatedAt": "updatedAt", "thumbnail": { "assetId": "assetId", "url": "url" } } } ``` ## Update `collections.update(strcollection_id, CollectionUpdateParams**kwargs) -> CollectionUpdateResponse` **put** `/collections/{collectionId}` Update the name and/or thumbnail of a Collection ### Parameters - `collection_id: str` - `name: Optional[str]` The new name for the Collection - `thumbnail: Optional[str]` The AssetId of the image you want to use as a thumbnail for the collection. Set to null to unset the thumbnail. ### Returns - `class CollectionUpdateResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) collection = client.collections.update( collection_id="collectionId", ) print(collection.collection) ``` #### Response ```json { "collection": { "id": "id", "assetCount": 0, "createdAt": "createdAt", "itemCount": 0, "modelCount": 0, "name": "name", "ownerId": "ownerId", "updatedAt": "updatedAt", "thumbnail": { "assetId": "assetId", "url": "url" } } } ``` ## Delete `collections.delete(strcollection_id) -> object` **delete** `/collections/{collectionId}` Delete a collection ### Parameters - `collection_id: str` ### Returns - `object` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) collection = client.collections.delete( "collectionId", ) print(collection) ``` #### Response ```json {} ``` ## Domain Types ### Collection List Response - `class CollectionListResponse: …` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[Thumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Collection Create Response - `class CollectionCreateResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Collection Retrieve Response - `class CollectionRetrieveResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Collection Update Response - `class CollectionUpdateResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` # Assets ## Add `collections.assets.add(strcollection_id, AssetAddParams**kwargs) -> AssetAddResponse` **put** `/collections/{collectionId}/assets` Add assets to a specific collection ### Parameters - `collection_id: str` - `asset_ids: Sequence[str]` The ids of the assets to add to the collection. (Max 49 at once) ### Returns - `class AssetAddResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) response = client.collections.assets.add( collection_id="collectionId", asset_ids=["string"], ) print(response.collection) ``` #### Response ```json { "collection": { "id": "id", "assetCount": 0, "createdAt": "createdAt", "itemCount": 0, "modelCount": 0, "name": "name", "ownerId": "ownerId", "updatedAt": "updatedAt", "thumbnail": { "assetId": "assetId", "url": "url" } } } ``` ## Remove `collections.assets.remove(strcollection_id, AssetRemoveParams**kwargs) -> AssetRemoveResponse` **delete** `/collections/{collectionId}/assets` Remove assets from a specific collection ### Parameters - `collection_id: str` - `asset_ids: Sequence[str]` The ids of the assets to remove from the collection. (Max 49 at once) ### Returns - `class AssetRemoveResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) asset = client.collections.assets.remove( collection_id="collectionId", asset_ids=["string"], ) print(asset.collection) ``` #### Response ```json { "collection": { "id": "id", "assetCount": 0, "createdAt": "createdAt", "itemCount": 0, "modelCount": 0, "name": "name", "ownerId": "ownerId", "updatedAt": "updatedAt", "thumbnail": { "assetId": "assetId", "url": "url" } } } ``` ## Domain Types ### Asset Add Response - `class AssetAddResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Asset Remove Response - `class AssetRemoveResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` # Models ## Add `collections.models.add(strcollection_id, ModelAddParams**kwargs) -> ModelAddResponse` **put** `/collections/{collectionId}/models` Add models to a specific collection ### Parameters - `collection_id: str` - `model_ids: Sequence[str]` The ids of the models to add to the collection. (Max 49 at once) ### Returns - `class ModelAddResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) response = client.collections.models.add( collection_id="collectionId", model_ids=["string"], ) print(response.collection) ``` #### Response ```json { "collection": { "id": "id", "assetCount": 0, "createdAt": "createdAt", "itemCount": 0, "modelCount": 0, "name": "name", "ownerId": "ownerId", "updatedAt": "updatedAt", "thumbnail": { "assetId": "assetId", "url": "url" } } } ``` ## Remove `collections.models.remove(strcollection_id, ModelRemoveParams**kwargs) -> ModelRemoveResponse` **delete** `/collections/{collectionId}/models` Remove models from a specific collection ### Parameters - `collection_id: str` - `model_ids: Sequence[str]` The ids of the models to remove from the collection. (Max 49 at once) ### Returns - `class ModelRemoveResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) model = client.collections.models.remove( collection_id="collectionId", model_ids=["string"], ) print(model.collection) ``` #### Response ```json { "collection": { "id": "id", "assetCount": 0, "createdAt": "createdAt", "itemCount": 0, "modelCount": 0, "name": "name", "ownerId": "ownerId", "updatedAt": "updatedAt", "thumbnail": { "assetId": "assetId", "url": "url" } } } ``` ## Domain Types ### Model Add Response - `class ModelAddResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str` ### Model Remove Response - `class ModelRemoveResponse: …` - `collection: Collection` - `id: str` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `asset_count: float` - `created_at: str` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `item_count: float` - `model_count: float` - `name: str` The collection name - `owner_id: str` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updated_at: str` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail: Optional[CollectionThumbnail]` The thumbnail for the collection (if any) - `asset_id: str` - `url: str`