import { AbstractCore } from '../../abstractions/abstract.core'; import { BusTransaction, MessageFunction, SentFrom } from '../../../bus.api'; import { UUID } from '../../../bus'; import { HttpRequest } from './rest.model'; import { RequestCorsMode, RequestCredentialsMode } from './rest.service'; export interface RestOperation { id?: UUID; uri: string; method: HttpRequest; body?: any; pathParams?: any; queryParams?: any; headers?: any; apiClass?: string; sentFrom?: string; successHandler: MessageFunction; errorHandler?: MessageFunction; } export declare class RestOperations extends AbstractCore { protected static _instance: RestOperations; protected readonly execContext: any; /** * Kill instance of service. */ static destroy(): void; static getInstance(): RestOperations; readonly id: UUID; constructor(); setGlobalHttpHeaders(headers: any, from: SentFrom): void; /** * Dev use only, don't use this in production. * * @deprecated This method is deprecated in lieu of the new method that would allow full combinations of * CORS and credentials modes. See {@link configureCorsAndCredentials}. */ disableCorsAndCredentials(from: SentFrom): void; /** * Configure cross-origin requests (CORS) and credentials policies with Fetch API. * CORS mode tells whether cross-origin requests can be made successfully across domains. * Credentials is Fetch equivalent of `XmlHttpRequest::withCredentials` that indicates whether the user agent * should send cookies from one domain to another. The default values for the CORS and credentials are * `cors` and `same-origin`, respectively and they require their server counterpart configured accordingly * to work properly. See the following references for more information. * * https://developer.mozilla.org/en-US/docs/Web/API/Request/mode * https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials * * @param corsMode * @param credentialsMode * @param from */ configureCorsAndCredentials(corsMode: RequestCorsMode, credentialsMode: RequestCredentialsMode, from: SentFrom): void; /** * Change default host and scheme (defaults to same host and scheme) * @param host hostname/ip/port etc. This is just a string * @param scheme 'http', 'https' * @param from who is making this call? */ setRestServiceHostOptions(host: string, scheme: string, from: SentFrom): void; restServiceRequest(operation: RestOperation, from: SentFrom): BusTransaction; }