getMethodStreamCallContext method
Future<MethodStreamCallContext>
getMethodStreamCallContext({
- required FutureOr<
Session> createSessionCallback(- EndpointConnector connector
- required String endpointPath,
- required String methodName,
- required Map<
String, dynamic> arguments, - required SerializationManager serializationManager,
- required List<
String> requestedInputStreams,
Tries to get a MethodStreamCallContext for a given endpoint and method name. If the method is not found, a MethodNotFoundException is thrown. If the endpoint is not found, an EndpointNotFoundException is thrown. If the user is not authorized to access the endpoint, a NotAuthorizedException is thrown. If the input parameters are invalid, an InvalidParametersException is thrown. If the found method is not a MethodStreamConnector, an InvalidEndpointMethodTypeException is thrown.
Implementation
Future<MethodStreamCallContext> getMethodStreamCallContext({
required FutureOr<Session> Function(EndpointConnector connector)
createSessionCallback,
required String endpointPath,
required String methodName,
required Map<String, dynamic> arguments,
required SerializationManager serializationManager,
required List<String> requestedInputStreams,
}) async {
var (
methodConnector,
endpoint,
parsedArguments,
) = await _getEndpointMethodConnector(
createSessionCallback: createSessionCallback,
endpointPath: endpointPath,
methodName: methodName,
arguments: arguments,
serializationManager: serializationManager,
);
if (methodConnector is! MethodStreamConnector) {
throw InvalidEndpointMethodTypeException();
}
List<StreamParameterDescription> inputStreams = parseRequestedInputStreams(
descriptions: methodConnector.streamParams,
requestedInputStreams: requestedInputStreams,
);
return MethodStreamCallContext(
method: methodConnector,
arguments: parsedArguments,
inputStreams: inputStreams,
endpoint: endpoint,
fullEndpointPath: endpointPath,
);
}