UNPKG

nd-common

Version:

182 lines (181 loc) 5.76 kB
import { CommandType } from "../models/api.model"; import { IPrimaryCabinetModel, IListviewLayout, INavigationPanePinnedModel, IErrorModel } from "./common.interface"; import { ListFlags } from "../models/list-view.model"; /** Base class for controller classes. This ensures that the controllers have the pieces that they need. */ export interface IController { controllerUrl: string; } export interface IAPIParameters { id?: string; [propName: string]: any; } /** * Parameters that are defined for GET rest requests. */ export interface IGetParameters extends IAPIParameters { navigationPaneState?: INavigationPanePinnedModel; primaryCabinet?: IPrimaryCabinetModel; listviewLayout?: IListviewLayout; guid?: string; queryArgs?: any; parent_id?: string; } /** * Parameters that are defined for POST rest requests. */ export interface IPostParameters extends IAPIParameters { body?: any; } /** * Parameters that are defined for PUT rest requests. */ export interface IPutParameters extends IAPIParameters { navigationPaneState?: INavigationPanePinnedModel; primaryCabinet?: IPrimaryCabinetModel; listviewLayout?: IListviewLayout; body?: any; } /** * Defines an object that capable of holding all the arguments * for the various different command types that are currently defined * for use within the system. */ export interface ICommand { /** * The caller's identifier for this command. Used to match results with a command. */ Id: string; /** * The command type to process. */ CommandType: CommandType; } /** * A no op command, one that does nothing. */ export interface INoOpCommand extends ICommand { } /** * Files one or more envelopes in the specified container. */ export interface IFileCommand extends ICommand { /** * The target container. If the command requires * a target container this should be populated * with the envelope url or 12-digit document id. */ Container: string; /** * A list of envelopes that the command processes. */ Envelopes: Array<string>; /** * Indicates if the command should inherit the ACL. Some commands, * like "File", may need to know if you want the have filed envelopes * inherit the containers ACL. */ InheritAcl: boolean; /** * Indicates if the command should inherit profile information. * Some commands, like "File", may need to know if you want * the have filed envelopes inherit the containers profile information. */ InheritProfile: boolean; } /** * Unfile one or more envelopes from a container. */ export interface IUnfileCommand extends ICommand { /** * The target container. If the command requires * a target container this should be populated * with the envelope url or 12-digit document id. */ Container: string; /** * A list of envelopes that the command processes. */ Envelopes: Array<string>; } /** * Move an envelope to the specified container. */ export interface IMoveCommand extends ICommand { /** * An array of items to be moved. Format is envPath[|docNum]. * A source item spec MUST have a shortUrl, such as /rho/a/b/c/d/containerName.nev. * A source item spec MAY have a docNum (optional); but if it does not, docNum = 1. */ Envelopes: Array<string>; /** * The shortUrl of the folder in which the item is currently filed (empty if the item is not filed in a folder). */ Source: string; /** * The guid of the cabinet; or the shortUrl of the folder, filter, workspace, or ShareSpace; * to which the item(s) are being moved. */ Destination: string; /** * Says whether the item should inherit the ACL of the container to which it is being moved. */ InheritAcl: boolean; /** * Says whether the item should inherit the profile of the container to which it is being moved. */ InheritProfile: boolean; /** * List of strings that imply which data are to be returned to the caller. */ AttributesToReturn: Array<string>; /** * Flags the caller wants GetListItem to use. */ ListFlags: ListFlags; } /** * Interface that defines the properties of a REST command request. See ndCommon.Models.Forms.CommandRequest */ export interface ICommandRequest { /** * The user provided id that uniquely defines the command request. */ Id: string; /** * An array of ICommandArguments to execute. * When a command request is executed, these CommandArguments * are executed serially in order. */ Commands: Array<ICommand>; } /** * Interface that defines the properties of a REST command result. See ndCommon.Models.Forms.Commands.CommandResult. */ export interface ICommandResult { /** * The user-provided id that uniquely defines the command. */ Id: string; /** * The commandType that was specified. */ CommandType: CommandType; /** * An array of errors that occurred while the command was being processed. Null if no errors occurred. */ Errors: Array<IErrorModel>; } /** * Interface that defines the properties of a REST command response. See ndCommon.Models.Forms.CommandResponse. */ export interface ICommandResponse { /** * The user-provided id that uniquely defines the command response. */ Id: string; /** * An array of ICommandResults. */ CommandResults: Array<ICommandResult>; }