/*! * @license * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { AlfrescoApiConfig } from './alfrescoApiConfig'; import { Authentication } from './authentication/authentication'; import { HttpClient, LegacyHttpClient, RequestOptions } from './api-clients/http-client.interface'; import { Storage } from './storage'; import { EventEmitterInstance } from './types'; export type AlfrescoApiClientPromise = Promise & { on: (event: K, fn: (...args: any[]) => void, context?: any) => AlfrescoApiClientPromise; off: (event: K, fn?: (...args: any[]) => void, context?: any) => AlfrescoApiClientPromise; once: (event: K, fn: (...args: any[]) => void, context?: any) => AlfrescoApiClientPromise; emit: (event: K, ...args: any[]) => boolean; abort?: () => void; }; /** * Builds a string representation of an array-type actual parameter, according to the given collection format. * @param param An array parameter. * @param collectionFormat The array element separator strategy. * @returns A string representation of the supplied collection, using the specified delimiter. Returns * param as is if collectionFormat is multi. */ export declare function buildCollectionParam(param: string[], collectionFormat: string): string | any[]; export declare class AlfrescoApiClient implements LegacyHttpClient { private readonly eventEmitter; storage: Storage; host: string; className: string; config: AlfrescoApiConfig; url: string; /** * The base URL against which to resolve every API call's (relative) path. */ basePath: string; /** * The authentication methods to be included for all API calls. */ authentications: Authentication; /** * The default HTTP headers to be included for all API calls. */ defaultHeaders: {}; /** * The default HTTP timeout for all API calls. */ timeout: number | { deadline?: number; response?: number; }; contentTypes: { JSON: string[]; }; httpClient: HttpClient; constructor(host?: string, httpClient?: HttpClient); on(event: K, fn: (...args: any[]) => void, context?: any): this; off(event: K, fn?: (...args: any[]) => void, context?: any): this; once(event: K, fn: (...args: any[]) => void, context?: any): this; emit(event: K, ...args: any[]): boolean; request(options: RequestOptions): Promise; post(options: RequestOptions): AlfrescoApiClientPromise; put(options: RequestOptions): AlfrescoApiClientPromise; get(options: RequestOptions): AlfrescoApiClientPromise; delete(options: RequestOptions): AlfrescoApiClientPromise; callApi(path: string, httpMethod: string, pathParams?: any, queryParams?: any, headerParams?: any, formParams?: any, bodyParam?: any, contentTypes?: string[], accepts?: string[], returnType?: any, contextRoot?: string, responseType?: string, url?: string): AlfrescoApiClientPromise; callCustomApi(path: string, httpMethod: string, pathParams?: any, queryParams?: any, headerParams?: any, formParams?: any, bodyParam?: any, contentTypes?: string[], accepts?: string[], returnType?: any, contextRoot?: string, responseType?: string): AlfrescoApiClientPromise; isCsrfEnabled(): boolean; isBpmRequest(): boolean; basicAuth(username: string, password: string): string; isWithCredentials(): boolean; getAlfTicket(ticket: string): string; /** * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders * with parameter values */ private static buildUrl; private static addParamsToUrl; private getCallApiUrl; private buildRequestCall; private getSecurityOptions; private getEventEmitters; private getRequestOptionsWithAcceptAndContentType; /** * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. * @param contentTypes content types * @returns The chosen content type, preferring JSON. */ private static jsonPreferredMime; /** * Checks whether the given content type represents JSON.
* * JSON content type examples:
*
    *
  • application/json
  • *
  • application/json; charset=UTF8
  • *
  • APPLICATION/JSON
  • *
* @param contentType The MIME content type to check. * @returns true if contentType represents JSON, otherwise false. */ private static isJsonMime; addPromiseListeners(promise: Promise, eventEmitter: EventEmitterInstance): AlfrescoApiClientPromise; }