import { Theme, ThemeResponse } from '..'; import { NewFileUploadsResponse, FileUploadResponse } from './FileUpload'; import * as R from './Resource'; export type GetPresentationsRequest = void; export type GetPresentationsResponse = PresentationResponse[]; export type UpdatePresentationRequest = Partial; export type UpdatePresentationResponse = { presentation: PresentationResponse; file_uploads: NewFileUploadsResponse; }; export type CreatePresentationRequest = { name: string; application_deployment_id: string; theme_id: string; application_vars: ApplicationVariables; duration: number; resource?: { r?: { tags?: R.CreateTagResponse[]; }; }; preview_orientation?: 'vertical' | 'horizontal'; preview_resolution?: 'HD' | 'FullHD' | 'UltraHD' | 'EightK'; }; export type CreatePresentationResponse = { presentation: PresentationResponse; file_uploads: NewFileUploadsResponse; }; export type DeletePresentationRequest = void; export type DeletePresentationResponse = void; export type ApplicationVariables = { [id: string]: any; }; export type PresentationResponse = { id: string; resource: R.ResourceResponse; name: string; duration?: number; application_id: string; application_deployment_id: string; theme_id: string; application_vars: ApplicationVariables; application_name: string; presentation_properties: PresentationProperty[]; thumbnail_url: string; icon_url: string; application_thumbnail_url: string; has_dynamic_thumbnails: boolean; source_url: string; file_uploads: FileUploadResponse[] | null; theme?: ThemeResponse; preview_orientation?: 'vertical' | 'horizontal'; preview_resolution?: 'HD' | 'FullHD' | 'UltraHD' | 'EightK'; }; export type Presentation = { id: string; name: string; applicationId: string; appVersionId: string; themeId?: string; applicationName: string; presentationProperties: PresentationProperty[]; applicationVariables: ApplicationVariables; thumbnailUrl: string; iconUrl: string; applicationThumbnailUrl: string; hasDynamicThumbnails: boolean; duration?: number; sourceUrl: string; fileUploads: FileUpload[] | null; token?: string; resource: R.Resource; theme?: Theme; previewOrientation?: 'vertical' | 'horizontal'; previewResolution?: 'HD' | 'FullHD' | 'UltraHD' | 'EightK'; }; export type OptionsUrlHttpHeader = { key: string; value: string; }; // TODO: This is a mess. Use conditional types for better type safety. export type PresentationProperty = { type: string; name: string; default?: any; hide?: boolean; optional?: boolean; multiple?: boolean; exclusive?: boolean; options?: Array<{ value: string; label?: string; name?: string }>; // Legacy selection types may still use `name` instead of `label` options_url?: string; options_url_http_headers?: OptionsUrlHttpHeader[]; properties?: PresentationProperty[]; constraints?: Constraints; helper_text?: string; helper_link?: string; // OAuth auth_url?: string; verify_url?: string; logout_url?: string; verify_qs_param?: string; logout_qs_param?: string; icon_url?: string; background_color?: string; foreground_color?: string; provider?: string; // File file_type?: PresentationPropertyFileType | PresentationPropertyFileType[]; }; export type PresentationPropertyFileType = | 'image' | 'video' | 'pdf' | 'spreadsheet'; export type Constraints = { // Mixing hyphen case, snake case and no case... :'( // TODO: Clean these up. 'content-types'?: string[]; 'content-length'?: number; maxlength?: number; min?: number; max?: number; max_items?: number; format?: { regex: string; errorMessage: string; }; }; export type NewFileUploads = Array<{ fileUploadId: string; uploadUrl: string; path: string[]; }>; export type FileUploadStepResponse = { step_name: string; created_at: string; error: { [key: string]: any }; }; export type FileUpload = { id: string; filename: string; contentType: string; contentLength: number; url: string; completedSteps: FileUploadStep[]; createdAt: string; }; export type FileUploadStep = { stepName: string; createdAt: string; error: { [key: string]: any }; }; export type CopyPresentationRequest = { name?: string; target_folder_id?: string; copy_out_of_tree_unowned?: boolean; }; export type CopyPresentationResponse = | { has_out_of_tree_unowned: true } | (PresentationResponse & { has_out_of_tree_unowned?: boolean; supporting_content_folder_created?: boolean; }); export type CopyPresentation = | { hasOutOfTreeUnowned: true; supportingContentFolderCreated: false } | (Presentation & { supportingContentFolderCreated: boolean }); // v2 types export interface PresentationV2Response { id: string; name: string; duration: number; application_vars: ApplicationVariables; application_deployment_id: string; theme_id: string | null; token?: string; r: { presentations_playlists: Array<{ playlist_id: string }> | null; resource: R.ResourceV2Response; }; preview_orientation?: 'vertical' | 'horizontal'; preview_resolution?: 'HD' | 'FullHD' | 'UltraHD' | 'EightK'; } export interface PresentationV2 { id: string; name: string; duration: number; applicationVariables: ApplicationVariables; applicationDeploymentId: string; themeId: string | null; token?: string; r: { resource: R.ResourceV2; presentationsPlaylists: Array<{ playlistId: string }>; }; previewOrientation?: 'vertical' | 'horizontal'; previewResolution?: 'HD' | 'FullHD' | 'UltraHD' | 'EightK'; } export type UpdatePresentation = { name?: string; appVersionId?: string; applicationVariables?: ApplicationVariables; duration?: number; themeId?: string; resource?: { r?: { tags?: R.CreateTag[]; }; }; previewOrientation?: 'vertical' | 'horizontal'; previewResolution?: 'HD' | 'FullHD' | 'UltraHD' | 'EightK'; }; export type CreatePresentation = { name: string; appVersionId: string; applicationVariables: ApplicationVariables; duration: number; themeId: string; resource: { r: { tags?: R.CreateTagResponse[]; }; }; previewOrientation?: 'vertical' | 'horizontal'; previewResolution?: 'HD' | 'FullHD' | 'UltraHD' | 'EightK'; }; export type GetPresentationsListResponse = PresentationsList[]; export type PresentationsList = { id: string; name: string; };