UNPKG

1.8 kBTypeScriptView Raw
1/** @module connect */
2import { ConnectionParams } from './ConnectionParams';
3/**
4 * Interface for discovery services which are used to store and resolve connection parameters
5 * to connect to external services.
6 *
7 * @see [[ConnectionParams]]
8 * @see [[CredentialParams]]
9 */
10export interface IDiscovery {
11 /**
12 * Registers connection parameters into the discovery service.
13 *
14 * @param correlationId (optional) transaction id to trace execution through call chain.
15 * @param key a key to uniquely identify the connection parameters.
16 * @param credential a connection to be registered.
17 * @param callback callback function that receives a registered connection or error.
18 */
19 register(correlationId: string, key: string, connection: ConnectionParams, callback: (err: any, result: ConnectionParams) => void): void;
20 /**
21 * Resolves a single connection parameters by its key.
22 *
23 * @param correlationId (optional) transaction id to trace execution through call chain.
24 * @param key a key to uniquely identify the connection.
25 * @param callback callback function that receives found connection or error.
26 */
27 resolveOne(correlationId: string, key: string, callback: (err: any, result: ConnectionParams) => void): void;
28 /**
29 * Resolves all connection parameters by their key.
30 *
31 * @param correlationId (optional) transaction id to trace execution through call chain.
32 * @param key a key to uniquely identify the connections.
33 * @param callback callback function that receives found connections or error.
34 */
35 resolveAll(correlationId: string, key: string, callback: (err: any, result: ConnectionParams[]) => void): void;
36}