import {Extension, HttpMethod, IServiceCall, SessionRequirement} from "@chaosinsight/portalclient" import type {IEndpointResult, IPortalResponse} from "../index" export default class EZAsset extends Extension { protected readonly extensionName = "EZAsset" public getGet(id: string): IServiceCall> { return this.call("Get", {id}, HttpMethod.Get, SessionRequirement.basic) } public setPost(data: IAssetSetRequest): IServiceCall> { return this.call("Set", {data}, HttpMethod.Post, SessionRequirement.authenticated) } public deleteGet(id: string): IServiceCall> { return this.call("Delete", {id}, HttpMethod.Get, SessionRequirement.authenticated) } public setFileAccessPost(id: string, requireLogin: boolean): IServiceCall> { return this.call("SetFileAccess", {id, requireLogin}, HttpMethod.Post, SessionRequirement.authenticated) } public setTagPost(id: string, tags: string): IServiceCall> { return this.call("SetTag", {id, tags}, HttpMethod.Post, SessionRequirement.authenticated) } } export interface IAsset { Identifier: string TypeId: string DoFilesRequireLogin: boolean Data: IData[] Files: IFile[] Annotations: IAnnotationGroup[] Tags: string[] } export interface IAssetSetRequest { Identifier: string [key: string]: string } export interface IData { Name: string Fields: { [key: string]: string } } export interface IFile { Identifier: string Type: FileType Name: string Destinations: IDestination[] } export enum FileType { video = "Video", audio = "Audio", image = "Image", other = "Other" } export interface IDestination { Type: string Url: string } export interface IAnnotationGroup { DefinitionId: string Name: string Data: IAnnotation[] } export interface IAnnotation { [key: string]: string } Extension.add(EZAsset, "ezAsset") declare module "@chaosinsight/portalclient" { interface ExtensionHandler { ezAsset: EZAsset } }