// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using System; using System.Threading.Tasks; using Microsoft.SqlTools.Hosting.Contracts; namespace Microsoft.SqlTools.Hosting.Protocol { /// /// Interface for objects that can will handle messages. The methods exposed via this interface /// allow users to what to do when a specific message is received. /// public interface IMessageDispatcher { /// /// Sets the function to run when a request message of a specific /// is received /// /// Configuration of the request message will handle /// What to do when a request message of is received /// If true, any existing handler will be replaced with this one /// Type of the parameters for the request, defined by /// Type of the response to the request, defined by void SetAsyncRequestHandler( RequestType requestType, Func, Task> requestHandler, bool overrideExisting = false); /// /// Sets the function to run when a request message of a specific /// is received /// /// Configuration of the request message will handle /// What to do when a request message of is received /// If true, any existing handler will be replaced with this one /// Type of the parameters for the request, defined by /// Type of the response to the request, defined by void SetRequestHandler( RequestType requestType, Action> requestHandler, bool overrideExisting = false); /// /// Sets the function to run when an event message of a specific configurat /// is received /// /// Configuration of the event message will handle /// What to do when an event message of is received /// If true, any existing handler will be replaced with this one /// Type of the parameters for the event void SetAsyncEventHandler( EventType eventType, Func eventHandler, bool overrideExisting = false); /// /// Sets the function to run when an event message of a specific /// is received /// /// Configuration of the event message will handle /// What to do when an event message of is received /// If true, any existing handler will be replaced with this one /// Type of the parameters for the event void SetEventHandler( EventType eventType, Action eventHandler, bool overrideExisting = false); } }