UNPKG

@kephas/ngx-core

Version:

Provides integration capabilities with Angular 13+.

87 lines (86 loc) 3.45 kB
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { Logger } from '@kephas/core'; import { NotificationService } from '@kephas/ui'; import { ResponseMessage, MessageProcessorClient, MessagingClientContext } from '@kephas/messaging'; import { Observable } from 'rxjs'; import { AppSettings } from './appSettings'; /** * Provides proxied message processing over HTTP. * * @export * @class MessageProcessor */ export declare class HttpMessageProcessorClient extends MessageProcessorClient { protected appSettings: AppSettings; protected http: HttpClient; protected notification: NotificationService; protected logger: Logger; /** * Gets or sets the base route for the command execution. * * @protected * @type {string} * @memberof MessageProcessor */ protected baseRoute: string; /** * Initializes a new instance of the HttpMessageProcessor class. * @param {NotificationService} notification The notification service. * @param {HttpClient} http The HTTP client. * @param {AppSettings} appSettings The application settings. */ constructor(appSettings: AppSettings, http: HttpClient, notification: NotificationService, logger: Logger); /** * Processes the message asynchronously. * @tparam T The message response type. * @param {{}} message The message. * @param {MessagingClientContext} [options] Optional. Options controlling the message processing. * @returns {Observable{T}} An observable over the result. */ process<T extends ResponseMessage>(message: {}, options?: MessagingClientContext): Observable<T>; /** * Gets the HTTP GET URL. * * @protected * @param {{}} message The message. * @param {MessagingClientContext} [options] Optional. Options controlling the command processing. * @returns {string} The HTTP GET URL. * @memberof MessageProcessor */ protected getHttpPostUrl(message: {}, options?: MessagingClientContext): string; /** * Gets the HTTP GET options. By default it does not return any options. * * @protected * @param {string} command The command. * @param {{}} [args] Optional. The arguments. * @param {MessagingClientContext} [options] Optional. Options controlling the command processing. * @returns {({ * headers?: HttpHeaders | { * [header: string]: string | string[]; * }; * observe?: 'body'; * params?: HttpParams | { * [param: string]: string | string[]; * }; * reportProgress?: boolean; * responseType?: 'json'; * withCredentials?: boolean; * } | undefined)} The options or undefined. * @memberof MessageProcessor */ protected getHttpPostOptions(message: {}, options?: MessagingClientContext): { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body'; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; } | undefined; private _processResponse; private _processError; }