internal static Response ToResponse( IObjectResponse objectResponse, Request request, MediaTypeMapper mediaTypeMapper, IErrorHandler errorHandler, ILogger logger) => Success.Of <Exception, Response>(objectResponse.ResponseFrom(request, mediaTypeMapper)) .Resolve( ex => ResourceErrorProcessor.ResourceHandlerError(errorHandler, logger, ex), response => response);
public RequestHandler2 <T, R> Body <R>(MediaTypeMapper mediaTypeMapper) { MediaTypeMapper = mediaTypeMapper; return(new RequestHandler2 <T, R>( Method, Path, Resolver, ParameterResolver.Body <R>(mediaTypeMapper), ErrorHandler, mediaTypeMapper)); }
public RequestHandler3 <T, TR, TU> Body <TU>(MediaTypeMapper mediaTypeMapper) { MediaTypeMapper = mediaTypeMapper; return(new RequestHandler3 <T, TR, TU>( Method, Path, ResolverParam1, ResolverParam2, ParameterResolver.Body <TU>(mediaTypeMapper), ErrorHandler, MediaTypeMapper)); }
internal RequestHandler2( Method method, string path, ParameterResolver <T> resolverParam1, ParameterResolver <TR> resolverParam2, IErrorHandler errorHandler, MediaTypeMapper mediaTypeMapper) : base(method, path, new List <IParameterResolver> { resolverParam1, resolverParam2 }, errorHandler, mediaTypeMapper) { ResolverParam1 = resolverParam1; ResolverParam2 = resolverParam2; }
internal static ICompletes <Response> ExecuteRequest( Request request, MediaTypeMapper mediaTypeMapper, Func <ICompletes <IObjectResponse> > executeAction, IErrorHandler errorHandler, ILogger logger) { try { return(executeAction.Invoke() .AndThen(objectResponse => ToResponse(objectResponse, request, mediaTypeMapper, errorHandler, logger))); } catch (Exception ex) { return(Completes.WithFailure(ResourceErrorProcessor.ResourceHandlerError(errorHandler, logger, ex))); } }
internal RequestHandler5( Method method, string path, ParameterResolver <T> resolverParam1, ParameterResolver <TR> resolverParam2, ParameterResolver <TU> resolverParam3, ParameterResolver <TI> resolverParam4, ParameterResolver <TJ> resolverParam5, IErrorHandler errorHandler, MediaTypeMapper mediaTypeMapper) : base(method, path, new List <IParameterResolver> { resolverParam1, resolverParam2, resolverParam3, resolverParam4, resolverParam5 }, errorHandler, mediaTypeMapper) { ResolverParam1 = resolverParam1; ResolverParam2 = resolverParam2; ResolverParam3 = resolverParam3; ResolverParam4 = resolverParam4; ResolverParam5 = resolverParam5; }