public async Task <HttpResponseMessage> ListProjectApiVersions(string projectName) { var project = await this .GetProjectDataProvider() .FindProject( organizationId: Project.GlobalProject, projectId: projectName) .ConfigureAwait(continueOnCapturedContext: false); if (project == null) { throw new ErrorResponseMessageException( httpStatus: HttpStatusCode.NotFound, errorCode: ErrorResponseCode.ProjectNotFound, errorMessage: string.Format("The project with name {0} was not found", projectName)); } var apiVersions = await this .GetApiVersionDataProvider() .FindApiVersions( organizationId: Project.GlobalProject, projectId: projectName) .ConfigureAwait(continueOnCapturedContext: false); // TODO: Move the $expand logic into query string reader var queryStringReader = new QueryStringReader(requestUri: this.Request.RequestUri); var expandProject = queryStringReader.QueryParameters.ContainsKey("$expand") && queryStringReader.QueryParameters["$expand"].EqualsInsensitively("project"); return(this.Request.CreateResponse( statusCode: HttpStatusCode.OK, value: apiVersions.Results.CoalesceEnumerable().Select(apiVersion => apiVersion.ToDefinition(expandProject ? project : null)), configuration: this.HttpConfiguration, encodedContinuationToken: null)); }
public RemoteRunStatLightSystem(Assembly assemblyToTest, Action<UIElement> rootVisualActionOnReady) { _assemblyToTest = assemblyToTest; SetPostbackUri(null); IQueryStringReader queryStringReader = new QueryStringReader(); string postbackUrl = queryStringReader.GetValueOrDefault(StatLightServiceRestApi.StatLightResultPostbackUrl, default(string)); if (postbackUrl != default(string)) { Console.WriteLine("postbackUrl={0}".FormatWith(postbackUrl)); SetPostbackUri(new Uri(postbackUrl)); } OnReadySetupRootVisual(rootVisualActionOnReady); }
public RemoteRunStatLightSystem(Assembly assemblyToTest, Action <UIElement> rootVisualActionOnReady) { _assemblyToTest = assemblyToTest; SetPostbackUri(null); IQueryStringReader queryStringReader = new QueryStringReader(); string postbackUrl = queryStringReader.GetValueOrDefault(StatLightServiceRestApi.StatLightResultPostbackUrl, default(string)); if (postbackUrl != default(string)) { Console.WriteLine("postbackUrl={0}".FormatWith(postbackUrl)); SetPostbackUri(new Uri(postbackUrl)); } OnReadySetupRootVisual(rootVisualActionOnReady); }
public QueryParserBenchmarks() { IJsonApiOptions options = new JsonApiOptions { EnableLegacyFilterNotation = true }; IResourceGraph resourceGraph = DependencyFactory.CreateResourceGraph(options); var request = new JsonApiRequest { PrimaryResource = resourceGraph.GetResourceContext(typeof(BenchmarkResource)) }; _queryStringReaderForSort = CreateQueryParameterDiscoveryForSort(resourceGraph, request, options, _queryStringAccessor); _queryStringReaderForAll = CreateQueryParameterDiscoveryForAll(resourceGraph, request, options, _queryStringAccessor); }
public async Task <HttpResponseMessage> ListProjects() { var projects = await this .GetProjectDataProvider() .FindProjects(organizationId: Project.GlobalProject) .ConfigureAwait(continueOnCapturedContext: false); // TODO: Move the $expand logic into query string reader var queryStringReader = new QueryStringReader(requestUri: this.Request.RequestUri); var expandApiVersions = queryStringReader.QueryParameters.ContainsKey("$expand") && queryStringReader.QueryParameters["$expand"].EqualsInsensitively("apiVersions"); IEnumerable <ApiVersion> apiVersions = null; if (expandApiVersions) { var allApiVersions = await this .GetApiVersionDataProvider() .FindApiVersions(organizationId: Project.GlobalProject) .ConfigureAwait(continueOnCapturedContext: false); apiVersions = allApiVersions.Results.CoalesceEnumerable(); } var projectDefinitions = projects.Results .CoalesceEnumerable() .Select(project => { ApiVersionDefinition[] projectApiVersions = null; if (expandApiVersions) { projectApiVersions = apiVersions .Where(apiVersion => apiVersion.ProjectId.EqualsInsensitively(project.ProjectId)) .SelectArray(apiVersion => apiVersion.ToDefinition()); } return(project.ToDefinition(apiVersions: projectApiVersions)); }); return(this.Request.CreateResponse( statusCode: HttpStatusCode.OK, value: projectDefinitions, configuration: this.HttpConfiguration, encodedContinuationToken: null)); }