@kephas/angular
Version:
Provides integration capabilities with Angular.
89 lines (88 loc) • 3.57 kB
TypeScript
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Logger } from '@kephas/core';
import { CommandProcessorClient, CommandClientContext, CommandResponse } from '@kephas/commands';
import { Notification } from '@kephas/ui';
import { AppSettings } from '../../public-api';
import { Observable } from 'rxjs';
/**
* Provides proxied command execution over HTTP.
*
* @export
* @class HttpCommandProcessorClient
*/
export declare class HttpCommandProcessorClient extends CommandProcessorClient {
protected appSettings: AppSettings;
protected http: HttpClient;
protected notification: Notification;
protected logger: Logger;
/**
* Gets or sets the base route for the command execution.
*
* @protected
* @type {string}
* @memberof CommandProcessor
*/
protected baseRoute: string;
/**
* Initializes a new instance of the CommandProcessor class.
* @param {Notification} notification The notification service.
* @param {HttpClient} http The HTTP client.
* @param {AppSettings} appSettings The application settings.
*/
constructor(appSettings: AppSettings, http: HttpClient, notification: Notification, logger: Logger);
/**
* Processes the command asynchronously.
* @tparam T The command response type.
* @param {string} command The command.
* @param {{}} [args] Optional. The arguments.
* @param {CommandClientContext} [options] Optional. Options controlling the command processing.
* @returns {Observable{T}} An observable over the result.
*/
process<T extends CommandResponse>(command: string, args?: {}, options?: CommandClientContext): Observable<T>;
/**
* Gets the HTTP GET URL.
*
* @protected
* @param {string} command The command.
* @param {{}} [args] Optional. The arguments.
* @param {CommandClientContext} [options] Optional. Options controlling the command processing.
* @returns {string} The HTTP GET URL.
* @memberof CommandProcessor
*/
protected getHttpGetUrl(command: string, args?: {}, options?: CommandClientContext): 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 {CommandClientContext} [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 CommandProcessor
*/
protected getHttpGetOptions(command: string, args?: {}, options?: CommandClientContext): {
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;
}