Bloom.Edit.ToolboxView.HandleSettings C# (CSharp) Method

HandleSettings() private static method

private static HandleSettings ( ApiRequest request ) : void
request Bloom.Api.ApiRequest
return void
        private static void HandleSettings(ApiRequest request)
        {
            if(request.HttpMethod != HttpMethods.Get)
                throw new ApplicationException(request.LocalPath()+" only implements 'get'");

            var settings = new Dictionary<string, object>
            {
                {"current", request.CurrentBook.BookInfo.CurrentTool}
            };

            foreach (var tool in GetToolsToDisplay(request.CurrentBook, IdsOfToolsThisVersionKnowsAbout))
            {
                if (!String.IsNullOrEmpty(tool.State))
                    settings.Add(tool.StateName, tool.State);
            }

            request.ReplyWithJson(settings);
        }