import { APIResource } from '../resource'; import { APIPromise } from '../api-promise'; import type { RequestOptions } from '../internal/request-options'; export declare class VideoUsageAnalytics extends APIResource { /** * This endpoint gives usage analytics data of your videos. Ex - top assets, bandwidth consumption. * * Pagination applies only to `top_assets` and `widget_data` metrics. * * @param {VideoUsageAnalyticRetrieveParams} body - The request body to send. * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. * @returns {APIPromise} 200 * * @example * ```ts * const videoUsageAnalytic = await client.videoUsageAnalytics.retrieve({ * metrics: ['bandwidth_consumption', 'asset_duration', 'storage_unit', 'top_assets', 'drm_requests'], * date_range: { start_at: '2026-08-01', end_at: '2026-08-20' }, * group_by: 'daily', * }); * ``` */ retrieve(body: VideoUsageAnalyticRetrieveParams, options?: RequestOptions): APIPromise; /** * This endpoint lists top streamed assets in a video collection * * @param {VideoUsageAnalyticTopAssetsParams} query - The parameters to send with the request. * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. * @returns {APIPromise} 200 * * @example * ```ts * const videoUsageAnalytic = await client.videoUsageAnalytics.topAssets({ * start_at: '2026-06-21', * end_at: '2026-06-30', * page: '1', * page_size: '1000', * }); * ``` */ topAssets(query: VideoUsageAnalyticTopAssetsParams, options?: RequestOptions): APIPromise; } export interface VideoUsageAnalyticRetrieveParams { /** * Define the metric you need the data for. Supported values: `bandwidth_consumption`, `asset_duration`, `storage_unit`, `top_assets`, `widget_data`, `drm_requests`, `ai_credit_usage`, and `errored_videos`. */ metrics: Array<'bandwidth_consumption' | 'asset_duration' | 'storage_unit' | 'top_assets' | 'drm_requests' | 'ai_credit_usage' | 'errored_videos'>; /** * The timeframe to get the data for. Currently we only support a maximum of 60 days between `start_at` and `end_at`. */ date_range: VideoUsageAnalyticRetrieveParams.DateRange; filters?: VideoUsageAnalyticRetrieveParams.Filters; /** * Deprecated. Use `page_size` instead. * @default 5 * @deprecated */ top_assets_count?: string; /** * Deprecated. Use `page_number` instead. * @default 0 * @deprecated */ top_assets_page?: string; /** * Group by hourly, daily or monthly. If you don't specify anything it's `hourly` by default. * @default hourly */ group_by?: 'hourly' | 'daily' | 'monthly'; /** * Page number for paginated metrics. Used by `widget_data`, and by `top_assets` Starts at 1. * @default 1 * @minimum 1 */ page_number?: number; /** * Page size for paginated metrics. Used by `widget_data`, and by `top_assets` * @default 20 * @minimum 1 */ page_size?: number; } export declare namespace VideoUsageAnalyticRetrieveParams { interface DateRange { /** * Date in yyyy-MM-dd format * @format date */ start_at: string; /** * Date in yyyy-MM-dd format * @format date */ end_at: string; } interface Filters { /** * Deprecated. Use `workspace_id` instead. Still accepted for backwards compatibility. * @deprecated */ collection_id?: string; /** * Deprecated. Use `workspace_id` instead. Still accepted for backwards compatibility. * @deprecated */ source_id?: string; /** * Gumlet video workspace ID. Preferred over deprecated `collection_id` / `source_id` (same ID). */ workspace_id?: string; } } export interface VideoUsageAnalyticRetrieveResponse { drm_requests?: Array; /** * The unit for bandwidth saving data. */ bandwidth_saving_unit?: ''; /** * The unit for the storage data. */ storage_data_unit?: 'gb' | 'min'; bandwidth_consumption?: Array; storage_unit?: Array; asset_duration?: Array; top_assets?: Array; /** * Indicates whether the list of top assets is exhaustive or if it has more assets. */ has_more_top_asset?: boolean; ai_credit_usage?: Array; errored_videos?: Array; } export declare namespace VideoUsageAnalyticRetrieveResponse { interface DrmRequest { /** * Number of DRM requests. * @format int64 */ units: number; /** * Seconds since epoch for the unit given. * @format int64 */ timestamp: number; } interface BandwidthConsumption { /** * The bandwidth consumption data in bytes. * @format int64 */ units: number; /** * Seconds since epoch for the unit given. * @format int64 */ timestamp: number; } interface StorageUnit { /** * The storage data in bytes or seconds. * @format int64 */ units: number; /** * Seconds since epoch for the unit given. * @format int64 */ timestamp: number; } interface AssetDuration { /** * Total transcoding duration in seconds. * @format int64 */ units: number; /** * Seconds since epoch for the unit given. * @format int64 */ timestamp: number; } interface TopAsset { /** * Asset ID */ asset_id: string; /** * Bandwidth consumption by this asset in bytes. */ units: string; /** * Workspace ID */ workspace_id: string; /** * Seconds of streaming minutes consumed by this asset. */ duration: string; /** * Asset Title */ title: string; /** * Workspace Name */ collection_name: string; } interface AICreditUsage { /** * Seconds since epoch for the unit given. */ timestamp: number; } interface ErroredVideo { /** * Seconds since epoch for the unit given. */ timestamp: number; /** * Number of errored videos in the timeframe */ units: number; } } export interface VideoUsageAnalyticTopAssetsParams { /** * Date in yyyy-MM-dd format * @format date */ start_at: string; /** * Date in yyyy-MM-dd format * @format date */ end_at: string; /** * Gumlet video workspace ID. Preferred. Provide `workspace_id`, or deprecated `collection_id` / `source_id` (same ID). */ workspace_id?: string; /** * Deprecated. Use `workspace_id` instead. Still accepted for backwards compatibility. */ collection_id?: string; /** * Page number of the response. * @default 1 */ page?: string; /** * Assets to list per page. * @default 1000 */ page_size?: string; } export interface VideoUsageAnalyticTopAssetsResponse { data?: Array; /** * @default true */ has_next_page?: boolean; } export declare namespace VideoUsageAnalyticTopAssetsResponse { interface Data { asset_id?: string; /** * @default 0 */ units?: number; } } export declare namespace VideoUsageAnalytics { export { type VideoUsageAnalyticRetrieveResponse as VideoUsageAnalyticRetrieveResponse, type VideoUsageAnalyticTopAssetsResponse as VideoUsageAnalyticTopAssetsResponse, type VideoUsageAnalyticRetrieveParams as VideoUsageAnalyticRetrieveParams, type VideoUsageAnalyticTopAssetsParams as VideoUsageAnalyticTopAssetsParams, }; } //# sourceMappingURL=video-usage-analytics.d.ts.map