public IActionResult Get() { _logger.LogInformation("CPAPI: Get (with auth)"); AboutResponse aboutResponse = new AboutResponse(); aboutResponse.about = _localizer["Castlepoint is an API for compliant Records Management (authenticated response)"]; string entityAsJson = JsonConvert.SerializeObject(aboutResponse, Formatting.Indented); ObjectResult result = new ObjectResult(entityAsJson); return(result); }
public async Task <ActionResult <AboutResponse> > AboutWebApi() { var retValue = new AboutResponse() { Application = _appEnvirormentSettings.WebApiTitle, Version = _appEnvirormentSettings.WebApiVersion, Os = RuntimeInformation.OSDescription, // Framework = RuntimeInformation.FrameworkDescription, Framework = eOvjera.Common.AppAssemblyUtils.GetFrameworkDescription(), Date = eOvjera.Common.AppAssemblyUtils.GetBuildDate(Assembly.GetExecutingAssembly()), WorkingFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) }; return(await Task.FromResult(retValue)); }
public async Task <AboutResponse> GetUserAbout(string targetUser, SystemSession session) { AboutResponse response = null; var result = await Task.Factory.StartNew(() => Client.UserService.getUserAbout(targetUser, session.GetSession())).ConfigureAwait(false); if (result != null) { response = new AboutResponse { Headline = result.HeadLine, About = result.About }; } return(response); }
private Dictionary <string, HttpHandler> ConfigureHandlers(OpsEndpointsMiddlewareOptions options) { var ready = new HttpHandler(context => { var op = options; const string readyBody = "ready\n"; if (op.HealthModel.Ready()) { context.Response.StatusCode = 200; context.Response.ContentType = "text/plain"; return(context.Response.WriteAsync(readyBody)); } context.Response.StatusCode = (int)HttpStatusCode.ServiceUnavailable; return(Task.CompletedTask); }); var about = new HttpHandler(context => { var op = options; AboutResponse response = op.HealthModel.About().ToAboutResponse(); context.Response.StatusCode = 200; context.Response.ContentType = "application/json"; return(context.Response.WriteAsync(JsonConvert.SerializeObject(response, _serializerSettings))); }); var health = new HttpHandler(context => { var op = options; HealthResponse response = op.HealthModel.Health().ToHealthResponse(); context.Response.StatusCode = 200; context.Response.ContentType = "application/json"; return(context.Response.WriteAsync(JsonConvert.SerializeObject(response, _serializerSettings))); }); return(new Dictionary <string, HttpHandler> { { "/about", about }, { "/health", health }, { "/ready", ready } }); }