UNPKG

@eddye68/studio-client

Version:

The AWS service Studio client

218 lines (215 loc) 8.81 kB
import { IClient } from './client-interface.mjs'; import { ClientOptions } from './client-options.mjs'; import { LoggerInterface } from '@aws-lambda-powertools/logger/types'; import { IHttpClient } from '../http-client/http-client-interface.mjs'; import { WflObject } from '../model/wfl/wflobject.mjs'; import { RelationType, Relation } from '../model/wfl/relation.mjs'; import { MetaDataValue } from '../model/wfl/metadata-value.mjs'; import { Target } from '../model/wfl/target.mjs'; import { BodyInit } from 'undici-types/fetch'; import '../model/wfl/attachment.mjs'; import '../model/wfl/edition-renditions-info.mjs'; import '../model/wfl/edition.mjs'; import '../model/wfl/rendition-type-info.mjs'; import '../model/wfl/element.mjs'; import '../model/wfl/indesign-article.mjs'; import '../model/wfl/message.mjs'; import '../model/wfl/sticky-info.mjs'; import '../model/wfl/message-list.mjs'; import '../model/wfl/metadata.mjs'; import '../model/wfl/basic-metadata.mjs'; import '../model/wfl/category.mjs'; import '../model/wfl/publication.mjs'; import '../model/wfl/content-metadata.mjs'; import '../model/wfl/extra-metadata.mjs'; import '../model/wfl/rights-metadata.mjs'; import '../model/wfl/source-metadata.mjs'; import '../model/wfl/workflow-metadata.mjs'; import '../model/wfl/state.mjs'; import '../model/wfl/object-label.mjs'; import '../model/wfl/object-operations.mjs'; import '../model/wfl/param.mjs'; import '../model/wfl/page.mjs'; import '../model/wfl/placement.mjs'; import '../model/wfl/object-info.mjs'; import '../model/wfl/property-value.mjs'; import '../model/wfl/issue.mjs'; import '../model/wfl/pub-channel.mjs'; declare class Client implements IClient { private _options; private _logger; private _httpClient; private _studioBaseUrl; private _publicationsCache; get options(): ClientOptions; /** * The configurationId */ private _configurationId; /** * @returns The configurationid * @throws QqAwsServiceStudioClientClientError when not logged on */ get configurationId(): string; /** * * @param logger The logger instance * @param options The Client options * @param httpClient The Http client. When not defined an instance will be created automatically. */ constructor(logger: LoggerInterface, options: ClientOptions, httpClient?: IHttpClient); private validateOptions; /** * * @returns true when logged in */ isLoggedOn(): boolean; setStudioBaseUrl(url: string): void; /** * * @param configurationId * @returns true when logged in */ logon(configurationId: string): Promise<boolean>; /** * * @returns The Woodwing Studio base URL */ getBaseUrl(): string; /** * @param studioUrl The * @param appname The application name * @param username The WoodWing Studio username * @param password The WoodWing Studio password * @param requestId Optional: The requestID * @param configurationId Optional: The configurationID * @returns The new or given ConfigurationId * @throws QqAwsServiceStudioClientClientError when the registration fails. */ register(studioUrl: string, appname: string, username: string, password: string, requestId: string | undefined, configurationId: string | undefined): Promise<string>; unRegister(configurationId?: string): Promise<void>; /** * * @param ids The publication ids to resolve * @param requestInfo What elements to retrieve. "PubChannels","States", "Categories" * @param forceNew When true, ignore local cache. * @returns All resolved publications */ getPublications(ids: string[], requestInfo?: string[], forceNew?: boolean, requestId?: string, configurationId?: string): Promise<Record<string, any>[]>; /** * * @param {string} publicationId * @returns {Promise<null|object>} */ getPublication(publicationId: string, requestInfo?: string[]): Promise<Record<string, any> | null>; /** * * @param forceNew When true create a new ticket instead of the cached ticket * @param requestId * @param configurationId * @returns */ getTicket(forceNew?: boolean, requestId?: string, configurationId?: string): Promise<string>; /** * @inheritdoc */ getStateByName(publicationId: string, type: string, name: string): Promise<null | any>; /** * * @param wflObject * @param childId * @param type * @param parentType * @returns */ getWflRelations(wflObject: any, childId: string, type?: string, parentType?: string): Promise<object[]>; /** * * @param url * @returns */ downloadFile(url: string, query?: URLSearchParams): Promise<ArrayBuffer>; /** * @inheritdoc */ uploadFile(body: BodyInit, contentType: string, size: number): Promise<string>; /** * * @param objectIds * @param rendition * @param requestInfo * @param lock * @param areas * @returns */ getObjects(objectIds: string[], rendition?: string, requestInfo?: string[], lock?: boolean, areas?: string[]): Promise<WflObject[]>; createObjects(wflObjects: WflObject[], lock?: boolean): Promise<WflObject[]>; /** * * @param parentIdOrInstance * @param childIdsOrInstances * @param type * @returns */ createObjectRelations(parentIdOrInstance: string | WflObject, childIdsOrInstances: string[] | WflObject[], type?: RelationType): Promise<Relation[]>; /** * * @param childIdsOrInstances * @param permanent * @param areas * @returns */ deleteObjects(childIdsOrInstances: string[] | WflObject[], permanent?: boolean, areas?: string): Promise<object>; /** * * @param action Workflow Action type. * @param context v10.40 Can be used to provide relevant information based on the dialog circumstances. * @param metaData v8.0: MetaData value allows client app to round trip the data. * @param targets v8.0: Object's targets. Data contained in Targets allow client app to round trip the data. * @param defaultDossier v7.0: Dossier ID: Request to populate the Dossier property. * The given Publication and Issue are used to get dossiers (to choose from). If no Issue specified, * first one is taken. The dossier ID will be used to set the default value at Dossier property. * If DefaultDossier is nil (or left out) no dossier property nor dossiers will be returned. * @param parent v7.0: Parent ID: When creating objects that are placed (such as creating articles form layout) the client * knows that the object will be placed, but the server does not know yet. For placed objects, * the dialog has some fields disabled (greyed) like Publication/Brand, Issue and Category. Nil (or left out) * means object is not placed. * @param template v7.0: Template ID : When creating objects, some properties should be taken from a template. * Those should be pre-filled in for the new object at the Create workflow dialog. Provide the object ID of * the template (that was picked by user) to let server pre-fill properties. Nil (or left out) means object * is not created from template. * @param areas v8.0: Area to search for the object. Nil means 'workflow' area only (for backwards compatibility reasons). * @param multipleObjects v9.2: Indicate if the dialog is for multiple objects or single object. * Nil means 'false' (for backwards compatibility reasons). * @returns */ getDialog2(action: string, context?: string, metaData?: MetaDataValue[], targets?: Target[], defaultDossier?: string, parent?: string, template?: string, areas?: string[], multipleObjects?: boolean): Promise<any>; /** * * @param ids The brand id(s) * @param requestInfo What elements to retrieve. "PubChannels","States", "Categories" * @param requestId * @param configurationId * @returns */ private getPublicationsInt; /** * Add the ConfigurationId and RequestId to the query * * * @param configurationId Overrule the configurationId when required. * @returns */ private _getCommonQueryParameters; /** * Get the parentId from the iddOrInstance * * @param iddOrInstance * @returns The object id * @throws ClientError when the id cannot be determined */ private _getObjectId; _sanitizeUrl(url: string): string; _generateRequestId(): string; } export { Client };