lavva.exalushome
Version:
Library implementing communication and abstraction layers for ExalusHome system
77 lines (76 loc) • 4.59 kB
TypeScript
import { Status } from "../../DataFrame";
import { IDIService } from "../../IDIService";
import { ResponseResult } from "../FieldChangeResult";
import { IPicture, IPictureInfo as IPictureInfo } from "./IPicture";
import { Picture } from "./Picture";
export interface IPicturesService extends IDIService {
/**
* Function to add new picture to system
* @param picture Picture object witch picture encoded to Base64 string (in any format, the only limitation is the size in bytes)
* @returns
* - OK - picture added
* - NoPermissionToPerformThisOperation - when picture OwnerGuid is different than user Guid currently logged in session (when user priviliges is not set to admin or higher)
* - WrongData - when byte lenght of picutre is higher than 512kB or guid of picture is not empty
* - UnknownError - when unidentified error occurs
* - Error - when cannot check if picture exists
* - FatalError - when an exception occurs
*/
AddPictureAsync(picture: Picture): Promise<Status>;
/**
* Function to edit existing picture in system
* @param picture Picture object witch picture encoded to Base64 string (in any format, the only limitation is the size in bytes). Base64 string must contains data:image/*;base64 prefix and paylode must be able to create image from tag <img src='paylode'>.
* @returns
* - OK - picture edited
* - NoPermissionToPerformThisOperation - when picture OwnerGuid is different than user Guid currently logged in session (when user priviliges is not set to admin or higher)
* - WrongData - when byte lenght of picutre is higher than 512kB, guid of picture is not empty or picture is in inccorect format.
* - OperationNotPermitted - when picture already exists
* - UnknownError - when unidentified error occurs
* - Error - when cannot check if picture exists
* - FatalError - when an exception occurs
*/
EditPictureAsync(picture: Picture): Promise<Status>;
/**
* Function to delete picture
* @param picture Picture object witch picture encoded to Base64 string (in any format, the only limitation is the size in bytes). Base64 string must contains data:image/*;base64 prefix and paylode must be able to create image from tag <img src='paylode'>.
* @returns
* - OK - picture removed
* - NoPermissionToPerformThisOperation - when picture OwnerGuid is different than user Guid currently logged in session (when user priviliges is not set to admin or higher)
* - WrongData - when byte lenght of picutre is higher than 512kB, guid of picture is empty or picture is in inccorect format.
* - UnknownError - when unidentified error occurs
* - FatalError - when an exception occurs
*/
DeletePictureAsync(picture: Picture): Promise<Status>;
/**
* Function to get pictures info data - this data contains information about guid and modyfication date of pictures in system.
* Method coud be use to check if some pictures should be updated/synchronized with local cache.
* @returns
* - Array of picture info's when request finished with success (if there is no pictures in system - it will return empty array)
* - ResponseResult<Status> with relevant message when error occurs, below described statuses with assigned messages:
* - UnknownError | NoDataInResult
* - FatalError | ExceptionOccurred
* - other status | UnknownReason
*/
GetPicturesInfoAsync(): Promise<IPictureInfo[] | ResponseResult<Status>>;
/**
* Function to get single picture by guid
* @param pictureGuid
* @returns
* - Picture when request finished with success
* - ResponseResult<Status> with relevant message when error occurs, below described statuses with assigned messages:
* - UnknownError | NoDataInResult
* - ResourceDoesNotExists | PictureNotFound
* - FatalError | ExceptionOccurred
* - other status | UnknownReason
*/
GetPictureAsync(pictureGuid: string): Promise<IPicture | ResponseResult<Status>>;
/**
* Function to get all pictures from system
* @returns
* - Array of pictures when request finished with success (if there is no pictures in system - it will return empty array)
* - ResponseResult<Status> with relevant message when error occurs, below described statuses with assigned messages:
* - UnknownError | NoDataInResult
* - FatalError | ExceptionOccurred
* - other status | UnknownReason
*/
GetPicturesListAsync(): Promise<IPicture[] | ResponseResult<Status>>;
}