getMethodStreamCallContext method

Future<MethodStreamCallContext> getMethodStreamCallContext({
  1. required Session createSessionCallback(
    1. EndpointConnector connector
    ),
  2. required String endpointPath,
  3. required String methodName,
  4. required Map<String, dynamic> arguments,
  5. required SerializationManager serializationManager,
  6. required List<String> requestedInputStreams,
})
inherited

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 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(methodName, endpointPath);
  }

  List<StreamParameterDescription> inputStreams = parseRequestedInputStreams(
    descriptions: methodConnector.streamParams,
    requestedInputStreams: requestedInputStreams,
  );

  return MethodStreamCallContext(
    method: methodConnector,
    arguments: parsedArguments,
    inputStreams: inputStreams,
    endpoint: endpoint,
    fullEndpointPath: endpointPath,
  );
}