import { IAttachment , IBaseRestApiResponse , IDesk , IRestApiResponse , IUser , IWebsocketMessage , } from 'superdesk-api' ; import { IModalSize } from './ui/modal' ; export enum SET_STATE { DRAFT = 'draft' , USABLE = 'usable' , DISABLED = 'disabled' } export enum ASSET_STATE { DRAFT = 'draft' , INTERNAL = 'internal' , PUBLIC = 'public' } export enum CONTENT_PANEL_STATE { CLOSED = 'closed' , PREVIEW = 'preview' , EDIT = 'edit' , CREATE = 'create' } export enum ASSET_CONTENT_PANEL_STATE { CLOSED = 'closed' , PREVIEW = 'preview' , EDIT = 'edit' , CREATE = 'create' } export enum ASSET_TYPE_FILTER { ALL = 'all' , IMAGES = 'images' , VIDEOS = 'videos' , AUDIO = 'audio' , DOCUMENTS = 'documents' } export enum ASSET_LIST_STYLE { GRID = 'grid' , LIST = 'list' } export enum ASSET_SORT_FIELD { NAME = 'name.keyword' , FILENAME = 'filename' , CREATED = '_created' , UPDATED = '_updated' , SIZE = 'length' } export enum SORT_ORDER { ASCENDING = 'ascending' , DESCENDING = 'descending' } export enum LIST_ACTION { APPEND = 'append' , REPLACE = 'replace' } export enum ASSET_ACTIONS { PREVIEW = 'preview' , DOWNLOAD = 'download' , DELETE = 'delete' , EDIT = 'edit' , FORCE_UNLOCK = 'force_unlock' , VIEW_FULL_SCREEN = 'view_full_screen' } export enum DATA_UNIT { BYTES = 'bytes' , KB = 'kb' , MB = 'mb' , GB = 'gb' } export enum RENDITION { ORIGINAL = 'original' , THUMBNAIL = 'thumbnail' , VIEW_IMAGE = 'viewImage' } export interface IBaseAssetAction { id : ASSET_ACTIONS ; label : string ; icon : string ; } export interface IAssetAction extends IBaseAssetAction { onSelect ( asset ) : void ; isAllowed ( asset ) : boolean ; } export interface IAssetCallback { action : ASSET_ACTIONS ; onSelect ( asset ) : void ; } export interface IBulkAction extends IBaseAssetAction { onSelect ( ) : void ; } export interface IBulkActionAssetCallback { action : ASSET_ACTIONS ; onSelect ( ) : void ; } export interface IVersionInformation extends IBaseRestApiResponse { firstcreated : string ; versioncreated : string ; original_creator ? : IUser [ '_id' ] ; version_creator ? : IUser [ '_id' ] ; } export interface ISetItem extends IVersionInformation { name : string ; state : SET_STATE ; description ? : string ; maximum_asset_size ? : number ; destination_name ? : string ; destination_config ? : Dictionary < string , any > ; destination ? : IStorageDestinationItem ; } export interface IStorageDestinationItem extends IBaseRestApiResponse { provider ? : string ; } export interface ISAMSBaseEvent { user_id : string ; session_id : string ; extension : 'sams' ; item_id ? : string ; _etag ? : string ; } export type ISAMSWebsocketEvent = CustomEvent < IWebsocketMessage < ISAMSBaseEvent > > ; export interface IAutoTaggingSearchResult { tags : Array < string > ; } export interface IAssetTag { name : string ; code : string ; } export interface IAssetRenditionArgs { width : number ; height : number ; keep_proportions : boolean ; } export interface IAssetRendition { _media_id : string ; name : string ; width : number ; height : number ; params : IAssetRenditionArgs ; versioncreated : string ; filename : string ; length : number ; } export interface IAssetItem extends IVersionInformation { set_id : string ; parent_id : string ; state : ASSET_STATE ; filename : string ; length : number ; mimetype : string ; name : string ; description : string ; lock_action : string ; lock_user : string ; lock_session : string ; tags : Array < IAssetTag > ; renditions : Array < IAssetRendition > ; extra : Dictionary < string , any > ; } export interface IAssetSearchParams { textSearch ? : string ; setId ? : string ; setIds ? : Array < string > ; excludedAssetIds ? : Array < string > ; name ? : string ; description ? : string ; tags ? : Array < IAssetTag > ; state ? : ASSET_STATE ; states ? : Array < ASSET_STATE > ; filename ? : string ; page : number ; mimetypes : ASSET_TYPE_FILTER ; dateFrom ? : Date ; dateTo ? : Date ; sizeFrom ? : number ; sizeTo ? : number ; sortField : ASSET_SORT_FIELD ; sortOrder : SORT_ORDER ; } export interface IAPIError { error : string ; name : string ; description : string ; errors ? : { [ field ] : Array < string > ; } ; } export interface IUploadAssetModalProps { closeModal ( ) : void ; sets : Array < ISetItem > ; modalSize ? : IModalSize ; initialFiles ? : Array < { id : string ; file : File ; } > ; defaultAssetState ? : ASSET_STATE ; allowedStates ? : Array < ASSET_STATE > ; onAssetUploaded ? ( asset ) : Promise < void > ; onModalClosed ? ( assets ? ) : void ; } export interface ISamsAPI { sets : { getAll ( ) : Promise < Array < ISetItem > > ; create ( set , deskRestrictions ? ) : Promise < ISetItem > ; update ( original , updates , deskRestrictions ? ) : Promise < ISetItem > ; delete ( set ) : Promise < void > ; } ; storageDestinations : { getAll ( ) : Promise < Array < IStorageDestinationItem > > ; } ; assets : { upload ( data , onProgress ? ) : Promise < IAssetItem > ; update ( original , updates ) : Promise < IAssetItem > ; query ( params , listStyle ) : Promise < IRestApiResponse < IAssetItem > > ; getSearchUrlParams ( ) : Partial < IAssetSearchParams > ; setSearchUrlParams ( params ) : void ; getCount ( set_ids ) : Promise < Dictionary < string , number > > ; getById ( assetId ) : Promise < IAssetItem > ; getByIds ( ids ) : Promise < IRestApiResponse < IAssetItem > > ; updateMetadata ( originalAsset , originalAttachment , updates ) : Promise < [ IAttachment , IAssetItem ] > ; showUploadModal ( props ? ) : void ; getCompressedBinary ( asset_ids ) : void ; getAssetBinary ( asset ) : Promise < void | Response > ; deleteAsset ( asset ) : Promise < void > ; lockAsset ( asset , updates ) : Promise < Partial < IAssetItem > > ; unlockAsset ( asset , updates ) : Promise < Partial < IAssetItem > > ; searchTags ( searchTags ) : Promise < IAutoTaggingSearchResult > ; getDownloadUrl ( assetId ) : string ; images : { getRenditionUrl ( assetId , width ? , height ? , keepProportions ? ) : string ; } ; } ; workspace : { getDesksSamsSettings ( ) : Promise < Dictionary < IDesk [ '_id' ] , IDesk [ 'sams_settings' ] > > ; getSingleDeskSamsSettings ( deskId ) : Promise < IDesk [ 'sams_settings' ] > ; updateSetsAllowedDesks ( setId , allowedDesks ) : Promise < void > ; } ; }