@ubstream/ubstream-node-client-sdk / Exports / LibrariesCollectionsMediasClient
Class: LibrariesCollectionsMediasClient
This class provides access to methods to manage medias in a library collection.
Hierarchy
AbstractClient
↳ LibrariesCollectionsMediasClient
Table of contents
Methods
- addFeaturedMedia
- attachMediaToCollection
- detachMediaFromCollection
- listFeaturedMedias
- listMediasOfCollection
- moveMedia
- removeFeaturedMedia
- reorderFeaturedMedias
Methods
addFeaturedMedia
▸ addFeaturedMedia(libraryId, collectionId, mediaId): Promise<void>
Parameters
| Name | Type | Description |
|---|---|---|
libraryId | string | The uuid of the targeted library. |
collectionId | string | The uuid of the targeted collection. |
mediaId | string | The uuid of the media. |
Returns
Promise<void>
Summary
Add a featured media.
Example
await client.libraries.collections.medias.addFeaturedMedia("library_id", "collection_id", "media_id");
attachMediaToCollection
▸ attachMediaToCollection(libraryId, collectionId, mediaId): Promise<void>
Parameters
| Name | Type | Description |
|---|---|---|
libraryId | string | The uuid of the targeted library. |
collectionId | string | The uuid of the targeted collection. |
mediaId | string | The uuid of the targeted media. |
Returns
Promise<void>
Summary
Attach the specified media to the specified library's collection. When the media is in trash, it will be removed from it.
Example
await client.libraries.collections.medias.attachMediaToCollection("library_id", "collection_id", "media_id");
detachMediaFromCollection
▸ detachMediaFromCollection(libraryId, collectionId, mediaId): Promise<IPublicHttpResponseDataWithRequestId>
Parameters
| Name | Type | Description |
|---|---|---|
libraryId | string | The uuid of the targeted library. |
collectionId | string | The uuid of the targeted collection. |
mediaId | string | The uuid of the targeted media. |
Returns
Promise<IPublicHttpResponseDataWithRequestId>
Promise object with the requestId.
Summary
Detach a media from a collection and it's childrens, and move to trash if it's the last instance of the media.
Example
await client.libraries.collections.medias.detachMediaFromCollection("library_id", "collection_id", "media_id");
listFeaturedMedias
▸ listFeaturedMedias(libraryId, collectionId): Promise<IPublicLibraryMediaRefQuery>
Parameters
| Name | Type | Description |
|---|---|---|
libraryId | string | The uuid of the targeted library. |
collectionId | string | The uuid of the targeted collection. |
Returns
Promise<IPublicLibraryMediaRefQuery>
Promise object representing featured medias references.
Summary
Retrieve featured medias references of the specified collection.
Example
const result = await client.libraries.collections.medias.listFeaturedMedias("library_id", "collection_id");
const featuredMedias = result.$resources;
listMediasOfCollection
▸ listMediasOfCollection(libraryId, collectionId): Promise<IPublicLibraryMediaRefQuery>
Parameters
| Name | Type | Description |
|---|---|---|
libraryId | string | The uuid of the targeted library. |
collectionId | string | The uuid of the targeted collection. |
Returns
Promise<IPublicLibraryMediaRefQuery>
Promise object representing the medias references of the specified library's collection.
Summary
Retrieve medias references of the specified library's collection.
Example
const result = await client.libraries.collections.medias.listMediasOfCollection("library_id", "collection_id");
const medias = result.$resources;
moveMedia
▸ moveMedia(libraryId, collectionId, mediaId): Promise<IPublicHttpResponseDataWithRequestId>
Parameters
| Name | Type | Description |
|---|---|---|
libraryId | string | The uuid of the targeted library. |
collectionId | string | The uuid of the targeted collection. |
mediaId | string | The uuid of the media. |
Returns
Promise<IPublicHttpResponseDataWithRequestId>
Promise object containing the request ID to use to check the request completion.
Summary
Move a media from a collection to another.
Example
await client.libraries.collections.medias.moveMedia("library_id", "collection_id", "media_id");
removeFeaturedMedia
▸ removeFeaturedMedia(libraryId, collectionId, mediaId): Promise<void>
Parameters
| Name | Type | Description |
|---|---|---|
libraryId | string | The uuid of the targeted library. |
collectionId | string | The uuid of the targeted collection. |
mediaId | string | The uuid of the media. |
Returns
Promise<void>
Summary
Remove a featured media.
Example
await client.libraries.collections.medias.removeFeaturedMedia("library_id", "collection_id", "featuredMedia_id");
reorderFeaturedMedias
▸ reorderFeaturedMedias(libraryId, collectionId, featuredMediasIds): Promise<void>
Parameters
| Name | Type | Description |
|---|---|---|
libraryId | string | The uuid of the targeted library. |
collectionId | string | The uuid of the targeted collection. |
featuredMediasIds | string[] | The ids of featured medias reordered. |
Returns
Promise<void>
Summary
Reorder the featured medias of the specified collection.
Example
await client.libraries.collections.medias.reorderFeaturedMedias("library_id", "collection_id", ["featuredMedia_id_1", "featuredMedia_id_2"]);