<commit_before>/**
 * Copyright (c) 2014 "Fronteer LTD"
 * Grasshopper Event Engine
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

var GrassHopper = require('gh-core');

var DocsAPI = require('gh-docs');

/**
 * @REST getSwagger
 *
 * Get the swagger resources json
 *
 * @Api private
 * @Server      admin,app
 * @Method      GET
 * @Path        /swagger
 * @Return      {object}                  Swagger resource listing, @see https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#51-resource-listing
 * @HttpResponse             200          Swagger resource listing available
 */
GrassHopper.appServer.on('get', '/api/swagger', function(req, res) {
    return res.status(200).send(DocsAPI.getResources(req.ctx));
});
GrassHopper.globalAdminServer.on('get', '/api/swagger', function(req, res) {
    return res.status(200).send(DocsAPI.getResources(req.ctx));
});

/**
 * @REST getSwaggerId
 *
 * Get the swagger apis json
 *
 * @Api private
 * @Server      admin,app
 * @Method      GET
 * @Path        /swagger/{id}
 * @PathParam   {string}     id           Resource id requested
 * @Return      {object}                  Swagger API declaration, @see https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#52-api-declaration
 * @HttpResponse             200          Swagger api declaration available
 */
GrassHopper.appServer.on('get', '/api/swagger/:id', function(req, res) {
    return res.status(200).send(DocsAPI.getApi(req.ctx, req.params.id));
});
GrassHopper.globalAdminServer.on('get', '/api/swagger/:id', function(req, res) {
    return res.status(200).send(DocsAPI.getApi(req.ctx, req.params.id));
});<commit_msg>Updated Docs REST API documentation<commit_after>/**
 * Copyright (c) 2014 "Fronteer LTD"
 * Grasshopper Event Engine
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

var GrassHopper = require('gh-core');

var DocsAPI = require('gh-docs');

/**
 * @REST getSwaggerDocumentation
 *
 * Get the Swagger documentation resources
 *
 * @Api private
 * @Server      admin,app
 * @Method      GET
 * @Path        /swagger
 * @Return      {object}                  Swagger resource listing @see https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#51-resource-listing
 */
var getSwaggerDocumentation = function(req, res) {
    return res.send(DocsAPI.getResources(req.ctx));
});

GrassHopper.globalAdminServer.on('get', '/api/swagger', getSwaggerDocumentation);
GrassHopper.appServer.on('get', '/api/swagger', getSwaggerDocumentation);

/**
 * @REST getSwaggerApiDocumentation
 *
 * Get the Swagger documentation for an API
 *
 * @Api private
 * @Server      admin,app
 * @Method      GET
 * @Path        /swagger/{id}
 * @PathParam   {string}     id           The API id to get the Swagger documentation for
 * @Return      {object}                  Swagger API declaration @see https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#52-api-declaration
 */
var getSwaggerApiDocumentation = function(req, res) {
    return res.send(DocsAPI.getApi(req.ctx, req.params.id));
});

GrassHopper.globalAdminServer.on('get', getSwaggerApiDocumentation);
GrassHopper.appServer.on('get', getSwaggerApiDocumentation);
{'fraction_non_alphanumeric': 0.1160955816050496, 'fraction_numerical': 0.009918845807033363, 'mean_word_length': 3.4017857142857144, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6416617', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1298, 'n_words': 407}