# Media Methods Access TelemetryOS media library content including images and videos. Query by folders, tags, or individual media items. # Media Methods Access TelemetryOS media library content. ## Overview The Media Methods provide access to media content (images, videos) uploaded to the TelemetryOS platform. Applications can query folders, retrieve content by tags, and access media URLs for display. ## Importing ```typescript import { media } from '@telemetryos/sdk'; ``` ## Methods ### getAllFolders() Retrieve all media folders in the account. **Signature:** ```typescript async getAllFolders(): Promise ``` **Returns:** `Promise` - Array of folder objects **MediaFolder Type:** ```typescript type MediaFolder = { id: string; parentId: string; name: string; size: number; default: boolean; updatedAt: Date; createdAt: Date; } ``` **Example:** ```typescript const folders = await media().getAllFolders(); ``` ### getAllByFolderId() Retrieve all media content within a specific folder. **Signature:** ```typescript async getAllByFolderId(folderId: string): Promise ``` **Parameters:** * `folderId` - Folder ID to query **Returns:** `Promise` - Array of media content **Example:** ```typescript const contents = await media().getAllByFolderId('folder-123'); ``` ### getAllByTag() Retrieve media content tagged with a specific tag. **Signature:** ```typescript async getAllByTag(tagName: string): Promise ``` **Parameters:** * `tagName` - Tag name to filter by **Returns:** `Promise` - Array of media content **Example:** ```typescript const marketingContent = await media().getAllByTag('marketing'); ``` ### getById() Retrieve a specific media item by its ID. **Signature:** ```typescript async getById(id: string): Promise ``` **Parameters:** * `id` - Media content ID **Returns:** `Promise` - Media content object **Example:** ```typescript const item = await media().getById('media-456'); ``` ## Types ### MediaContent ```typescript type MediaContent = { id: string; // Unique media ID contentFolderId: string; // Parent folder ID contentType: string; // MIME type (image/jpeg, video/mp4, etc.) name: string; // Media name description: string; // Media description thumbnailUrl: string; // Thumbnail URL keys: string[]; // Associated keys/tags publicUrls: string[]; // CDN URLs for accessing content hidden: boolean; // Visibility flag validFrom?: Date; // Optional start date validTo?: Date; // Optional end date transcodedAt?: Date; // Video transcoding timestamp createdAt: Date; // Upload timestamp updatedAt: Date; // Last modification } ``` **Key Fields:** * `publicUrls` - Array of CDN URLs (use first element) * `contentType` - MIME type for rendering * `keys` - Tags for filtering/searching ## Next Steps * **[Storage API](./storage-methods.md)** - Cache media references * **[Code Examples](../Development/code-examples.md)** - Complete media gallery example * **[Platform APIs](./platform-methods.md)** - Other integration APIs