import { ConfigParams } from 'pip-services3-commons-node'; import { CommandSet } from 'pip-services3-commons-node'; import { RestService } from './RestService'; /** * Abstract service that receives remove calls via HTTP protocol * to operations automatically generated for commands defined in [[https://pip-services3-node.github.io/pip-services3-commons-node/interfaces/commands.icommandable.html ICommandable components]]. * Each command is exposed as POST operation that receives all parameters in body object. * * Commandable services require only 3 lines of code to implement a robust external * HTTP-based remote interface. * * ### Configuration parameters ### * * - base_route: base route for remote URI * - dependencies: * - endpoint: override for HTTP Endpoint dependency * - controller: override for Controller dependency * - connection(s): * - discovery_key: (optional) a key to retrieve the connection from [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/connect.idiscovery.html IDiscovery]] * - protocol: connection protocol: http or https * - host: host name or IP address * - port: port number * - uri: resource URI or connection string with all parameters in it * * ### References ### * * - \*:logger:\*:\*:1.0 (optional) [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/log.ilogger.html ILogger]] components to pass log messages * - \*:counters:\*:\*:1.0 (optional) [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/count.icounters.html ICounters]] components to pass collected measurements * - \*:discovery:\*:\*:1.0 (optional) [[https://pip-services3-node.github.io/pip-services3-components-node/interfaces/connect.idiscovery.html IDiscovery]] services to resolve connection * - \*:endpoint:http:\*:1.0 (optional) [[HttpEndpoint]] reference * * @see [[CommandableHttpClient]] * @see [[RestService]] * * ### Example ### * * class MyCommandableHttpService extends CommandableHttpService { * public constructor() { * base(); * this._dependencyResolver.put( * "controller", * new Descriptor("mygroup","controller","*","*","1.0") * ); * } * } * * let service = new MyCommandableHttpService(); * service.configure(ConfigParams.fromTuples( * "connection.protocol", "http", * "connection.host", "localhost", * "connection.port", 8080 * )); * service.setReferences(References.fromTuples( * new Descriptor("mygroup","controller","default","default","1.0"), controller * )); * * service.open("123", (err) => { * console.log("The REST service is running on port 8080"); * }); */ export declare abstract class CommandableHttpService extends RestService { protected _commandSet: CommandSet; protected _swaggerAuto: boolean; /** * Creates a new instance of the service. * * @param baseRoute a service base route. */ constructor(baseRoute: string); /** * Configures component by passing configuration parameters. * * @param config configuration parameters to be set. */ configure(config: ConfigParams): void; /** * Registers all service routes in HTTP endpoint. */ register(): void; }