using System;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.NodeServices
{
///
/// Represents the ability to invoke code in a Node.js environment. Although the underlying Node.js instance
/// might change over time (e.g., the process might be restarted), the instance
/// will remain constant.
///
public interface INodeServices : IDisposable
{
///
/// Asynchronously invokes code in the Node.js instance.
///
/// The JSON-serializable data type that the Node.js code will asynchronously return.
/// The path to the Node.js module (i.e., JavaScript file) relative to your project root whose default CommonJS export is the function to be invoked.
/// Any sequence of JSON-serializable arguments to be passed to the Node.js function.
/// A representing the completion of the RPC call.
Task InvokeAsync(string moduleName, params object[] args);
///
/// Asynchronously invokes code in the Node.js instance.
///
/// The JSON-serializable data type that the Node.js code will asynchronously return.
/// A that can be used to cancel the invocation.
/// The path to the Node.js module (i.e., JavaScript file) relative to your project root whose default CommonJS export is the function to be invoked.
/// Any sequence of JSON-serializable arguments to be passed to the Node.js function.
/// A representing the completion of the RPC call.
Task InvokeAsync(CancellationToken cancellationToken, string moduleName, params object[] args);
///
/// Asynchronously invokes code in the Node.js instance.
///
/// The JSON-serializable data type that the Node.js code will asynchronously return.
/// The path to the Node.js module (i.e., JavaScript file) relative to your project root that contains the code to be invoked.
/// Specifies the CommonJS export to be invoked.
/// Any sequence of JSON-serializable arguments to be passed to the Node.js function.
/// A representing the completion of the RPC call.
Task InvokeExportAsync(string moduleName, string exportedFunctionName, params object[] args);
///
/// Asynchronously invokes code in the Node.js instance.
///
/// The JSON-serializable data type that the Node.js code will asynchronously return.
/// A that can be used to cancel the invocation.
/// The path to the Node.js module (i.e., JavaScript file) relative to your project root that contains the code to be invoked.
/// Specifies the CommonJS export to be invoked.
/// Any sequence of JSON-serializable arguments to be passed to the Node.js function.
/// A representing the completion of the RPC call.
Task InvokeExportAsync(CancellationToken cancellationToken, string moduleName, string exportedFunctionName, params object[] args);
}
}