/*! * @license * Copyright © 2005-2024 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 { Authentication } from '../authentication/authentication'; import { Emitter } from 'event-emitter'; export interface RequestOptions { 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; readonly accept?: string; readonly contentType?: string; } export interface HttpClientConfig { contextRoot?: string; host?: string; // Should be mandatory but can't make it because of AlfrescoApiConfig incompatibility 😕 servicePath?: string; // Should be mandatory but can't make it because of AlfrescoApiConfig incompatibility 😕 } export interface LegacyHttpClient { basePath: string; config: HttpClientConfig; request(options: RequestOptions): Promise; post(options: RequestOptions): Promise; put(options: RequestOptions): Promise; get(options: RequestOptions): Promise; delete(options: RequestOptions): Promise; /** @deprecated */ 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 ): Promise; /** @deprecated */ 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 ): Promise; } export interface SecurityOptions { readonly isBpmRequest: boolean; readonly enableCsrf?: boolean; readonly withCredentials?: boolean; readonly authentications: Authentication; readonly defaultHeaders: Record; } export interface Emitters { readonly eventEmitter: Emitter; readonly apiClientEmitter: Emitter; } export interface HttpClient { request(url: string, options: RequestOptions, security: SecurityOptions, emitters: Emitters): Promise; post(url: string, options: RequestOptions, security: SecurityOptions, emitters: Emitters): Promise; put(url: string, options: RequestOptions, security: SecurityOptions, emitters: Emitters): Promise; get(url: string, options: RequestOptions, security: SecurityOptions, emitters: Emitters): Promise; delete(url: string, options: RequestOptions, security: SecurityOptions, emitters: Emitters): Promise; }