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
import { media } from '@telemetryos/sdk';Methods
getAllFolders()
Retrieve all media folders in the account.
Signature:
async getAllFolders(): Promise<MediaFolder[]>Returns: Promise<MediaFolder[]> - Array of folder objects
MediaFolder Type:
type MediaFolder = {
id: string;
parentId: string;
name: string;
size: number;
default: boolean;
updatedAt: Date;
createdAt: Date;
}Example:
const folders = await media().getAllFolders();getAllByFolderId()
Retrieve all media content within a specific folder.
Signature:
async getAllByFolderId(folderId: string): Promise<MediaContent[]>Parameters:
folderId- Folder ID to query
Returns: Promise<MediaContent[]> - Array of media content
Example:
const contents = await media().getAllByFolderId('folder-123');getAllByTag()
Retrieve media content tagged with a specific tag.
Signature:
async getAllByTag(tagName: string): Promise<MediaContent[]>Parameters:
tagName- Tag name to filter by
Returns: Promise<MediaContent[]> - Array of media content
Example:
const marketingContent = await media().getAllByTag('marketing');getById()
Retrieve a specific media item by its ID.
Signature:
async getById(id: string): Promise<MediaContent>Parameters:
id- Media content ID
Returns: Promise<MediaContent> - Media content object
Example:
const item = await media().getById('media-456');Types
MediaContent
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 renderingkeys- Tags for filtering/searching
Next Steps
- Storage API - Cache media references
- Code Examples - Complete media gallery example
- Platform APIs - Other integration APIs
Updated about 5 hours ago