/* Copyright (c), CKSource Holding sp. z o.o. All rights reserved. */ import Message, { type IMessage } from './../../message'; import type { IDescriptorBody } from '../../descriptor'; import { type IRevision, type IRevisionJSON } from '../descriptors/revisiondescriptor'; import type { IRevisionObject } from '../revision'; import { type IUserJSON } from '../../users/descriptors/userdescriptor'; export interface IRevisionHistoryConnectResponseJSON extends IMessage { channel: string; requestId: number; revisions: IRevisionJSON[]; users?: IUserJSON[]; latestRevision?: IRevisionJSON; } export interface IRevisionHistoryConnectResponseObject { channel: string; requestId: number; revisions: IRevisionObject[]; users?: Record[]; latestRevision?: IRevisionObject; } export default class RevisionHistoryConnectResponse extends Message { readonly channel: string; readonly requestId: number; readonly revisions: IRevision[]; readonly users?: Record[] | undefined; /** * The last revision of {@link #revisions}, with its `diffData`. */ readonly latestRevision?: IRevision | undefined; static readonly DESCRIPTOR_NAME: string; static readonly DESCRIPTOR: IDescriptorBody; constructor(channel: string, requestId: number, revisions: IRevision[], users?: Record[] | undefined, /** * The last revision of {@link #revisions}, with its `diffData`. */ latestRevision?: IRevision | undefined); toJSON(): IRevisionHistoryConnectResponseJSON; /** * Creates frontend revision history model from message sent from the backend. * * This method is intended to be used on the frontend side after receiving the response from the backend. */ toObject(): IRevisionHistoryConnectResponseObject; static fromJSON(json: IRevisionHistoryConnectResponseJSON): RevisionHistoryConnectResponse; }