UNPKG

nd-common

Version:

239 lines (238 loc) 7.49 kB
import { HttpHeaders, HttpParams } from "@angular/common/http"; import { IMoveCommand, ICommand, INoOpCommand, IFileCommand, IUnfileCommand } from "../interfaces/api.interface"; import { ListFlags } from "./list-view.model"; /** Enum class that gives the allowed http methods. */ export declare class HttpMethod { static Get: string; static Post: string; static Put: string; static Delete: string; } /** Enum class that provides the possible response types */ export declare class HttpResponseType { static arraybuffer: string; static blob: string; static json: string; static text: string; } /** * Enumeration of supported command types. */ export declare enum CommandType { /** * Do nothing. */ NoOp = 0, /** * File envelopes in a container. */ File = 1, /** * Unfile envelopes from a folder. */ Unfile = 2, /** * Move one or more documents to a destination container. */ Move = 3, /** * Copy one or more documents to a destination container. */ Copy = 4, } /** * Class defines functionality */ export declare class Guid { guid: string; /** * Constructs a Guid object from a given guid string. * @param guid The guid string to create with. */ constructor(guid: string); private _guid; /** * Converts a Guid to a string. */ toString(): string; /** * Constructs a new Guid object. */ static makeNew(): Guid; } /** * Class that defines the properties of a REST command request. See ndCommon.Models.Forms.CommandRequest */ export declare class CommandRequest { /** * Constructs a command request object. */ constructor(); /** * 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>; /** * Adds the given command to the request. * @param command Interface to the command object to be added to the request. * @returns Returns the index of newly added command. -1 is returned on a failure. */ addCommand(command: ICommand): number; /** * Adds the given commands to the request. * @param commands An array of command the request is to process. */ addCommands(commands?: Array<ICommand>): void; } /** * Base class for all supported commands. */ export declare class Command implements ICommand { /** * Constructs a Command object. * @param commonService The common service to be injected. */ constructor(); /** * The caller's identifier for this command. Used to match results with a command. */ Id: string; /** * The command type to process. */ CommandType: CommandType; } /** * Files one or more envelopes in the specified container. */ export declare class NoOpCommand extends Command implements INoOpCommand { constructor(); } /** * Files one or more envelopes in the specified container. */ export declare class FileCommand extends Command implements IFileCommand { constructor(container: string, envelopes: Array<string>, inheritAcl?: boolean, inheritProfile?: boolean); /** * 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; /** * An array 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; } /** * Files one or more envelopes in the specified container. */ export declare class UnfileCommand extends Command implements IUnfileCommand { constructor(container: string, envelopes: Array<string>); /** * 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>; } /** * Moves/Copies one or more documents to one or more destination containers. */ export declare class MoveCommand extends Command implements IMoveCommand { constructor(Id: string, Envelopes: Array<string>, Source: string, Destination: string, AttributesToReturn: Array<string>, ListFlags: ListFlags); /** * The caller's identifier for this command. Used to match results with a command. */ Id: string; /** * The command type to process. */ CommandType: CommandType; /** * 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; } /** Defines the parameters needed to make the API call. Also allows us to add any parameters specific to our system that is not included in the RequestOptions class. */ export declare class CallParameters { body?: any; method: string; headers?: HttpHeaders; url?: string; init?: HttpInit | any; apiVersion: string; path: string; queryArgs?: Object | string; } export declare type HttpInit = { headers?: HttpHeaders; reportProgress?: boolean; params?: HttpParams; responseType?: HttpResponseType2; withCredentials?: boolean; }; export declare type HttpResponseType2 = 'arraybuffer' | 'blob' | 'json' | 'text'; /** Enum class that gives the proper syntax for the RestAPI versions. */ export declare class APIVersions { static one: string; static two: string; } export declare class NetDocumentsService { static ducot: string; static vault: string; static eu: string; static au: string; }