# Collections ## List `client.collections.list(CollectionListParamsquery?, RequestOptionsoptions?): CollectionsCursor` **get** `/collections` List collections of a team ### Parameters - `query: CollectionListParams` - `pageSize?: number` The number of items to return in the response. The default value is 10, maximum value is 100, minimum value is 1 - `paginationToken?: string` A token you received in a previous request to query the next page of items ### Returns - `CollectionListResponse` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const collectionListResponse of client.collections.list()) { console.log(collectionListResponse.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 `client.collections.create(CollectionCreateParamsbody, RequestOptionsoptions?): CollectionCreateResponse` **post** `/collections` Create a new collection ### Parameters - `body: CollectionCreateParams` - `name: string` The name of the collection. ### Returns - `CollectionCreateResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const collection = await client.collections.create({ name: 'name' }); console.log(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 `client.collections.retrieve(stringcollectionID, RequestOptionsoptions?): CollectionRetrieveResponse` **get** `/collections/{collectionId}` Get the details of a collection ### Parameters - `collectionID: string` ### Returns - `CollectionRetrieveResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const collection = await client.collections.retrieve('collectionId'); console.log(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 `client.collections.update(stringcollectionID, CollectionUpdateParamsbody, RequestOptionsoptions?): CollectionUpdateResponse` **put** `/collections/{collectionId}` Update the name and/or thumbnail of a Collection ### Parameters - `collectionID: string` - `body: CollectionUpdateParams` - `name?: string` The new name for the Collection - `thumbnail?: string` The AssetId of the image you want to use as a thumbnail for the collection. Set to null to unset the thumbnail. ### Returns - `CollectionUpdateResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const collection = await client.collections.update('collectionId'); console.log(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 `client.collections.delete(stringcollectionID, RequestOptionsoptions?): CollectionDeleteResponse` **delete** `/collections/{collectionId}` Delete a collection ### Parameters - `collectionID: string` ### Returns - `CollectionDeleteResponse = unknown` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const collection = await client.collections.delete('collectionId'); console.log(collection); ``` #### Response ```json {} ``` ## Domain Types ### Collection List Response - `CollectionListResponse` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Collection Create Response - `CollectionCreateResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Collection Retrieve Response - `CollectionRetrieveResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Collection Update Response - `CollectionUpdateResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Collection Delete Response - `CollectionDeleteResponse = unknown` # Assets ## Add `client.collections.assets.add(stringcollectionID, AssetAddParamsbody, RequestOptionsoptions?): AssetAddResponse` **put** `/collections/{collectionId}/assets` Add assets to a specific collection ### Parameters - `collectionID: string` - `body: AssetAddParams` - `assetIds: Array` The ids of the assets to add to the collection. (Max 49 at once) ### Returns - `AssetAddResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const response = await client.collections.assets.add('collectionId', { assetIds: ['string'] }); console.log(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 `client.collections.assets.remove(stringcollectionID, AssetRemoveParamsbody, RequestOptionsoptions?): AssetRemoveResponse` **delete** `/collections/{collectionId}/assets` Remove assets from a specific collection ### Parameters - `collectionID: string` - `body: AssetRemoveParams` - `assetIds: Array` The ids of the assets to remove from the collection. (Max 49 at once) ### Returns - `AssetRemoveResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const asset = await client.collections.assets.remove('collectionId', { assetIds: ['string'] }); console.log(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 - `AssetAddResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Asset Remove Response - `AssetRemoveResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` # Models ## Add `client.collections.models.add(stringcollectionID, ModelAddParamsbody, RequestOptionsoptions?): ModelAddResponse` **put** `/collections/{collectionId}/models` Add models to a specific collection ### Parameters - `collectionID: string` - `body: ModelAddParams` - `modelIds: Array` The ids of the models to add to the collection. (Max 49 at once) ### Returns - `ModelAddResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const response = await client.collections.models.add('collectionId', { modelIds: ['string'] }); console.log(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 `client.collections.models.remove(stringcollectionID, ModelRemoveParamsbody, RequestOptionsoptions?): ModelRemoveResponse` **delete** `/collections/{collectionId}/models` Remove models from a specific collection ### Parameters - `collectionID: string` - `body: ModelRemoveParams` - `modelIds: Array` The ids of the models to remove from the collection. (Max 49 at once) ### Returns - `ModelRemoveResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const model = await client.collections.models.remove('collectionId', { modelIds: ['string'] }); console.log(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 - `ModelAddResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string` ### Model Remove Response - `ModelRemoveResponse` - `collection: Collection` - `id: string` The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `assetCount: number` - `createdAt: string` The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `itemCount: number` - `modelCount: number` - `name: string` The collection name - `ownerId: string` The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea") - `updatedAt: string` The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `thumbnail?: Thumbnail` The thumbnail for the collection (if any) - `assetId: string` - `url: string`