import type { ApiClient } from "@promobase/sdk-runtime"; import { Cursor } from "@promobase/sdk-runtime"; import { metaPagination } from "../../pagination.ts"; import type { AdVideoFields } from "./ad-video.ts"; import type { CommentFields } from "./comment.ts"; import type { LiveVideoAdBreakConfigFields } from "./live-video-ad-break-config.ts"; import type { LiveVideoErrorFields } from "./live-video-error.ts"; import type { LiveVideoInputStreamFields } from "./live-video-input-stream.ts"; import type { LiveVideoRecommendedEncoderSettingsFields } from "./live-video-recommended-encoder-settings.ts"; import type { LiveVideoTargetingFields } from "./live-video-targeting.ts"; import type { PageFields } from "./page.ts"; import type { ProfileFields } from "./profile.ts"; import type { TargetingFields } from "./targeting.ts"; import type { UserFields } from "./user.ts"; import type { VideoCopyrightFields } from "./video-copyright.ts"; import type { VideoPollFields } from "./video-poll.ts"; export interface LiveVideoFields { ad_break_config: LiveVideoAdBreakConfigFields; ad_break_failure_reason: string; broadcast_start_time: string; copyright: VideoCopyrightFields; creation_time: string; dash_ingest_url: string; dash_preview_url: string; description: string; embed_html: Record; from: Record; id: string; ingest_streams: LiveVideoInputStreamFields[]; is_manual_mode: boolean; is_reference_only: boolean; live_views: number; permalink_url: string; planned_start_time: string; recommended_encoder_settings: LiveVideoRecommendedEncoderSettingsFields; seconds_left: number; secure_stream_url: string; status: string; stream_url: string; targeting: LiveVideoTargetingFields; title: string; total_views: string; video: AdVideoFields; } export interface LiveVideoListBlockedUsersParams { uid?: string; [key: string]: unknown; } export interface LiveVideoListCommentsParams { filter?: string; live_filter?: string; order?: string; since?: string; [key: string]: unknown; } export interface LiveVideoCreatePollsParams { close_after_voting?: boolean; correct_option?: number; default_open?: boolean; options: string[]; question: string; show_gradient?: boolean; show_results?: boolean; [key: string]: unknown; } export interface LiveVideoListReactionsParams { type?: string; [key: string]: unknown; } export interface LiveVideoUpdateParams { allow_bm_crossposting?: boolean; content_tags?: string[]; cross_share_to_group_ids?: string[]; crossposting_actions?: Record[]; custom_labels?: string[]; description?: string; direct_share_status?: number; embeddable?: boolean; end_live_video?: boolean; event_params?: Record; is_audio_only?: boolean; is_manual_mode?: boolean; live_comment_moderation_setting?: string[]; master_ingest_stream_id?: string; og_icon_id?: string; og_phrase?: string; persistent_stream_key_status?: string; place?: Record; planned_start_time?: string; privacy?: string; published?: boolean; schedule_custom_profile_image?: File | Blob | ReadableStream; schedule_feed_background_image?: File | Blob | ReadableStream; sponsor_id?: string; sponsor_relationship?: number; status?: string; stream_type?: string; tags?: number[]; targeting?: Record; title?: string; [key: string]: unknown; } export function liveVideoNode(client: ApiClient, id: string) { return { __path: id, __brand: undefined as unknown as LiveVideoFields, get: (opts: { fields: F; params?: Record }) => client.get>(`${id}`, opts), update: (params: LiveVideoUpdateParams) => client.post(`${id}`, params as Record), delete: () => client.delete(`${id}`, {}), blockedUsers: (opts: { fields: F; params?: LiveVideoListBlockedUsersParams }) => new Cursor>(client, `${id}/blocked_users`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), comments: (opts: { fields: F; params?: LiveVideoListCommentsParams }) => new Cursor>(client, `${id}/comments`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), crosspostSharedPages: (opts: { fields: F; params?: Record }) => new Cursor>(client, `${id}/crosspost_shared_pages`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), crosspostedBroadcasts: (opts: { fields: F; params?: Record }) => new Cursor>(client, `${id}/crossposted_broadcasts`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), errors: (opts: { fields: F; params?: Record }) => new Cursor>(client, `${id}/errors`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), createInputStream: (params: Record) => client.post(`${id}/input_streams`, params as Record), polls: { __path: `${id}/polls`, __brand: undefined as unknown as VideoPollFields, list: (opts: { fields: F; params?: Record }) => new Cursor>(client, `${id}/polls`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), create: (params: LiveVideoCreatePollsParams) => client.post(`${id}/polls`, params as Record), }, reactions: (opts: { fields: F; params?: LiveVideoListReactionsParams }) => new Cursor>(client, `${id}/reactions`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), }; }